What will be the output if you execute this code: int a[] = new int[1]; System.out.println(a[1]);
It will produce an exception.Correct
What will be the output if you execute this code? do{System.out.println("Hello World!");}while(false);
print "Hello World"Correct
What will be the output if you execute this code? do{System.out.println("Hello World!");}while(true);
print "Hello World" infinitelyCorrect
what will be the output if you execute this code? int x=1; switch(x){ case 1: System.out.print(“1”); case 2: System.out.print(“1”); case 3: System.out.print(“1”); default: System.out.print(“1”); }
display 1111 Correct
what will be the output if you execute this code? int x=2; switch(x){ case 1: System.out.print(“1”); case 2: System.out.print(“1”); case 3: System.out.print(“1”); default: System.out.print(“1”); }
display 111 Correct
What will be the output if you execute this code?do{System.out.println("Hello World!");}while(false);
None of the above
Do nothing
The code will not run because of syntax error
print "Hello World"Correct
print "Hello World" infinitely
What will be the output if you execute this code?do{System.out.println("Hello World!");}while(true);
None of the above
The code will not run because of syntax error
Do nothing
print "Hello World" infinitelyCorrect
print "Hello World"
what will be the output if you execute this code?int x=1;switch(x){case 1: System.out.print("1");case 2: System.out.print("1");case 3: System.out.print("1");default: System.out.print("1");}
None of the above}
display 1234
display nothing
display 1111Correct
display 1
What will be the value of x after executing this code for(int x=0; x<=10; x++) {} is run?
11Correct
What will be the value of x after executing this code for(int x=0; x<=11; x++) {} is run?
12Correct
What will be the value of x after executing this codefor(int x=0; x<=10; x++) {} is run?
none of the above
11Correct
10
1
0
What will be the value of x after you execute this statement int z=0; for(int x=0; x
None of theseCorrect
What will be the value of x after you execute this statement int z=0; for(int x=0; x<10; x++) for(int y=0; y<x; y++) z*=(x*y);
None of the ChoiceCorrect
What will be the value of x after you execute this statementint z=0; for(int x=0; x<10; x++) for(int y=0; y<x; y++) z*=(x*y);
128
None of the aboveCorrect
236
512
1
What will be the value of x if we execute this: String s = "25"; int x = Integer.parseInt(s); ?
int 25Correct
String 25
The code is not valid
0
None of the above
What will happen if we compile the statement below? ~System.out.println(“Hello World!”)
There will be a syntax error after compilation.Correct
What will happen if we compile the statement below?~System.out.println("Hello World!")
There will be a syntax error after compilationCorrect
There will be a logical error after compilation
There will be a runtime error after compilation
None of the Above
There will be no error after compilation
What will happen if you use JOptionPane. showInputDialog statement in your program?
The program will display an input dialog box that allows the user to input text and returns String valueCorrect
The program will display message dialog box
None of the above
The program will display message dialog box returns String value
The program will display an input dialog box that allows the user to input text and returns the correct type value
What will happen if you use JOptionPane.showMessageDialog statement in your program?
The program will display an input dialog box that allows the user to input text and returns String value
The program will display message dialog boxCorrect
None of the above
The program will display message dialog box returns String value
The program will display an input dialog box that allows the user to input text and returns the correct type value
When was the officially released of Java?
1991
None of the Above
1995Correct
1992
1996
Which is not a decision control structure?
if else
if
if else-if else
switch
None of the aboveCorrect
Which is not a repetition control structure?
None of the choices
switchCorrect
do while
for
while
Which of the following a valid Java identifier?
all of the aboveCorrect
id
id_1
$id
_id
Which of the following array declarations is correct?
double[ ] grades;grades = new double[2];Correct
double[10] money=double[ ];
byte[ ] b=byte[ 20];
Integer i[ ]=new Integer;
String names[20]=new String;
Which of the following class declaration is not allowed to be inherited?
public abstract class Person {}
None of the above
public class Person {}
class Person{}
public final class Person {}Correct
Which of the following class declaration is not allowed to be instantiated?
public abstract class Person {}Correct
class Person{}
public class Person {}
None of the above
public final class Person {}
Which of the following correctly accesses the sixth element stored in an array of 10 elements?
stringArray[5];Correct
Which of the following creates an instance of a class?
Test t = new Test();
All of the choicesCorrect
String str = new String();
String str = new String();
Object obj = new Object();
Which of the following declares an array of int named intArray?
All of theseCorrect
Which of the following does not return numeric value?
None of theseCorrect
Which of the following has the correct form for an if statement?
if boolean_expression
boolean_expression
if (boolean_expression)Correct
none of the above
if boolean_expression
Which of the following is a correct declaration of an array?