
Q61
Q61 What is the String Constant Pool in Java?
A collection of all String literals
A memory area for constant String storage
A pool for reusable String objects
All of the above
Q62
Q62 What is the result of concatenating strings using the '+' operator in Java?
A new String object is created every time
The original string is modified
No new objects are created
A StringBuilder object is used internally
Q63
Q63 Analyze the output of this code snippet:
StringBuffer buffer = new StringBuffer("Java");
buffer.reverse();
System.out.println(buffer);
avaJ
Java
A runtime error occurs
None of the above
Q64
Q64 What will this pseudocode output?
SET str = "Java" SET builder = StringBuilder(str) builder.append("Script") PRINT builder
JavaScript
Java
JavaScriptJava
Error
Q65
Q65 Analyze this pseudocode:
CREATE buffer = StringBuffer("Java") CALL buffer.reverse() PRINT buffer
avaJ
Java
A runtime error occurs
None of the above
Q66
Q66 What will be the result of this pseudocode?
SET str1 = "Java" SET str2 = "Java" IF str1 EQUALS str2 PRINT "Equal" ELSE PRINT "Not Equal"
Equal
Not Equal
Error
None
Q67
Q67 Identify the issue in this code snippet:
StringBuilder sb = "Java"; sb.append("Script");
Incorrect initialization of StringBuilder
No issue
append method used incorrectly
Syntax error
Q68
Q68 Spot the mistake:
StringBuffer buffer = new StringBuffer("Java");
buffer.setLength(2);
System.out.println(buffer);
It will print "Ja"
The setLength method is used incorrectly
No error
Syntax error
Q69
Q69 Find the error in this Java code:
String s1 = new String("Java");
String s2 = new String("Java");
System.out.println(s1 == s2);
s1 and s2 refer to the same object
No error
s1 and s2 refer to different objects
Syntax error
Q70
Q70 What will this pseudocode output?
CREATE thread START thread PRINT "Thread started" END
Thread started
An error
Nothing
Thread started and then an error
Q71
Q71 Analyze this pseudocode:
CREATE thread1, thread2 START thread1 CALL thread1.wait() START thread2 CALL thread2.notify()
thread2 starts after thread1 waits
thread1 and thread2 run concurrently
thread1 waits indefinitely
An error occurs
Q72
Q72 Identify the issue in this code snippet:
class MyThread extends Thread {
public void run() {
wait(); }
}
Incorrect use of wait()
Syntax error
No issue
Incorrect thread initialization
Q73
Q73 What is a lambda expression in Java?
A type of exception
A new collection type
A concise way to represent an anonymous function
A data storage format
Q74
Q74 What is the purpose of the Streams API in Java 8?
To handle I/O streams
To create a new type of collection
To enable functional-style operations on collections
To manage threads
Q75
Q75 What are functional interfaces in Java?
Interfaces with only static methods
Interfaces with multiple abstract methods
Interfaces with a single abstract method
Interfaces that support lambda expressions only
Q76
Q76 How does the Optional class help in Java?
It replaces all null values in a program
It is used to avoid NullPointerExceptions
It provides a better way of handling multithreading
It optimizes memory usage
Q77
Q77 What is the advantage of using method references in Java 8?
They make the code run faster
They make the code more readable when referring to methods or constructors
They replace all lambda expressions
They are necessary for functional programming
Q78
Q78 What will this pseudocode output?
CREATE list = [1, 2, 3, 4] CREATE stream = list.stream() FILTER stream WITH (n -> n > 2) PRINT stream
[1, 2, 3, 4]
[3, 4]
[1, 2]
Empty list
Q79
Q79 What is the primary purpose of the Locale class in Java?
To handle currency conversions
To manage different time zones
To represent a specific geographical, political, or cultural region
To change the layout of graphical components
Q80
Q80 Which component of Java is responsible for running the compiled Java bytecode?
JDK
JVM
JRE
JIT
Q81
Q81 Which feature of Java makes it possible to run a Java program on different platforms?
Object-Oriented
Platform-Independent
Syntax
Memory Management
Q82
Q82 Which data type would be best for storing a person's age in Java?
int
double
long
byte
Q83
Q83 Identify the output of this code:
boolean isJavaFun = true;
System.out.println(!isJavaFun);
true
false
Error
null
Q84
Q84 What is the output of this pseudocode?
SET x = 10
IF x > 5
THEN PRINT "Greater"
ELSE PRINT "Lesser"
Greater
Lesser
Error
No output
Q85
Q85 Evaluate this pseudocode:
SET a = 3 SET b = 4 PRINT a * b
7
12
Error
None of the above
Q86
Q86 Spot the mistake in this code snippet:
int i = 0;
while(i < 10) {
i++;
}
System.out.println(i);
Infinite loop
Syntax error
No error
Prints 0
Q87
Q87 What will be the output of the following code snippet:
if(false){
System.out.println("True");
}
else{
System.out.println("False");
}
True
False
Error
No Output
Q88
Q88 What is the difference between 'while' and 'do-while' loops in Java?
Syntax only
The 'do-while' loop executes at least once
Execution speed
No difference
Q89
Q89 Which keyword is used to exit a loop prematurely in Java?
break
continue
exit
stop
Q90
Q90 What is the output of this code?
int x = 1;
while(x < 4){
System.out.println(x); x++;
}
1 2 3
2 3 4
1 2 3 4
1

