Java MCQ Quiz Hub

Java Mcq Question Set 7

Choose a topic to test your knowledge and improve your Java skills

What is the default value of priority variable MIN_PRIORITY AND MAX_PRIORITY?





✅ Correct Answer: 2

Which of these method waits for the thread to treminate?





✅ Correct Answer: 4

Which of these method is used to explicitly set the priority of a thread?





✅ Correct Answer: 1

What is synchronization in reference to a thread?





✅ Correct Answer: 4

Which of these method is used to implement Runnable interface?





✅ Correct Answer: 3

Which of these interface is implemented by Thread class?





✅ Correct Answer: 2

Which of these method is used to begin the execution of a thread?





✅ Correct Answer: 4

Which of these method waits for the thread to treminate?





✅ Correct Answer: 1

Which of these statement is incorrect?





✅ Correct Answer: 3

Which of these class is used to make a thread?





✅ Correct Answer: 1

Which of these method of Thread class is used to find out the priority given to a thread?





✅ Correct Answer: 2

Which of these method of Thread class is used to Suspend a thread for a period of time?





✅ Correct Answer: 2

Which function of pre defined class Thread is used to check weather current thread being checked is still running?





✅ Correct Answer: 4

What is multithreaded programming?





✅ Correct Answer: 4

Which of these are types of multitasking?





✅ Correct Answer: 3

Which of these packages contain all the Java's built in exceptions?





✅ Correct Answer: 2

Thread priority in Java is?





✅ Correct Answer: 1

What will happen if two thread of same priority are called to be processed simultaneously





✅ Correct Answer: 3

Which of these statements is incorrect?





✅ Correct Answer: 4

Which of the following can be operands of arithmetic operators?





✅ Correct Answer: 3

Modulus operator, %, can be applied to which of these?





✅ Correct Answer: 3

With x = 0, which of the following are legal lines of Java code for changing the value of x to 1? 1. x++; 2. x = x + 1; 3. x += 1; 4. x =+ 1;





✅ Correct Answer: 1

Decrement operator, , decreases value of variable by what number?





✅ Correct Answer: 1

Which of these statements are incorrect?





✅ Correct Answer: 4

Output : class increment { public static void main(String args[]) { double var1 = 1 + 5; double var2 = var1 / 4; int var3 = 1 + 5; int var4 = var3 / 4; System.out.print(var2 + " " + var4); } }





✅ Correct Answer: 2

Output : class Modulus { public static void main(String args[]){double a = 25.64; int b = 25; a = a % 10; b = b % 10; System.out.println(a + " " + b); } }





✅ Correct Answer: 1

Output : class increment { public static void main(String args[]) {int g = 3; System.out.print(++g * 8); } }





✅ Correct Answer: 3

Output : class Output { public static void main(String args[]){ int x , y; x = 10; x++; --x; y = x++; System.out.println(x + " " + y); } }





✅ Correct Answer: 4

Which operator is used to invert all the digits in binary representation of a number?





✅ Correct Answer: 2

On applying Left shift operator, <<, on an integer bits are lost one they are shifted past which position bit?





✅ Correct Answer: 1

Which right shift operator preserves the sign of the value?





✅ Correct Answer: 1

Which of these statements are incorrect?





✅ Correct Answer: 2

What is the output of relational operators?





✅ Correct Answer: 1

Which of these is returned by greater than, <, and equal to, ==, operator?





✅ Correct Answer: 2

Which of the following operators can operate on a boolean variable?





✅ Correct Answer: 4

Which of these operators can skip evaluating right hand operand?





✅ Correct Answer: 1

Which of these statement is correct?





✅ Correct Answer: 2

Which of these have highest precedence?





✅ Correct Answer: 3

What should be expression1 evaluate to in using ternary operator as in this line? expression1 ? expression2 : expression3





✅ Correct Answer: 1

What is the value stored in x in following lines of code? int x, y, z; x = 0; y = 1; x = y = z = 8;





✅ Correct Answer: 2

What is the order of precedence (highest to lowest) of following operators? 1. & 2. ^ 3. ?:





✅ Correct Answer: 4

Which of these statements are incorrect?





✅ Correct Answer: 4

Which of these operators is used to allocate memory to array variable in Java?





✅ Correct Answer: 3

Which of these is an incorrect array declaration?





✅ Correct Answer: 1

What will this code print? int arr[] = new int [5]; System.out.print(arr);





✅ Correct Answer: 3

Which of these is an incorrect Statement?





✅ Correct Answer: 2

Which of these is necessary to specify at time of array initialization?





✅ Correct Answer: 1

When does Exceptions in Java arises in code sequence?





✅ Correct Answer: 2

Which of these keywords is not a part of exception handling?





✅ Correct Answer: 4

Which of these keywords must be used to monitor for exceptions?





✅ Correct Answer: 2