Download as pdf or txt
Download as pdf or txt
You are on page 1of 124

Question 1

Answer saved
Marked out of 1.00

Flag question

Question text
What is the correct statement to run Java program in command line?

Select one:
a. java HelloWorld
b. java HelloWorld.java
c. javac HelloWorld
d. javac HelloWorld.java

Question 2
Answer saved
Marked out of 1.00

Flag question

Question text
JVM is responsible for

Select one:
a. Compiling source code
b. Interpreting bytecode
c. Reading bytecode
d. Generating bytecode

Question 3
Answer saved
Marked out of 1.00

Flag question
Question text
Which of the following is not usable for writing java source code?

Select one:
a. NetBeans
b. BlueJ
c. Notepad
d. eclipse
e. None of the choices

Question 4
Answer saved
Marked out of 1.00

Flag question

Question text
The Java feature, "write once, run anywhere", is termed as

Select one:
a. Platform independent
b. High Performance
c. Robust
d. Object Oriented

Question 5
Answer saved
Marked out of 1.00

Flag question

Question text
Can we directly compile codes from notepad?

Select one:
a. Yes, Because we can call Java compiler from notepad
b. No, We can only write codes in Notepad
c. No correct answer
d. It depends, if there is a compiler embedded in Notepad.

Question 6
Answer saved
Marked out of 1.00

Flag question

Question text
What is the correct statement to compile Java program in command line?

Select one:
a. javac HelloWorld.java
b. java HelloWorld
c. javac HelloWorld
d. java HelloWorld.java

Question 7
Answer saved
Marked out of 1.00

Flag question

Question text
The feature of Java which makes it possible to execute several tasks simultaneously.

Select one:
a. Code Security
b. Robust
c. Platform independent
d. Multithreaded

Question 8
Answer saved
Marked out of 1.00
Flag question

Question text
Why do we need to set the path for JavaC in command line?

Select one:
a. It is part of the compilation process
b. To resolve syntax error
c. None of the choices
d. To make JavaC available or accessible in command line.
e. To resolve runtime error

Question 9
Answer saved
Marked out of 1.00

Flag question

Question text
What did java generates after compiling the java source code?

Select one:
a. Class Code
b. Image file
c. Executable file
d. Byte Code

Question 10
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not the feature of java?

Select one:
a. Static
b. Code Security
c. Platform independent
d. Robust
e. None of the choices

Question 1
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid identifier?

Select one:
a. true
b. public
c. None of the choices
d. name
e. static

Question 2
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not an escape sequence?

Select one:
a. \f
b. \t
c. none of the choices
d. \b

Question 3
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a java keyword?

Select one:
a. name
b. None of the choices
c. else
d. if
e. goto

Question 4
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a valid variable declaration in Java?

Select one:
a. None of the choices
b. float x = 2.0D;
c. short x;
d. int x;
e. int x = 1;

Question 5
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a valid Float value?

Select one:
a. 1.23
b. 1.2345E+3
c. 12345678910F
d. none of the choices
e. 3.4028235E+38F

Question 6
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a Java comment?

Select one:
a. Single Line Comments
b. Documentation Comments
c. Multi-Line Comments
d. None of the choices
e. Declaration Comments

Question 7
Answer saved
Marked out of 1.00
Flag question

Question text
Which of the following is not Java Literal?

Select one:
a. Float value
b. None of the choices
c. Integer value
d. Character value
e. Boolean value

Question 8
Answer saved
Marked out of 1.00

Flag question

Question text
What is floating-point literal?

Select one:
a. An integer literal with decimal point.
b. All of the statements are correct
c. It could be double or float value.
d. Can be express in scientific notation.
e. By default it is double type.

Question 9
Answer saved
Marked out of 1.00

Flag question
Question text
Which of the following a valid Java identifier?

Select one:
a. all of the choices
b. _id
c. id_1
d. id
e. $id

Question 10
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a primitive data type?

Select one:
a. long
b. String
c. byte
d. none of the choices
e. short

Question 1
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a valid variable declaration in Java?

Select one:
a. short x;
b. int x;
c. int x = 1;
d. float x = 2.0D;
e. None of the choices

Question 2
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not the feature of java?

Select one:
a. Static
b. None of the choices
c. Code Security
d. Platform independent
e. Robust

Question 3
Answer saved
Marked out of 1.00

Flag question

Question text
What is the correct statement to compile Java program in command line?

Select one:
a. java HelloWorld
b. javac HelloWorld.java
c. javac HelloWorld
d. java HelloWorld.java

Question 4
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following a valid Java identifier?

Select one:
a. all of the choices
b. $id
c. id
d. id_1
e. _id

Question 5
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following we are not allowed to write java source code?

Select one:
a. BlueJ
b. NetBeans
c. eclipse
d. None of the choices
e. Notepad

Question 6
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not an escape sequence?

Select one:
a. none of the choices
b. \b
c. \t
d. \f

Question 7
Answer saved
Marked out of 1.00

Flag question

Question text
Can we directly compile codes from notepad?

Select one:
a. It depends, if there is a compiler embedded in Notepad.
b. No, We can only write codes in Notepad
c. No correct answer
d. Yes, Because we can call Java compiler from notepad

Question 8
Answer saved
Marked out of 1.00

Flag question

Question text
The Java feature, "write once, run anywhere", is termed as

Select one:
a. Platform independent
b. Object Oriented
c. Robust
d. High Performance

Question 9
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid identifier?

Select one:
a. None of the choices
b. public
c. true
d. static
e. name

Question 10
Answer saved
Marked out of 1.00

Flag question

Question text
What will happen if we compile the statement below? ~System.out.println(“Hello World!”)

Select one:
a. None of the choices
b. There will be a runtime error after compilation.
c. There will be a syntax error after compilation.
d. There will be a logical error after compilation.
e. There will be no error after compilation.

Question 11
Answer saved
Marked out of 1.00

Flag question

Question text
Can we directly compile codes from NetBeans?

Select one:
a. Yes, because we can call Java compiler from NetBeans
b. It depends, if there is a compiler embedded in NetBeans.
c. No correct answer
d. No, we can only write codes in NetBeans

Question 12
Answer saved
Marked out of 1.00

Flag question

Question text
Why do we need to set the path for JavaC in command line?

Select one:
a. It is part of the compilation process
b. To resolve runtime error
c. None of the choices
d. To make JavaC available or accessible in command line.
e. To resolve syntax error

Question 13
Answer saved
Marked out of 1.00
Flag question

Question text
Which of the following is not Java Literal?

Select one:
a. Integer value
b. Boolean value
c. None of the choices
d. Float value
e. Character value

Question 14
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is true about syntax errors:

Select one:
a. All of the statements are true
b. You will have syntax errors if you misspell the Java command.
c. Syntax errors are usually typing errors.
d. Incorrect capitalization leads to syntax error.
e. All of the statements are false

Question 15
Answer saved
Marked out of 1.00

Flag question
Question text
What is the correct statement to run Java program in command line?

Select one:
a. java HelloWorld.java
b. java HelloWorld
c. javac HelloWorld
d. javac HelloWorld.java

Question 16
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is true about Runtime errors:

Select one:
a. No correct answer
b. Runtime errors occur after compilation.
c. Runtime errors occur during run-time.
d. Runtime errors occur when there is a design flaw in your program
e. All of the choices are correct

Question 17
Answer saved
Marked out of 1.00

Flag question

Question text
What is the correct statement to set JavaC path in command line?

Select one:
a. All of the given choices are correct
b. set path
c. C:\Program Files\Java\jdk1.6.0_23\bin
d. < JavaC directory >
e. path C:\Program Files\Java\jdk1.6.0_23\bin
f. No correct answer

Question 18
Answer saved
Marked out of 1.00

Flag question

Question text
JVM is responsible for

Select one:
a. Reading bytecode
b. Generating bytecode
c. Interpreting bytecode
d. Compiling source code

Question 19
Answer saved
Marked out of 1.00

Flag question

Question text
What is floating-point literal?

Select one:
a. It could be double or float value.
b. Can be express in scientific notation.
c. An integer literal with decimal point.
d. By default it is double type.
e. All of the statements are correct
Question 20
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a valid Float value?

Select one:
a. 12345678910F
b. 1.2345E+3
c. 3.4028235E+38F
d. 1.23
e. none of the choices

Question 21
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a Java comment?

Select one:
a. Documentation Comments
b. Declaration Comments
c. Multi-Line Comments
d. Single Line Comments
e. None of the choices

Question 22
Answer saved
Marked out of 1.00
Flag question

Question text
What is the extension name of a Java Source code?

Select one:
a. j
b. class
c. javac
d. java

Question 23
Answer saved
Marked out of 1.00

Flag question

Question text
When was the officially released of Java?

Select one:
a. 1995
b. 1991
c. 1992
d. 1996

Question 24
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a java keyword?
Select one:
a. if
b. else
c. goto
d. name
e. None of the choices

Question 25
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a primitive data type?

Select one:
a. long
b. none of the choices
c. String
d. byte
e. short

Question 26
Answer saved
Marked out of 1.00

Flag question

Question text
What did java generates after compiling the java source code?

Select one:
a. Class Code
b. Image file
c. Byte Code
d. Executable file

Question 27
Answer saved
Marked out of 1.00

Flag question

Question text
The feature of Java which makes it possible to execute several tasks simultaneously.

Select one:
a. Platform independent
b. Multithreaded
c. Code Security
d. Robust

Question 28
Answer saved
Marked out of 1.00

Flag question

Question text
What was the initial name for the Java programming language?

Select one:
a. Oak
b. C
c. Java
d. NetBeans

Question 29
Answer saved
Marked out of 1.00
Flag question

Question text
What is the input for Java Compiler?

Select one:
a. Code
b. Byte Code
c. Native Code
d. Source Code

Question 30
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not usable for writing java source code?

Select one:
a. eclipse
b. BlueJ
c. Notepad
d. None of the choices
e. NetBeans

Question 1
Answer saved
Marked out of 1.00
Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = a & b;

2
Answer:

Question 2
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
booleanResult = !((a + c) > b) && x;

Select one:
True
False

Question 3
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = b << c;

48
Answer:

Question 4
Answer saved
Marked out of 1.00
Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult += c;

18
Answer:

Question 5
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = a >> 2;

0
Answer:

Question 6
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = ++b * a + c;

15
Answer:

Question 7
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
booleanResult = x && y || x;

Select one:
True
False

Question 8
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = 1;

1
Answer:

Question 9
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = a | b + c;

11
Answer:

Question 10
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:
int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = b % a;

1
Answer:

Question 1
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid nextInt() return value?

Select one:
a. floating-point literal
b. 1010
c. long value
d. 3.1416
e. None of the choices

Question 2
Answer saved
Marked out of 1.00

Flag question
Question text
Which of the following is a valid statement to accept int input? Let us assume that we have declared
scan as Scanner.

Select one:
a. None of the choices
b. int num = scan.nextLong();
c. short num = scan.nextShort();
d. short num = scan.nextInt();
e. int num = scan.getInt();

Question 3
Answer saved
Marked out of 1.00

Flag question

Question text
What type of value does the nextLine() returns?

Select one:
a. None of the choices
b. String
c. Line
d. long
e. double

Question 4
Answer saved
Marked out of 1.00

Flag question

Question text
What will happen if you use JOptionPane.showMessageDialog statement in your program?

Select one:
a. None of the choices
b. The program will display message dialog box.
c. The program will display an input dialog box that allows the user to input text and returns the
correct type value.
d. The program will display message dialog box returns String value.
e. The program will display an input dialog box that allows the user to input text and returns String
value.

Question 5
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following method reads input from the user and return String value?

Select one:
a. nextText()
b. All of the above
c. nextString()
d. nextLine()
e. nextValue()

Question 6
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid nexDouble() return value?

Select one:
a. floating-point literal
b. 12.0
c. double value
d. 3.1416
e. All of the choices

Question 7
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following does not return numeric value?

Select one:
a. nextDouble()
b. nextInt()
c. nextLong()
d. None of the choices
e. nextShort()

Question 8
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid statement to accept String input?

Select one:
a. String str = JOptionPane.showInputDialog("");
b. None of the choices
c. String str = scan.nextString();
d. String num = scan.nextText();
e. string str = scan.nextShort();
Question 9
Answer saved
Marked out of 1.00

Flag question

Question text
What will happen if you use JOptionPane. showInputDialog statement in your program?

Select one:
a. The program will display an input dialog box that allows the user to input text and returns String
value.
b. The program will display an input dialog box that allows the user to input text and returns the
correct type value.
c. None of the choices
d. The program will display message dialog box returns String value.
e. The program will display message dialog box.

Question 10
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid nextByte() return value?

Select one:
a. int value
b. short value
c. 3
d. 128
e. None of the above

Question 1
Answer saved
Marked out of 1.00
Flag question

Question text
Which of the following is a valid statement to accept int input? Let us assume that we have declared
scan as Scanner.

Select one:
a. None of the choices
b. int num = scan.nextLong();
c. int num = scan.getInt();
d. short num = scan.nextShort();
e. short num = scan.nextInt();

Question 2
Answer saved
Marked out of 1.00

Flag question

Question text
What is the correct statement to set JavaC path in command line?

Select one:
a. < JavaC directory >
b. No correct answer
c. All of the given choices are correct
d. C:\Program Files\Java\jdk1.6.0_23\bin
e. path C:\Program Files\Java\jdk1.6.0_23\bin
f. set path

Question 3
Answer saved
Marked out of 1.00
Flag question

Question text
What will happen if you use JOptionPane.showMessageDialog statement in your program?

Select one:
a. None of the choices
b. The program will display message dialog box returns String value.
c. The program will display message dialog box.
d. The program will display an input dialog box that allows the user to input text and returns String
value.
e. The program will display an input dialog box that allows the user to input text and returns the
correct type value.

Question 4
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid identifier?

Select one:
a. None of the choices
b. true
c. static
d. public
e. name

Question 5
Answer saved
Marked out of 1.00
Flag question

Question text
What will be the output if you execute this code?
do{System.out.println("Hello World!");}while(true);

Select one:
a. The code will not run because of syntax error
b. Do nothing
c. print "Hello World"
d. None of the above.
e. print "Hello World" infinitely

Question 6
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = b << c;
48
Answer:

Question 7
Answer saved
Marked out of 1.00

Flag question

Question text
The feature of Java which makes it possible to execute several tasks simultaneously.

Select one:
a. Robust
b. Code Security
c. Platform independent
d. Multithreaded

Question 8
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult += c;

18
Answer:

Question 9
Answer saved
Marked out of 1.00

Flag question

Question text
What is the correct statement to compile Java program in command line?

Select one:
a. java HelloWorld.java
b. java HelloWorld
c. javac HelloWorld
d. javac HelloWorld.java

Question 10
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;
What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = b % a;

1
Answer:

Question 11
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid nextByte() return value?

Select one:
a. short value
b. 3
c. None of the above
d. 128
e. int value

Question 12
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following has the correct form for an if statement?

Select one:
a. if boolean_expression
b. boolean_expression
c. if boolean_expression
d. none of the choices
e. if (boolean_expression)
Question 13
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not usable for writing java source code?

Select one:
a. None of the choices
b. BlueJ
c. NetBeans
d. eclipse
e. Notepad

Question 14
Answer saved
Marked out of 1.00

Flag question

Question text
Which statement will check if x is less than y?

Select one:
a. if (x>y)?:
b. if (x<y);
c. none of the above
d. if (x>y)
e. if (x<>y)

Question 15
Answer saved
Marked out of 1.00
Flag question

Question text
Which of the following a valid Java identifier?

Select one:
a. _id
b. id_1
c. id
d. all of the choices
e. $id

Question 16
Answer saved
Marked out of 1.00

Flag question

Question text
What will be the value of x after executing this code
for(int x=0; x<=10; x++) {} is run?

Select one:
a. 11
b. none of the above
c. 0
d. 1
e. 10

Question 17
Answer saved
Marked out of 1.00
Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = ++b * a + c;

15
Answer:

Question 18
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following does not return numeric value?

Select one:
a. nextInt()
b. nextLong()
c. None of the choices
d. nextShort()
e. nextDouble()
Question 19
Answer saved
Marked out of 1.00

Flag question

Question text
What type of value does the nextLine() returns?

Select one:
a. long
b. double
c. None of the choices
d. Line
e. String

Question 20
Answer saved
Marked out of 1.00

Flag question

Question text
What did java generates after compiling the java source code?

Select one:
a. Image file
b. Executable file
c. Class Code
d. Byte Code

Question 21
Answer saved
Marked out of 1.00
Flag question

Question text
What is floating-point literal?

Select one:
a. It could be double or float value.
b. Can be express in scientific notation.
c. By default it is double type.
d. An integer literal with decimal point.
e. All of the statements are correct

Question 22
Answer saved
Marked out of 1.00

Flag question

Question text
What is the correct statement to run Java program in command line?

Select one:
a. java HelloWorld
b. javac HelloWorld
c. java HelloWorld.java
d. javac HelloWorld.java

Question 23
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is true about Runtime errors:

Select one:
a. Runtime errors occur after compilation.
b. Runtime errors occur during run-time.
c. No correct answer
d. All of the choices are correct
e. Runtime errors occur when there is a design flaw in your program

Question 24
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a Java comment?

Select one:
a. Declaration Comments
b. Documentation Comments
c. None of the choices
d. Single Line Comments
e. Multi-Line Comments

Question 25
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid nextInt() return value?

Select one:
a. None of the choices
b. 1010
c. 3.1416
d. floating-point literal
e. long value

Question 26
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid statement to accept String input?

Select one:
a. None of the choices
b. String str = scan.nextString();
c. String str = JOptionPane.showInputDialog("");
d. String num = scan.nextText();
e. string str = scan.nextShort();

Question 27
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a java keyword?

Select one:
a. if
b. else
c. name
d. None of the choices
e. goto
Question 28
Answer saved
Marked out of 1.00

Flag question

Question text
When was the officially released of Java?

Select one:
a. 1995
b. 1996
c. 1991
d. 1992

Question 29
Answer saved
Marked out of 1.00

Flag question

Question text
What will happen if we compile the statement below? ~System.out.println(“Hello World!”)

Select one:
a. There will be a syntax error after compilation.
b. There will be a logical error after compilation.
c. There will be a runtime error after compilation.
d. There will be no error after compilation.
e. None of the choices

Question 30
Answer saved
Marked out of 1.00
Flag question

Question text
What is the extension name of a Java Source code?

Select one:
a. class
b. j
c. java
d. javac

Question 31
Answer saved
Marked out of 1.00

Flag question

Question text
What is the input for Java Compiler?

Select one:
a. Source Code
b. Byte Code
c. Native Code
d. Code

Question 32
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:
int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
booleanResult = !((a + c) > b) && x;

Select one:
True
False

Question 33
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not the feature of java?

Select one:
a. Robust
b. None of the choices
c. Static
d. Code Security
e. Platform independent

Question 34
Answer saved
Marked out of 1.00
Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = a | b + c;

11
Answer:

Question 35
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a valid Float value?

Select one:
a. 1.23
b. 12345678910F
c. 1.2345E+3
d. none of the choices
e. 3.4028235E+38F
Question 36
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is true about syntax errors:

Select one:
a. Syntax errors are usually typing errors.
b. All of the statements are false
c. All of the statements are true
d. Incorrect capitalization leads to syntax error.
e. You will have syntax errors if you misspell the Java command.

Question 37
Answer saved
Marked out of 1.00

Flag question

Question text
What will happen if you use JOptionPane. showInputDialog statement in your program?

Select one:
a. The program will display message dialog box.
b. The program will display an input dialog box that allows the user to input text and returns the
correct type value.
c. The program will display message dialog box returns String value.
d. None of the choices
e. The program will display an input dialog box that allows the user to input text and returns String
value.

Question 38
Answer saved
Marked out of 1.00
Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = a & b;

2
Answer:

Question 39
Answer saved
Marked out of 1.00

Flag question

Question text
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);

Select one:
a. 1
b. 128
c. 512
d. None of the above
e. 236

Question 40
Answer saved
Marked out of 1.00

Flag question

Question text
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”);
}

Select one:
a. display nothing
b. display 1111
c. display 1234
d. display 1
e. None of the above}

Question 41
Answer saved
Marked out of 1.00

Flag question
Question text
Why do we need to set the path for JavaC in command line?

Select one:
a. To resolve runtime error
b. It is part of the compilation process
c. To resolve syntax error
d. To make JavaC available or accessible in command line.
e. None of the choices

Question 42
Answer saved
Marked out of 1.00

Flag question

Question text
Can we directly compile codes from notepad?

Select one:
a. No, We can only write codes in Notepad
b. Yes, Because we can call Java compiler from notepad
c. It depends, if there is a compiler embedded in Notepad.
d. No correct answer

Question 43
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid nexDouble() return value?

Select one:
a. double value
b. All of the choices
c. floating-point literal
d. 12.0
e. 3.1416

Question 44
Answer saved
Marked out of 1.00

Flag question

Question text
Can we directly compile codes from NetBeans?

Select one:
a. It depends, if there is a compiler embedded in NetBeans.
b. No correct answer
c. No, we can only write codes in NetBeans
d. Yes, because we can call Java compiler from NetBeans

Question 45
Answer saved
Marked out of 1.00

Flag question

Question text
Which is not a decision control structure?

Select one:
a. if else
b. None of the choices
c. if
d. if else-if else
e. switch

Question 46
Answer saved
Marked out of 1.00

Flag question

Question text
Which is not a repetition control structure?

Select one:
a. switch
b. for
c. None of the choices
d. while
e. do while

Question 47
Answer saved
Marked out of 1.00

Flag question

Question text
What will be the output if you execute this code?
do{System.out.println("Hello World!");}while(false);

Select one:
a. The code will not run because of syntax error
b. Do nothing
c. None of the choices
d. print "Hello World"
e. print "Hello World" infinitely

Question 48
Answer saved
Marked out of 1.00
Flag question

Question text
Which statement will check if x is equal to y?

Select one:
a. if (x<>y)
b. if (y>y)
c. none of the choices
d. if (x!<y)
e. if (x>y)

Question 49
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
booleanResult = x && y || x;

Select one:
True
False

Question 50
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = a >> 2;

0
Answer:

Question 1
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following declares an array of int named intArray?

Select one:
a. All of the choices
b. int[][] intArray;
c. int intArray[][];
d. int intArray[];
e. int[] intArray;

Question 2
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid multidimensional array?

Select one:
a. int[][][][] intArray;
b. All of the choices
c. int[][] intArray;
d. int[][][] intArray;
e. int intArray[][][];

Question 3
Answer saved
Marked out of 1.00

Flag question

Question text
What is the output of the code snippet below:
int[] intArray = new int[10];
for(int x = 0; x<intArray.length; x++){System.out.print(intArray[x]);}

Select one:
a. 0000000000
b. none of the choices
c. 1235678910
d. The given code is not valid
e. 012356789

Question 4
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following correctly accesses the sixth element stored in an array of 10 elements?

Select one:
a. intArray[10];
b. intArray[7];
c. intArray[6];
d. None of the choices
e. stringArray[5];

Question 5
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following correctly accesses the sixth element stored in an array of 10 elements?

Select one:
a. stringArray[5];
b. intArray[10];
c. intArray[7];
d. None of the choices
e. intArray[6];
Question 6
Answer saved
Marked out of 1.00

Flag question

Question text
What is the output of the code snippet below:
int[] intArray = { 1, 2, 3, 5, 6, 7 };
for(int x = intArray.length-1; x>=0; x--){System.out.print(intArray[x]);}

Select one:
a. 12356
b. none of the choices
c. 765321
d. 123567
e. The given code is not valid

Question 7
Answer saved
Marked out of 1.00

Flag question

Question text
From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[3]?

Select one:
a. 5
b. 7
c. 6
d. 4
e. None of the choices

Question 8
Answer saved
Marked out of 1.00
Flag question

Question text
What is the index number of the last element of an array with 30 elements?

Select one:
a. 29
b. 0
c. None of the choices
d. 30
e. 31

Question 9
Answer saved
Marked out of 1.00

Flag question

Question text
What is the length of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };

Select one:
a. 7
b. 4
c. 6
d. none of the choices
e. 5

Question 10
Answer saved
Marked out of 1.00

Flag question
Question text
What is the maximum index of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };

Select one:
a. 6
b. 7
c. None of the choices
d. 5
e. 4

What is the output of the code snippet below:


int[] intArray = { 1, 2, 3, 5, 6, 7 };
for(int x = intArray.length-1; x>=0; x--){System.out.print(intArray[x]);}

Select one:
a. none of the choices
b. 123567
c. 12356
d. 765321
e. The given code is not valid

Question 2
Answer saved
Marked out of 1.00

Flag question

Question text
What is floating-point literal?

Select one:
a. By default it is double type.
b. All of the statements are correct
c. Can be express in scientific notation.
d. It could be double or float value.
e. An integer literal with decimal point.
Question 3
Answer saved
Marked out of 1.00

Flag question

Question text
What will happen if you use JOptionPane. showInputDialog statement in your program?

Select one:
a. The program will display an input dialog box that allows the user to input text and returns the
correct type value.
b. The program will display an input dialog box that allows the user to input text and returns String
value.
c. The program will display message dialog box.
d. The program will display message dialog box returns String value.
e. None of the choices

Question 4
Answer saved
Marked out of 1.00

Flag question

Question text
What is the output of the code snippet below: void main(){test();test();} void test()
{System.out.print(“1”);}

Select one:
a. 1
b. None of the choices
c. 3
d. 2
e. 11

Question 5
Answer saved
Marked out of 1.00
Flag question

Question text
What will happen if you use JOptionPane.showMessageDialog statement in your program?

Select one:
a. The program will display message dialog box returns String value.
b. None of the choices
c. The program will display an input dialog box that allows the user to input text and returns the
correct type value.
d. The program will display message dialog box.
e. The program will display an input dialog box that allows the user to input text and returns String
value.

Question 6
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a Java comment?

Select one:
a. Single Line Comments
b. Documentation Comments
c. Declaration Comments
d. Multi-Line Comments
e. None of the choices

Question 7
Answer saved
Marked out of 1.00
Flag question

Question text
Which of the following is a valid nextInt() return value?

Select one:
a. floating-point literal
b. 1010
c. None of the choices
d. long value
e. 3.1416

Question 8
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following method reads input from the user and return String value?

Select one:
a. nextText()
b. All of the above
c. nextLine()
d. nextValue()
e. nextString()

Question 9
Answer saved
Marked out of 1.00

Flag question
Question text
Which of the following shows a valid Overloading method?

Select one:
a. All of the choices
b. void test(){} void test(){}
c. none of the choices
d. void test(char x, int y){} void test(int x, char y){}
e. void test(int x){} void test(int y){}

Question 10
Answer saved
Marked out of 1.00

Flag question

Question text
JVM is responsible for

Select one:
a. Compiling source code
b. Generating bytecode
c. Reading bytecode
d. Interpreting bytecode

Question 11
Answer saved
Marked out of 1.00

Flag question

Question text
What did java generates after compiling the java source code?

Select one:
a. Image file
b. Executable file
c. Byte Code
d. Class Code

Question 12
Answer saved
Marked out of 1.00

Flag question

Question text
What will be the output if you execute this code?
do{System.out.println("Hello World!");}while(true);

Select one:
a. Do nothing
b. print "Hello World"
c. print "Hello World" infinitely
d. None of the above.
e. The code will not run because of syntax error

Question 13
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid method name:

Select one:
a. int
b. none of the choices
c. compute
d. compute grade
e. final

Question 14
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a primitive data type?

Select one:
a. byte
b. String
c. none of the choices
d. long
e. short

Question 15
Answer saved
Marked out of 1.00

Flag question

Question text
From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[3]?

Select one:
a. 5
b. 6
c. 7
d. None of the choices
e. 4

Question 16
Answer saved
Marked out of 1.00
Flag question

Question text
Which of the following has the correct form for an if statement?

Select one:
a. if (boolean_expression)
b. if boolean_expression
c. none of the choices
d. boolean_expression
e. if boolean_expression

Question 17
Answer saved
Marked out of 1.00

Flag question

Question text
What is the length of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };

Select one:
a. none of the choices
b. 7
c. 6
d. 4
e. 5

Question 18
Answer saved
Marked out of 1.00

Flag question
Question text
Which statement will check if x is less than y?

Select one:
a. none of the above
b. if (x<>y)
c. if (x>y)
d. if (x>y)?:
e. if (x<y);

Question 19
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following correctly accesses the sixth element stored in an array of 10 elements?

Select one:
a. intArray[6];
b. None of the choices
c. intArray[7];
d. stringArray[5];
e. intArray[10];

Question 20
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is true about Runtime errors:

Select one:
a. No correct answer
b. Runtime errors occur when there is a design flaw in your program
c. Runtime errors occur after compilation.
d. All of the choices are correct
e. Runtime errors occur during run-time.

Question 21
Answer saved
Marked out of 1.00

Flag question

Question text
What is the index number of the last element of an array with 30 elements?

Select one:
a. None of the choices
b. 31
c. 29
d. 30
e. 0

Question 22
Answer saved
Marked out of 1.00

Flag question

Question text
Why do we need to set the path for JavaC in command line?

Select one:
a. It is part of the compilation process
b. To resolve syntax error
c. To resolve runtime error
d. To make JavaC available or accessible in command line.
e. None of the choices

Question 23
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following declares an array of int named intArray?

Select one:
a. All of the choices
b. int[] intArray;
c. int intArray[][];
d. int intArray[];
e. int[][] intArray;

Question 24
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;
What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = a | b + c;

11
Answer:

Question 25
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following a valid Java identifier?

Select one:
a. id_1
b. $id
c. id
d. _id
e. all of the choices

Question 26
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a valid variable declaration in Java?

Select one:
a. None of the choices
b. float x = 2.0D;
c. int x;
d. int x = 1;
e. short x;
Question 27
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid statement to accept int input? Let us assume that we have declared
scan as Scanner.

Select one:
a. int num = scan.nextLong();
b. short num = scan.nextShort();
c. int num = scan.getInt();
d. None of the choices
e. short num = scan.nextInt();

Question 28
Answer saved
Marked out of 1.00

Flag question

Question text
What is the output of the code snippet below:
int[] intArray = new int[10];
for(int x = 0; x<intArray.length; x++){System.out.print(intArray[x]);}

Select one:
a. none of the choices
b. The given code is not valid
c. 1235678910
d. 012356789
e. 0000000000

Question 29
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult += c;

18
Answer:

Question 30
Answer saved
Marked out of 1.00

Flag question

Question text
When was the officially released of Java?

Select one:
a. 1991
b. 1996
c. 1995
d. 1992
Question 31
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid multidimensional array?

Select one:
a. All of the choices
b. int[][] intArray;
c. int[][][][] intArray;
d. int intArray[][][];
e. int[][][] intArray;

Question 32
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following shows Overloading method?

Select one:
a. None of the above
b. void test(int x){} void test(double x){}
c. All of the above
d. void test(int x){} void test(int y){}
e. void test(){} void test(){}

Question 33
Answer saved
Marked out of 1.00
Flag question

Question text
Which of the following is true about syntax errors:

Select one:
a. You will have syntax errors if you misspell the Java command.
b. Incorrect capitalization leads to syntax error.
c. Syntax errors are usually typing errors.
d. All of the statements are false
e. All of the statements are true

Question 34
Answer saved
Marked out of 1.00

Flag question

Question text
Which is not a repetition control structure?

Select one:
a. do while
b. while
c. None of the choices
d. switch
e. for

Question 35
Answer saved
Marked out of 1.00

Flag question
Question text
What is the output of the code snippet below:
void main(){test(“11”);test(“1”);}
void test(String x){System.out.print(x + x);}

Select one:
a. 222
b. 111111
c. None of the choices
d. 6

Question 36
Answer saved
Marked out of 1.00

Flag question

Question text
What is the return type of this method: int test(){return 1;} ?

Select one:
a. 1
b. int
c. None of the above
d. test()
e. void

Question 37
Answer saved
Marked out of 1.00

Flag question

Question text
Can we directly compile codes from notepad?

Select one:
a. No, We can only write codes in Notepad
b. It depends, if there is a compiler embedded in Notepad.
c. Yes, Because we can call Java compiler from notepad
d. No correct answer

Question 38
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = ++b * a + c;

15
Answer:

Question 39
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following correctly accesses the sixth element stored in an array of 10 elements?
Select one:
a. None of the choices
b. intArray[10];
c. stringArray[5];
d. intArray[7];
e. intArray[6];

Question 40
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a java keyword?

Select one:
a. None of the choices
b. if
c. goto
d. name
e. else

Question 41
Answer saved
Marked out of 1.00

Flag question

Question text
What is the name of this method: int test(){return 1;} ?

Select one:
a. None of the choices
b. int
c. 6
d. 7
e. test

Question 42
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following does not return numeric value?

Select one:
a. nextInt()
b. nextShort()
c. nextLong()
d. nextDouble()
e. None of the choices

Question 43
Answer saved
Marked out of 1.00

Flag question

Question text
What is the maximum index of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };

Select one:
a. 4
b. 6
c. 5
d. 7
e. None of the choices

Question 44
Answer saved
Marked out of 1.00

Flag question

Question text
What is the return value of this method: public void sum(){int x=1;} ?

Select one:
a. none of the choices
b. x
c. 1
d. void
e. sum

Question 45
Answer saved
Marked out of 1.00

Flag question

Question text
What is the input for Java Compiler?

Select one:
a. Byte Code
b. Source Code
c. Code
d. Native Code

Question 46
Answer saved
Marked out of 1.00

Flag question
Question text
What is the return value of this method: int test(){return 1;} ?

Select one:
a. return 1
b. int
c. 1
d. test
e. All of the choices

Question 47
Answer saved
Marked out of 1.00

Flag question

Question text
Which statement will check if x is equal to y?

Select one:
a. if (x!<y)
b. if (x<>y)
c. none of the choices
d. if (x>y)
e. if (y>y)

Question 48
Answer saved
Marked out of 1.00

Flag question

Question text
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”);
}

Select one:
a. display 1
b. None of the above}
c. display 1111
d. display nothing
e. display 1234

Question 49
Answer saved
Marked out of 1.00

Flag question

Question text
What is the output of the code snippet below:
void main(){
test(1.0);
test(1);}
void test(double x){
System.out.print(x); }
void test(int x){
System.out.print(x);}

Select one:
a. 1.01
b. None of the choices
c. 1.0
d. 11
e. 1.01.0

Question 50
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not the feature of java?

Select one:
a. Static
b. Robust
c. Code Security
d. None of the choices
e. Platform independent

Question 1
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following will do implicit cast?

Select one:
a. None of the choices
b. short x=1; int y = x;
c. String x = “0”; int y = x;
d. Object obj = new Object();
e. All of the choices

Question 2
Answer saved
Marked out of 1.00

Flag question

Question text
What is the result if we execute this: “a” instanceof String; ?

Select one:
a. true
b. “a”
c. None of the choices
d. The code is not valid
e. false

Question 3
Answer saved
Marked out of 1.00

Flag question

Question text
It is a template for creating an object?

Select one:
a. Object Oriented
b. Class
c. None of the choices
d. Encapsulation
e. Method

Question 4
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following creates an instance of a class?

Select one:
a. String str = new String();
b. Object obj = new Object();
c. Test t = new Test();
d. String str = new String();
e. All of the choices

Question 5
Answer saved
Marked out of 1.00

Flag question

Question text
What do you call a blueprint of an object?

Select one:
a. Class
b. Object
c. Constructor
d. None of the choices
e. Method

Question 6
Answer saved
Marked out of 1.00
Flag question

Question text
It is the method of hiding certain elements of the implementation of a certain class?

Select one:
a. None of the choices
b. Class
c. Encapsulation
d. Object Oriented
e. Object

Question 7
Answer saved
Marked out of 1.00

Flag question

Question text
What is the result if we execute this: “a”.equals(“a”);?

Select one:
a. “a”
b. The code is not valid
c. false
d. None of the choices
e. true

Question 8
Answer saved
Marked out of 1.00

Flag question
Question text
Which of the following show casting object?

Select one:
a. Employee emp = new Employee(); VicePresident veep = new VicePresident(); veep =
(VicePresident)emp;
b. All of the choices
c. (className) object;
d. SuperClass sc = new SuperClass(); SubClass sbc = new SubClass(); sbc = (SubClass) sc;

Question 9
Answer saved
Marked out of 1.00

Flag question

Question text
What will be the value of x if we execute this: String s = "25"; int x = Integer.parseInt(s); ?

Select one:
a. 0
b. The code is not valid.
c. String 25
d. int 25
e. None of the choices

Question 10
Answer saved
Marked out of 1.00

Flag question

Question text
What do you call a variable that belong to the whole class?

Select one:
a. Class Method
b. Object Variable
c. Class Variable
d. Static Variable
e. None of the choices

Question 1
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is the correct way to use an interface?

Select one:
a. None of the choices
b. public class Person implements [InterfaceName] {}
c. public class Person use [InterfaceName] {}
d. public class Person extends [InterfaceName] {}
e. public class Person apply [InterfaceName] {}

Question 2
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is the correct way to define an interface?

Select one:
a. public class interface [InterfaceName] {}
b. interface: [InterfaceName]
c. public interface [InterfaceName] {}
d. public [InterfaceName] {}
Question 3
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following method is allowed to be overriden?

Select one:
a. public no_override void setName(){}
b. public final void setName(){}
c. None of the choices
d. public static void setName(){}
e. public void setName(){}

Question 4
Answer saved
Marked out of 1.00

Flag question

Question text
What do you call a class that inherits a class?

Select one:
a. None of the choices
b. Parent class
c. Superclass
d. Class
e. Subclass

Question 5
Answer saved
Marked out of 1.00
Flag question

Question text
It is the ability of an object to have many forms?

Select one:
a. Inheritance
b. None of the choices
c. Interface
d. Abstraction
e. Polymorphism

Question 6
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following class declaration is not allowed to be inherited?

Select one:
a. public class Person {}
b. public abstract class Person {}
c. class Person{}
d. None of the choices
e. public final class Person {}

Question 7
Answer saved
Marked out of 1.00

Flag question
Question text
Which of the following class declaration is not allowed to be instantiated?

Select one:
a. public class Person {}
b. None of the choices
c. class Person{}
d. public abstract class Person {}
e. public final class Person {}

Question 8
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is the correct way to call the constructor of the parent class?

Select one:
a. super()
b. this()
c. super.call()
d. this.call()

Question 9
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is true about Interface?

Select one:
a. All of the statements are correct
b. It defines a standard and public way of specifying the behavior of classes
c. It defines the signatures of a set of methods without the body
d. It is use to model multiple inheritance which allows a class to have more than one superclass.
e. It is a special kind of block containing method signatures only

Question 10
Answer saved
Marked out of 1.00

Flag question

Question text
What keyword is used to perform class inheritance?

Select one:
a. extends
b. inherits
c. implements
d. derives
e. None of the choices

Question 1
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid statement to accept int input? Let us assume that we have declared
scan as Scanner.

Select one:
a. short num = scan.nextShort();
b. short num = scan.nextInt();
c. int num = scan.getInt();
d. int num = scan.nextLong();
e. None of the choices
Question 2
Answer saved
Marked out of 1.00

Flag question

Question text
What will happen if you use JOptionPane. showInputDialog statement in your program?

Select one:
a. None of the choices
b. The program will display an input dialog box that allows the user to input text and returns String
value.
c. The program will display an input dialog box that allows the user to input text and returns the
correct type value.
d. The program will display message dialog box returns String value.
e. The program will display message dialog box.

Question 3
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following method reads input from the user and return String value?

Select one:
a. nextValue()
b. nextText()
c. All of the above
d. nextLine()
e. nextString()

Question 4
Answer saved
Marked out of 1.00
Flag question

Question text
Which of the following is a valid statement to accept String input?

Select one:
a. None of the choices
b. string str = scan.nextShort();
c. String str = scan.nextString();
d. String num = scan.nextText();
e. String str = JOptionPane.showInputDialog("");

Question 5
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following does not return numeric value?

Select one:
a. nextInt()
b. nextLong()
c. None of the choices
d. nextDouble()
e. nextShort()

Question 6
Answer saved
Marked out of 1.00

Flag question
Question text
What type of value does the nextLine() returns?

Select one:
a. String
b. double
c. long
d. None of the choices
e. Line

Question 7
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid nextInt() return value?

Select one:
a. floating-point literal
b. 3.1416
c. long value
d. None of the choices
e. 1010

Question 8
Answer saved
Marked out of 1.00

Flag question

Question text
What will happen if you use JOptionPane.showMessageDialog statement in your program?

Select one:
a. The program will display message dialog box returns String value.
b. The program will display an input dialog box that allows the user to input text and returns the
correct type value.
c. None of the choices
d. The program will display an input dialog box that allows the user to input text and returns String
value.
e. The program will display message dialog box.

Question 9
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid nexDouble() return value?

Select one:
a. All of the choices
b. 3.1416
c. double value
d. 12.0
e. floating-point literal

Question 10
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid nextByte() return value?

Select one:
a. 3
b. short value
c. 128
d. int value
e. None of the above

Question 1
Answer saved
Marked out of 1.00

Flag question

Question text
Which statement will check if x is equal to y?

Select one:
a. if (x>y)
b. if (x<>y)
c. none of the choices
d. if (x!<y)
e. if (y>y)

Question 2
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is true about Runtime errors:

Select one:
a. No correct answer
b. Runtime errors occur during run-time.
c. All of the choices are correct
d. Runtime errors occur after compilation.
e. Runtime errors occur when there is a design flaw in your program
Question 3
Answer saved
Marked out of 1.00

Flag question

Question text
What will be the value of x after executing this code
for(int x=0; x<=10; x++) {} is run?

Select one:
a. 11
b. 1
c. 0
d. none of the above
e. 10

Question 4
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
booleanResult = x && y || x;

Select one:
True
False

Question 5
Answer saved
Marked out of 1.00

Flag question

Question text
Which statement will check if x is less than y?

Select one:
a. if (x>y)
b. if (x<y);
c. if (x>y)?:
d. none of the above
e. if (x<>y)

Question 6
Answer saved
Marked out of 1.00

Flag question

Question text
What did java generates after compiling the java source code?

Select one:
a. Executable file
b. Image file
c. Byte Code
d. Class Code

Question 7
Answer saved
Marked out of 1.00

Flag question

Question text
What is the input for Java Compiler?

Select one:
a. Byte Code
b. Code
c. Source Code
d. Native Code

Question 8
Answer saved
Marked out of 1.00

Flag question

Question text
What will happen if you use JOptionPane.showMessageDialog statement in your program?

Select one:
a. None of the choices
b. The program will display message dialog box returns String value.
c. The program will display an input dialog box that allows the user to input text and returns String
value.
d. The program will display message dialog box.
e. The program will display an input dialog box that allows the user to input text and returns the
correct type value.

Question 9
Answer saved
Marked out of 1.00
Flag question

Question text
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);

Select one:
a. 128
b. None of the above
c. 1
d. 512
e. 236

Question 10
Answer saved
Marked out of 1.00

Flag question

Question text
What will be the output if you execute this code?
do{System.out.println("Hello World!");}while(false);

Select one:
a. print "Hello World"
b. The code will not run because of syntax error
c. None of the choices
d. print "Hello World" infinitely
e. Do nothing

Question 11
Answer saved
Marked out of 1.00
Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = a | b + c;

11
Answer:

Question 12
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following does not return numeric value?

Select one:
a. None of the choices
b. nextLong()
c. nextDouble()
d. nextInt()
e. nextShort()
Question 13
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = b % a;

1
Answer:

Question 14
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following we are not allowed to write java source code?

Select one:
a. eclipse
b. BlueJ
c. Notepad
d. NetBeans
e. None of the choices

Question 15
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = a >> 2;

0
Answer:

Question 16
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid statement to accept int input? Let us assume that we have declared
scan as Scanner.

Select one:
a. int num = scan.getInt();
b. int num = scan.nextLong();
c. short num = scan.nextShort();
d. None of the choices
e. short num = scan.nextInt();

Question 17
Answer saved
Marked out of 1.00

Flag question

Question text
What is the correct statement to set JavaC path in command line?

Select one:
a. C:\Program Files\Java\jdk1.6.0_23\bin
b. All of the given choices are correct
c. path C:\Program Files\Java\jdk1.6.0_23\bin
d. No correct answer
e. set path
f. < JavaC directory >

Question 18
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid nextByte() return value?

Select one:
a. int value
b. 128
c. None of the above
d. 3
e. short value

Question 19
Answer saved
Marked out of 1.00

Flag question

Question text
What is the correct statement to run Java program in command line?

Select one:
a. java HelloWorld.java
b. java HelloWorld
c. javac HelloWorld.java
d. javac HelloWorld

Question 20
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;
What will be the value of intResult or booleanResult if we execute the following expressions?
intResult += c;

18
Answer:

Question 21
Answer saved
Marked out of 1.00

Flag question

Question text
The feature of Java which makes it possible to execute several tasks simultaneously.

Select one:
a. Platform independent
b. Code Security
c. Robust
d. Multithreaded

Question 22
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a valid variable declaration in Java?

Select one:
a. short x;
b. int x;
c. None of the choices
d. int x = 1;
e. float x = 2.0D;
Question 23
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
booleanResult = !((a + c) > b) && x;

Select one:
True
False

Question 24
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = 1;

1
Answer:

Question 25
Answer saved
Marked out of 1.00

Flag question

Question text
What will be the output if you execute this code?
do{System.out.println("Hello World!");}while(true);

Select one:
a. print "Hello World" infinitely
b. Do nothing
c. The code will not run because of syntax error
d. print "Hello World"
e. None of the above.

Question 26
Answer saved
Marked out of 1.00

Flag question
Question text
What will happen if we compile the statement below? ~System.out.println(“Hello World!”)

Select one:
a. None of the choices
b. There will be a logical error after compilation.
c. There will be a runtime error after compilation.
d. There will be a syntax error after compilation.
e. There will be no error after compilation.

Question 27
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not an escape sequence?

Select one:
a. \b
b. \f
c. \t
d. none of the choices

Question 28
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid statement to accept String input?

Select one:
a. None of the choices
b. String num = scan.nextText();
c. String str = JOptionPane.showInputDialog("");
d. string str = scan.nextShort();
e. String str = scan.nextString();

Question 29
Answer saved
Marked out of 1.00

Flag question

Question text
Which is not a decision control structure?

Select one:
a. if
b. None of the choices
c. if else
d. switch
e. if else-if else

Question 30
Answer saved
Marked out of 1.00

Flag question

Question text
JVM is responsible for

Select one:
a. Reading bytecode
b. Generating bytecode
c. Compiling source code
d. Interpreting bytecode

Question 31
Answer saved
Marked out of 1.00

Flag question

Question text
When was the officially released of Java?

Select one:
a. 1992
b. 1991
c. 1996
d. 1995

Question 32
Answer saved
Marked out of 1.00

Flag question

Question text
What will happen if you use JOptionPane. showInputDialog statement in your program?

Select one:
a. The program will display message dialog box returns String value.
b. None of the choices
c. The program will display an input dialog box that allows the user to input text and returns String
value.
d. The program will display message dialog box.
e. The program will display an input dialog box that allows the user to input text and returns the
correct type value.

Question 33
Answer saved
Marked out of 1.00
Flag question

Question text
The Java feature, "write once, run anywhere", is termed as

Select one:
a. Platform independent
b. Object Oriented
c. High Performance
d. Robust

Question 34
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid nexDouble() return value?

Select one:
a. double value
b. All of the choices
c. 3.1416
d. 12.0
e. floating-point literal

Question 35
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = ++b * a + c;

15
Answer:

Question 36
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not usable for writing java source code?

Select one:
a. NetBeans
b. eclipse
c. None of the choices
d. Notepad
e. BlueJ

Question 37
Answer saved
Marked out of 1.00
Flag question

Question text
What is floating-point literal?

Select one:
a. Can be express in scientific notation.
b. An integer literal with decimal point.
c. By default it is double type.
d. It could be double or float value.
e. All of the statements are correct

Question 38
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a Java comment?

Select one:
a. Documentation Comments
b. None of the choices
c. Single Line Comments
d. Declaration Comments
e. Multi-Line Comments

Question 39
Answer saved
Marked out of 1.00

Flag question
Question text
Which of the following a valid Java identifier?

Select one:
a. $id
b. id
c. all of the choices
d. id_1
e. _id

Question 40
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not a primitive data type?

Select one:
a. none of the choices
b. long
c. short
d. byte
e. String

Question 41
Answer saved
Marked out of 1.00

Flag question

Question text
Why do we need to set the path for JavaC in command line?

Select one:
a. None of the choices
b. To resolve syntax error
c. To resolve runtime error
d. To make JavaC available or accessible in command line.
e. It is part of the compilation process

Question 42
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not the feature of java?

Select one:
a. Platform independent
b. Robust
c. Static
d. None of the choices
e. Code Security

Question 43
Answer saved
Marked out of 1.00

Flag question

Question text
Can we directly compile codes from notepad?

Select one:
a. It depends, if there is a compiler embedded in Notepad.
b. No correct answer
c. No, We can only write codes in Notepad
d. Yes, Because we can call Java compiler from notepad
Question 44
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following method reads input from the user and return String value?

Select one:
a. All of the above
b. nextLine()
c. nextString()
d. nextText()
e. nextValue()

Question 45
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is not Java Literal?

Select one:
a. Integer value
b. Character value
c. Float value
d. Boolean value
e. None of the choices

Question 46
Answer saved
Marked out of 1.00
Flag question

Question text
Which is not a repetition control structure?

Select one:
a. do while
b. while
c. switch
d. for
e. None of the choices

Question 47
Answer saved
Marked out of 1.00

Flag question

Question text
What is the extension name of a Java Source code?

Select one:
a. class
b. java
c. javac
d. j

Question 48
Answer saved
Marked out of 1.00

Flag question

Question text
What was the initial name for the Java programming language?

Select one:
a. C
b. Java
c. Oak
d. NetBeans

Question 49
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is a valid identifier?

Select one:
a. None of the choices
b. public
c. true
d. name
e. static

Question 50
Answer saved
Marked out of 1.00

Flag question

Question text
Let us assume that we have the following variables in our program:

int a = 2;
int b = 5;
int c = 3;
int intResult = 0;
boolean x = true;
boolean y = false;
boolean booleanResult = false;

What will be the value of intResult or booleanResult if we execute the following expressions?
intResult = a & b;

2
Answer:

You might also like