[go: up one dir, main page]

0% found this document useful (0 votes)
106 views136 pages

PMF Comprog 2 Finals

The document contains a quiz about computer programming and Java concepts. It consists of 10 multiple choice questions about topics like Java features, keywords, comments, variable declarations, data types, and setting the Java compiler path. The questions test foundational Java knowledge for beginner programmers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views136 pages

PMF Comprog 2 Finals

The document contains a quiz about computer programming and Java concepts. It consists of 10 multiple choice questions about topics like Java features, keywords, comments, variable declarations, data types, and setting the Java compiler path. The questions test foundational Java knowledge for beginner programmers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 136

Computer Programming 2

By: Jas & Francheska

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

Select one:
a. There will be a runtime error after compilation.
b. There will be a logical error after compilation.
c. There will be no error after compilation.
d. There will be a syntax error after compilation.
Which of the following is not the feature of java?

Select one:
a. Robust
b. Static
c. None of these
d. Code Security
e. Platform independent
Which of the following is not the feature of java?

Select one:
a. None of the choices
b. Code Security
c. Static
d. Robust
e. Platform independent
Which of the following we are not allowed to write java source code?

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

What was the initial name for the Java programming language?
Select one:
a. Java
b. Oak
c. C
d. NetBeans
Which of the following is not usable for writing java source code?
Select one:
a. NetBeans
b. BlueJ
c. eclipse
d. None of the choices
e. Notepad
What is the correct statement to set JavaC path in command line?
Select one:
a. path C:\Program Files\Java\jdk1.6.0_23\bin
b. < JavaC directory >
c. C:\Program Files\Java\jdk1.6.0_23\bin
d. All of the given choices are correct
e. set path
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. All of the choices are correct
d. Runtime errors occur when there is a design flaw in your program
e. No correct answer
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

When was the officially released of Java?


Select one:
a. 1996
b. 1995
c. 1992
d. 1991
Can we directly compile codes from NetBeans?
ANSWER: Yes, because we can call Java compiler from NetBeans

Which of the following is not usable for writing java source code?
Select one:
a. Notepad
b. None of the choices
c. eclipse
d. NetBeans
e. BlueJ

Question 2
Correct
Mark 1.00 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. None of these
c. It depends, if there is a compiler embedded in NetBeans.
d. No, we can only write codes in NetBeans

Question 3
Correct
Mark 1.00 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. All of the choices are correct
c. No correct answer
d. Runtime errors occur when there is a design flaw in your program
e. Runtime errors occur during run-time.

Question 4
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is not the feature of java?


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

Question 5
Correct
Mark 1.00 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 these
c. Robust
d. Code Security
e. Platform independent

Question 6
Correct
Mark 1.00 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. C:\Program Files\Java\jdk1.6.0_23\bin
c. set path
d. path C:\Program Files\Java\jdk1.6.0_23\bin
e. All of the given choices are correct

Question 7
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following we are not allowed to write java source code?
Select one:
a. None of the choices
b. Notepad
c. eclipse
d. NetBeans
e. BlueJ

Question 8
Correct
Mark 1.00 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. Robust
c. Code Security
d. Multithreaded

Question 9
Correct
Mark 1.00 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
c. javac HelloWorld.java
d. java HelloWorld.java

Question 10
Correct
Mark 1.00 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 logical error after compilation.
b. There will be a runtime error after compilation.
c. There will be no error after compilation.
d. None of the choices
e. There will be a syntax error after compilation.

Which of the following is not a java keyword?


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

Question 2
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following a valid Java identifier?

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

Question 3
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is not a Java comment?


Select one:
a. Single Line Comments
b. None of the choices
c. Declaration Comments
d. Multi-Line Comments
e. Documentation Comments
Question 4
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is not a java keyword?

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

Question 5
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following a valid Java identifier?


Select one:
a. $id
b. All of these
c. _id
d. id
e. id_1

Question 6
Incorrect
Mark 0.00 out of 1.00
Flag question

Question text

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


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

Question 7
Correct
Mark 1.00 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 8
Correct
Mark 1.00 out of 1.00
Flag question

Question text

What is floating-point literal?


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

Question 9
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is not a primitive data type?


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

Question 10
Correct
Mark 1.00 out of 1.00
Flag question

Question text

Which of the following is not a Java comment?


Select one:
a. None of these
b. Documentation Comments
c. Multi-Line Comments
d. Single Line Comments
e. Declaration Comments
Which of the following is not a java keyword?
Select one:
a. goto
b. None of these
c. else
d. name
e. if

Question 2
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following a valid Java identifier?


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

Question 3
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is not a Java comment?


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

Question 4
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is not a java keyword?


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

Question 5
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following a valid Java identifier?

Select one:
a. $id
b. All of these
c. _id
d. id
e. id_1

Question 6
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text

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


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

Question 7
Correct
Mark 1.00 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 8
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is floating-point literal?

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

Question 9
Correct
Mark 1.00 out of 1.00
Flag question

Question text

Which of the following is not a primitive data type?


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

Question 10
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is not a Java comment?


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

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


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

Question 2
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is floating-point literal?


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

Question 3
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is floating-point literal?


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

Question 4
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is not a java keyword?

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

Question 5
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is not a valid Float value?


Select one:
a. 1.23
b. 3.4028235E+38F
c. None of these
d. 1.2345E+3
e. 12345678910F

Question 6
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is not Java Literal?


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

Question 7
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is the input for Java Compiler?

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

Question 8
Correct
Mark 1.00 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. None of the choices
d. eclipse
e. Notepad

Question 9
Correct
Mark 1.00 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 these
c. String
d. short
e. byte

Question 10
Correct
Mark 1.00 out of 1.00
Flag question

Question text

Which of the following is not a Java comment?


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

Question 11
Correct
Mark 1.00 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 12
Correct
Mark 1.00 out of 1.00
Flag question

Question text

Which of the following is not a valid Float value?


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

Question 13
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is not a Java comment?


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

Question 14
Correct
Mark 1.00 out of 1.00
Flag question

Question text

Which of the following is not usable for writing java source code?
Select one:
a. Notepad
b. None of the choices
c. NetBeans
d. BlueJ
e. eclipse

Question 15
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text

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


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

Question 16
Correct
Mark 1.00 out of 1.00
Flag question

Question text

Can we directly compile codes from NetBeans?


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

Question 17
Correct
Mark 1.00 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. Incorrect capitalization leads to syntax error.
c. You will have syntax errors if you misspell the Java command.
d. All of the statements are false
e. All of the statements are true

Question 18
Correct
Mark 1.00 out of 1.00
Flag question

Question text

Which of the following is not an escape sequence?


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

Question 19
Correct
Mark 1.00 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 these
d. id
e. id_1

Question 20
Correct
Mark 1.00 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 make JavaC available or accessible in command line.
b. To resolve syntax error
c. To resolve runtime error
d. It is part of the compilation process

Question 21
Correct
Mark 1.00 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 these
c. Code Security
d. Platform independent
e. Static

Question 22
Correct
Mark 1.00 out of 1.00
Flag question

Question text

JVM is responsible for


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

Question 23
Correct
Mark 1.00 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 when there is a design flaw in your program
c. None of these
d. Runtime errors occur during run-time.

Question 24
Correct
Mark 1.00 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. C:\Program Files\Java\jdk1.6.0_23\bin
c. set path
d. No correct answer
e. path C:\Program Files\Java\jdk1.6.0_23\bin
f. All of the given choices are correct

Question 25
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is a valid identifier?


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

Question 26
Correct
Mark 1.00 out of 1.00

Flag question

Question text
Can we directly compile codes from notepad?
Select one:
a. None of these
b. Yes, Because we can call Java compiler from notepad
c. No, We can only write codes in Notepad
d. It depends, if there is a compiler embedded in Notepad.

Question 27
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is true about Runtime errors:


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

Question 28
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is not an escape sequence?


Select one:
a. \b
b. None of these
c. \f
d. \t

Question 29
Correct
Mark 1.00 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. short
d. byte
e. none of the choices

Question 30
Correct
Mark 1.00 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. No correct answer
d. It depends, if there is a compiler embedded in Notepad.
Which is not a decision control structure?
Select one:
a. if
b. if else
c. if else-if else
d. switch
e. None of the choices

Question 2
Correct
Mark 1.00 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. None of the choices
c. short num = scan.nextInt();
d. short num = scan.nextShort();
e. int num = scan.getInt();

Question 3
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which is not a repetition control structure?


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

Question 4
Correct
Mark 1.00 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 1111
b. display nothing
c. display 1234
d. None of the above}
e. display 1
Feedback

Your answer is correct.

Question 5
Correct
Mark 1.00 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 these
c. nextString()
d. nextValue()
e. nextLine()

Question 6
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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

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

Question 7
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following does not return numeric value?

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

Question 8
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which statement will check if x is less than y?

Select one:
a. None of these
b. if (x<>y)
c. if (x<y);
d. if (x>y)
e. if (x>y)?:
Feedback

Your answer is correct.

Question 9
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


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

Question 10
Correct
Mark 1.00 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.nextInt();
b. None of these
c. int num = scan.nextLong();
d. int num = scan.getInt();
e. short num = scan.nextShort(

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. None of the above
b. 128
c. 512
d. 1
e. 236
Feedback

Your answer is correct.

Question 2
Correct
Mark 1.00 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. All of these
c. 3.1416
d. 12.0
e. double value

Question 3
Correct
Mark 1.00 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 these
b. The program will display message dialog box.
c. The program will display message dialog box returns String value.
d. The program will display an input dialog box that allows the user to input text and
returns the correct type value.
e. The program will display an input dialog box that allows the user to input text and returns
String value.

Question 4
Correct
Mark 1.00 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. if (x>y)?:
e. none of the above
Feedback
Your answer is correct.

Question 5
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text

Which is not a decision control structure?


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

Question 6
Correct
Mark 1.00 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. None of the above.
c. print "Hello World" infinitely
d. print "Hello World"
e. The code will not run because of syntax error
Feedback

Your answer is correct.

Question 7
Correct
Mark 1.00 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. 1
c. 512
d. None of these
e. 236
Feedback

Your answer is correct.

Question 8
Correct
Mark 1.00 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 these
b. String num = scan.nextText();
c. String str = scan.nextString();
d. string str = scan.nextShort();
e. String str = JOptionPane.showInputDialog("");

Question 9
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What type of value does the nextLine() returns?


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

Question 10
Correct
Mark 1.00 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. none of the choices
c. if (x!<y)
d. if (x>y)
e. if (y>y)
What is the index number of the last element of an array with 30 elements?

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

Question 2
Correct
Mark 1.00 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. stringArray[5];
d. intArray[6];
e. None of these

Question 3
Correct
Mark 1.00 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. 6
b. 5
c. None of the choices
d. 7
e. 4
Feedback

Your answer is correct.

Question 4
Correct
Mark 1.00 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. 4
b. 5
c. none of the choices
d. 6
e. 7
Feedback

Your answer is correct.


Question 5
Correct
Mark 1.00 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[6];
c. intArray[7];
d. intArray[10];
e. stringArray[5];

Question 6
Incorrect
Mark 0.00 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. 4
e. 5
Question 7
Correct
Mark 1.00 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[7];
b. intArray[10];
c. intArray[6];
d. stringArray[5];
e. None of these

Question 8
Correct
Mark 1.00 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[7];
b. stringArray[5];
c. None of the choices
d. intArray[6];
e. intArray[10];

Question 9
Correct
Mark 1.00 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 10
Correct
Mark 1.00 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. 4
d. 7
e. None of the choices
Feedback

Your answer is correct.

Which of the following shows Overloading method?


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

Your answer is incorrect.

Question 8
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which statement will check if x is equal to y?

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

Your answer is correct.

Question 9
Correct
Mark 1.00 out of 1.00
Flag question

Question text

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


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

Question 10
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


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

Your answer is correct.

Question 11
Correct
Mark 1.00 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 String value.
c. None of these
d. The program will display an input dialog box that allows the user to input text and
returns the correct type value.
e. The program will display message dialog box returns String value.

Question 12
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


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

Question 13
Correct
Mark 1.00 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. Do nothing
b. print "Hello World"
c. None of these
d. print "Hello World" infinitely
e. The code will not run because of syntax error
Feedback

Your answer is correct.

Question 14
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


Select one:
a. 3.1416
b. All of the choices
c. double value
d. floating-point literal
e. 12.0
Question 15
Correct
Mark 1.00 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. long value
c. 1010
d. 3.1416
e. None of the choices

Question 16
Correct
Mark 2.00 out of 2.00

Flag question

Question text

Which of the following shows Overloading method?


Select one:
a. void test(int x){} void test(int y){}
b. All of these
c. void test(int x){} void test(double x){}
d. void test(){} void test(){}
Feedback

Your answer is correct.

Question 17
Correct
Mark 2.00 out of 2.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 these
d. if (y>y)
e. if (x<>y)
Feedback

Your answer is correct.

Question 18
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What type of value does the nextLine() returns?


Select one:
a. None of these
b. Line
c. String
d. double
e. long
Question 19
Correct
Mark 1.00 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. None of these
c. intArray[6];
d. intArray[10];
e. intArray[7];

Question 20
Correct
Mark 2.00 out of 2.00

Flag question

Question text

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

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

Question 21
Correct
Mark 2.00 out of 2.00

Flag question

Question text

Which of the following method reads input from the user and return String value?
Select one:
a. nextString()
b. All of these
c. nextValue()
d. nextText()
e. nextLine()

Question 22
Correct
Mark 2.00 out of 2.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. None of the above.
c. The code will not run because of syntax error
d. print "Hello World" infinitely
e. print "Hello World"
Feedback
Your answer is correct.

Question 23
Correct
Mark 2.00 out of 2.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. 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 an input dialog box that allows the user to input text and
returns String value.
e. None of the choices

Question 24
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is a valid method name:


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

Your answer is correct.

Question 25
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


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

Question 26
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following does not return numeric value?


Select one:
a. nextInt()
b. nextLong()
c. nextDouble()
d. None of these
e. nextShort()
Question 27
Correct
Mark 1.00 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. 30
b. None of the choices
c. 31
d. 29
e. 0

Question 28
Correct
Mark 1.00 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. 236
e. None of these

Question 30
Correct
Mark 2.00 out of 2.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. The given code is not valid
c. none of the choices
d. 123567
e. 765321
Feedback

Your answer is correct.

Question 31
Correct
Mark 1.00 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. 1
c. None of the above
d. 512
e. 236
Feedback

Your answer is correct.

Question 32
Correct
Mark 2.00 out of 2.00

Flag question

Question text

What is the return value of this method: public void sum(){int x=1;} ?
Select one:
a. sum
b. void
c. 1
d. None of the choices
e. x
Feedback

Your answer is correct.

Question 33
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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

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

Your answer is correct.

Question 34
Correct
Mark 1.00 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. 7
c. int
d. test
e. 6
Feedback

Your answer is correct.

Question 35
Incorrect
Mark 0.00 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 message dialog box.
c. The program will display an input dialog box that allows the user to input text and 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
the correct type value.

Question 36
Correct
Mark 1.00 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. if (boolean_expression)
e. None of these

Question 37
Correct
Mark 1.00 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. The given code is not valid
b. None of the choices
c. 012356789
d. 1235678910
e. 0000000000
Feedback

Your answer is correct.

Question 38
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following shows a valid Overloading method?

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

Your answer is correct.

Question 39
Correct
Mark 1.00 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. 7
b. 4
c. 6
d. 5
e. None of the choices
Feedback

Your answer is correct.

Question 40
Correct
Mark 2.00 out of 2.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. None of the choices
d. short num = scan.nextInt();
e. short num = scan.nextShort();
Question 1
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


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

Question 2
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What do you call a blueprint of an object?

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

Question 3
Correct
Mark 1.00 out of 1.00

Flag question

Question text

It is a template for creating an object?


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

Question 4
Correct
Mark 1.00 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. Object Oriented
b. Class
c. None of these
d. Object
e. Encapsulation

Question 5
Correct
Mark 1.00 out of 1.00
Flag question

Question text

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


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

Question 6
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following show casting object?


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

Your answer is correct.

Question 7
Correct
Mark 1.00 out of 1.00
Flag question

Question text

Which of the following will do implicit cast?


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

Your answer is correct.

Question 8
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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

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

Question 9
Correct
Mark 1.00 out of 1.00
Flag question

Question text

Which of the following creates an instance of a class?


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

Your answer is correct.

Question 10
Correct
Mark 1.00 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. None of the choices
b. 0
c. int 25
d. The code is not valid.
e. String 25
Feedback

Your answer is correct.


Question 1
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following show casting object?

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

Your answer is correct.

Question 2
Correct
Mark 1.00 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. None of the choices
b. String 25
c. The code is not valid.
d. int 25
e. 0
Feedback

Your answer is correct.

Question 3
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What do you call a blueprint of an object?


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

Question 4
Correct
Mark 1.00 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. Object
b. Object Oriented
c. Class
d. None of the choices
e. Encapsulation
Question 5
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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

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

Question 6
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


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

Question 7
Correct
Mark 1.00 out of 1.00
Flag question

Question text

It is a template for creating an object?


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

Question 8
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


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

Question 9
Correct
Mark 1.00 out of 1.00
Flag question

Question text

Which of the following will do implicit cast?


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

Your answer is correct.

Question 10
Correct
Mark 1.00 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. None of these
b. int 25
c. The code is not valid.
d. 0
e. String 25
Feedback

Your answer is correct.


Question 1
Correct
Mark 1.00 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. display 1111
c. None of these
d. display 1234
e. display nothing
Feedback

Your answer is correct.

Question 2
Correct
Mark 1.00 out of 1.00
Flag question

Question text

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


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

Question 3
Correct
Mark 1.00 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 these

Question 4
Correct
Mark 1.00 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. nextString()
c. All of the above
d. nextText()
e. nextLine()

Question 5
Correct
Mark 1.00 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 these
c. nextLine()
d. nextValue()
e. nextString()

Question 6
Correct
Mark 1.00 out of 1.00
Flag question

Question text

Which of the following does not return numeric value?


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

Question 7
Correct
Mark 1.00 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. Do nothing
b. print "Hello World"
c. The code will not run because of syntax error
d. print "Hello World" infinitely
e. None of these
Feedback

Your answer is correct.


Question 8
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What type of value does the nextLine() returns?

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

Question 9
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which is not a repetition control structure?


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

Question 10
Correct
Mark 1.00 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. 0000000000
c. 1235678910
d. The given code is not valid
e. 012356789
Feedback

Your answer is correct.

Question 11
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


Select one:
a. 12.0
b. 3.1416
c. double value
d. floating-point literal
e. All of these
Question 12
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What type of value does the nextLine() returns?

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

Question 13
Correct
Mark 1.00 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)
Feedback
Your answer is correct.

Question 14
Correct
Mark 1.00 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 these
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.
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 returns String value.

Question 15
Correct
Mark 1.00 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. 31
b. None of the choices
c. 30
d. 0
e. 29
Question 16
Correct
Mark 1.00 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. None of the above.
c. The code will not run because of syntax error
d. print "Hello World"
e. Do nothing
Feedback

Your answer is correct.

Question 17
Correct
Mark 1.00 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. None of these
b. 128
c. 512
d. 1
e. 236
Feedback

Your answer is correct.

Question 18
Correct
Mark 1.00 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. 765321
b. The given code is not valid
c. 123567
d. None of these
e. 12356
Feedback

Your answer is correct.

Question 19
Correct
Mark 1.00 out of 1.00

Flag question

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

Select one:
a. None of these
b. if (x>y)?:
c. if (x>y)
d. if (x<y);
e. if (x<>y)
Feedback

Your answer is correct.

Question 20
Correct
Mark 1.00 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. if boolean_expression
e. none of the choices

Question 21
Correct
Mark 1.00 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. None of the choices
b. print "Hello World" infinitely
c. Do nothing
d. The code will not run because of syntax error
e. print "Hello World"
Feedback

Your answer is correct.

Question 22
Correct
Mark 1.00 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. The program will display an input dialog box that allows the user to input text and
returns String value.
c. None of the choices
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 23
Correct
Mark 1.00 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. if (x!<y)
d. if (y>y)
e. None of these
Feedback

Your answer is correct.

Question 24
Correct
Mark 1.00 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. 7
c. 6
d. 5
e. None of the choices
Feedback
Your answer is correct.

Question 25
Correct
Mark 1.00 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 1
c. display 1234
d. display 1111
e. None of the above}
Feedback

Your answer is correct.

Question 26
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which statement will check if x is equal to y?

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

Your answer is correct.

Question 27
Correct
Mark 1.00 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. 1235678910
b. none of the choices
c. The given code is not valid
d. 012356789
e. 0000000000
Feedback

Your answer is correct.

Question 28
Correct
Mark 1.00 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. 123567
b. 12356
c. 765321
d. The given code is not valid
e. none of the choices
Feedback

Your answer is correct.

Question 29
Correct
Mark 1.00 out of 1.00

Flag question

Question text
Which of the following is a valid nexDouble() return value?
Select one:
a. 12.0
b. All of the choices
c. floating-point literal
d. 3.1416
e. double value

Question 30
Correct
Mark 1.00 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 String value.
c. The program will display message dialog box.
d. None of the choices
e. The program will display an input dialog box that allows the user to input text and returns
the correct type value.

Question 31
Correct
Mark 1.00 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. None of the choices
b. 4
c. 7
d. 6
e. 5
Feedback

Your answer is correct.

Question 32
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


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

Question 33
Correct
Mark 1.00 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 = scan.nextShort();
d. String str = JOptionPane.showInputDialog("");
e. String str = scan.nextString();

Question 34
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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

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

Question 35
Correct
Mark 1.00 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. 512
c. 128
d. 236
e. None of the above
Feedback

Your answer is correct.

Question 36
Correct
Mark 1.00 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. none of the choices
c. 4
d. 5
e. 6
Feedback

Your answer is correct.

Question 37
Correct
Mark 1.00 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. 0
b. 1
c. 11
d. 10
e. None of these
Feedback

Your answer is correct.

Question 38
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following does not return numeric value?


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

Question 39
Correct
Mark 1.00 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. None of these
c. 30
d. 31
e. 0

Question 40
Correct
Mark 1.00 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.nextInt();
b. None of these
c. int num = scan.nextLong();
d. int num = scan.getInt();
e. short num = scan.nextShort();

Question 41
Correct
Mark 1.00 out of 1.00
Flag question

Question text

Which is not a decision control structure?


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

Question 42
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


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

Question 43
Correct
Mark 1.00 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. None of the choices
c. short num = scan.nextInt();
d. int num = scan.getInt();
e. int num = scan.nextLong();

Question 44
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


Select one:
a. boolean_expression
b. if boolean_expression
c. if boolean_expression
d. None of these
e. if (boolean_expression)

Question 45
Correct
Mark 1.00 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 these

Question 46
Correct
Mark 1.00 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. 6
b. 7
c. None of the choices
d. 5
e. 4
Feedback

Your answer is correct.

Question 47
Correct
Mark 1.00 out of 1.00
Flag question

Question text

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


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

Question 48
Correct
Mark 1.00 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"
b. None of these
c. Do nothing
d. print "Hello World" infinitely
e. The code will not run because of syntax error
Feedback

Your answer is correct.


Question 49
Correct
Mark 1.00 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. 10
b. 11
c. 1
d. 0
e. none of the above
Feedback

Your answer is correct.

Question 50
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which is not a decision control structure?

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

Question 1
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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

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

Question 2
Correct
Mark 1.00 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. Object Oriented
b. Object
c. None of the choices
d. Encapsulation
e. Class
Question 3
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following will do implicit cast?

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

Your answer is correct.

Question 4
Correct
Mark 1.00 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. false
d. None of the choices
e. The code is not valid
Question 5
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What do you call a blueprint of an object?

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

Question 6
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


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

Question 7
Correct
Mark 1.00 out of 1.00
Flag question

Question text

What do you call a blueprint of an object?


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

Question 8
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following show casting object?


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

Your answer is correct.

Question 9
Correct
Mark 1.00 out of 1.00
Flag question

Question text

Which of the following will do implicit cast?


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

Your answer is correct.

Question 10
Correct
Mark 1.00 out of 1.00

Flag question

Question text

It is a template for creating an object?

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

Question 1
Correct
Mark 1.00 out of 1.00
Flag question

Question text

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


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

Question 2
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


Select one:
a. public interface [InterfaceName] {}
b. public [InterfaceName] {}
c. public class interface [InterfaceName] {}
d. interface: [InterfaceName]
Feedback

Your answer is correct.

Question 3
Correct
Mark 1.00 out of 1.00
Flag question

Question text

Which of the following class declaration is not allowed to be instantiated?


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

Your answer is correct.

Question 4
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following class declaration is not allowed to be instantiated?

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

Your answer is correct.


Question 5
Correct
Mark 1.00 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 6
Correct
Mark 1.00 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 final class Person {}
c. None of these
d. public abstract class Person {}
e. class Person{}
Feedback

Your answer is correct.


Question 7
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What keyword is used to perform class inheritance?

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

Question 8
Correct
Mark 1.00 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. None of the choices
c. public abstract class Person {}
d. public final class Person {}
e. class Person{}
Feedback

Your answer is correct.


Question 9
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is true about Interface?

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

Question 10
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What do you call a class that inherits a class?

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

Question 1
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What do you call a class that inherits a class?


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

Question 2
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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

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

Your answer is correct.

Question 3
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following class declaration is not allowed to be instantiated?


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

Your answer is correct.

Question 4
Correct
Mark 1.00 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. super.call()
c. this()
d. this.call()

Question 5
Correct
Mark 1.00 out of 1.00
Flag question

Question text

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


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

Your answer is correct.

Question 6
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following method is allowed to be overriden?

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

Your answer is correct.


Question 7
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is true about Interface?

Select one:
a. It defines a standard and public way of specifying the behavior of classes
b. It defines the signatures of a set of methods without the body
c. All of these
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 8
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What keyword is used to perform class inheritance?

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

Question 9
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following method is allowed to be overriden?


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

Your answer is correct.

Question 10
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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

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

Question 1
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What keyword is used to perform class inheritance?


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

Question 2
Correct
Mark 1.00 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. class Person{}
c. public abstract class Person {}
d. public final class Person {}
Feedback

Your answer is correct.

Question 3
Correct
Mark 1.00 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. javac HelloWorld
c. javac HelloWorld.java
d. java HelloWorld
Feedback

Your answer is correct.

Question 4
Correct
Mark 1.00 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. Syntax errors are usually typing errors.
c. Incorrect capitalization leads to syntax error.
d. All of the above.
e. None of the choices

Question 5
Correct
Mark 1.00 out of 1.00
Flag question

Question text

Which of the following scenarios where an exception may occur?


Select one:
a. A user has entered an invalid data.
b. A network connection has been lost in the middle of communications or the JVM has run
out of memory.
c. All of the choices
d. A file that needs to be opened cannot be found.

Question 6
Correct
Mark 1.00 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
e. None of the choices

Question 7
Correct
Mark 1.00 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(int x){} void test(int y){}
c. None of the choices
d. void test(){} void test(){}
e. void test(char x, int y){} void test(int x, char y){}
Feedback

Your answer is correct.

Question 8
Correct
Mark 2.00 out of 2.00

Flag question

Question text

Which of the following is a valid identifier?

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

Question 9
Correct
Mark 1.00 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. 5
c. 6
d. 4
Feedback

Your answer is correct.

Question 10
Correct
Mark 2.00 out of 2.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. It could be double or float value.
d. All of the choices
e. By default it is double type.

Question 11
Correct
Mark 1.00 out of 1.00
Flag question

Question text

What was the initial name of the Java programming language?


Select one:
a. C
b. Oak
c. NetBeans
d. None of the choices
e. Javad

Question 12
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


Select one:
a. 1
b. int
c. return 1
d. test
Feedback

Your answer is correct.

Question 13
Correct
Mark 1.00 out of 1.00
Flag question

Question text

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


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

Your answer is correct.

Question 14
Correct
Mark 2.00 out of 2.00

Flag question

Question text

Which of the following shows Overloading method?

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

Your answer is correct.

Question 15
Correct
Mark 1.00 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. 11
b. 1.01.0
c. 1.01
d. 1.0
Feedback

Your answer is correct.

Question 16
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


Select one:
a. false
b. “a”
c. true
d. The code is not valid
Feedback

Your answer is correct.

Question 17
Correct
Mark 1.00 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. 236
b. None of the Choice
c. 512
d. 1
e. 128
Feedback

Your answer is correct.

Question 18
Correct
Mark 1.00 out of 1.00

Flag question

Question text
Which of the following is true about Runtime errors
Select one:
a. Runtime errors occur when there is a design flaw in your program
b. All of the choices
c. Runtime errors occur after compilation.
d. Runtime errors occur during run-time.
e. None of the choices

Question 19
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What will be the value of x after executing this code for(int x=0; x<=11; x++) {} is run?
Select one:
a. 12
b. 1
c. 10
d. 11
Feedback

Your answer is correct.

Question 20
Correct
Mark 1.00 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. 5
d. 4
Feedback

Your answer is correct.

Question 21
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What do you call a blueprint of an object?

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

Question 22
Correct
Mark 1.00 out of 1.00

Flag question

Question text

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


Select one:
a. int
b. test
c. 6
d. 7
Feedback

Your answer is correct.

Question 23
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is not a primitive data type?


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

Question 24
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is the function of JVM?


Select one:
a. Reading bytecode
b. Interpreting bytecode
c. Generating bytecode
Feedback

Your answer is correct.

Question 25
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is true about constructor?


Select one:
a. Constructors have the same name as the class
b. Constructors does not have any return value
c. It can only be called by using the new operator during class instantiation.
d. All of the choices

Question 26
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is a valid editor for java source code?

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

Question 27
Correct
Mark 2.00 out of 2.00

Flag question

Question text

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

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

Question 29
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is the extension name of a Java Source code?


Select one:
a. javac
b. None of the choices
c. j
d. class
e. java
Question 30
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is not a java keyword?

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

Question 31
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is the index number of the last element of an array with 20 elements?
Select one:
a. 20
b. 21
c. 19
d. 0
e. None of the choices

Question 32
Correct
Mark 1.00 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. The given code is not valid
c. 765321
d. 123567
Feedback

Your answer is correct.

Question 33
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is a valid multidimensional array?


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

Your answer is correct.

Question 35
Correct
Mark 1.00 out of 1.00

Flag question

Question text

It is used to access the instance variables shadowed by the parameters.


Select one:
a. this
b. mutator method
c. accessor method
d. method

Question 36
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following does not return numeric value?


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

Your answer is correct.

Question 37
Correct
Mark 1.00 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[2]?
Select one:
a. 2
b. 4
c. 1
d. 3
Feedback

Your answer is correct.

Question 38
Correct
Mark 1.00 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. Object
b. Class
c. Encapsulation
d. None of the choices
e. Object Oriented

Question 40
Correct
Mark 1.00 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. javac HelloWorld
c. java HelloWorld
d. java HelloWorld.java
Feedback

Your answer is correct.

Question 41
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is true about Runtime errors

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

Question 42
Correct
Mark 1.00 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. All of the choices
c. 3.1416
d. double value
e. 12.0

Question 44
Correct
Mark 1.00 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. print "Hello World"
c. Do nothing
d. The code will not run because of syntax error
Feedback

Your answer is correct.

Question 45
Correct
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is not a valid Float value?


Select one:
a. all of the choices
b. 3.4028235E+38F
c. 1.2345E+3
d. 12345678910F
e. 2.23
Which of the following is the correct syntax to define a method?
Select one:
a. package <packageName>;
b. <packageName> package;
c. <packageName>;
d. <modifier> package <packageName>;

What will be the output if you execute this code:


int a[] = new int[1];
System.out.println(a[1]);

Select one:
a. It will display “a[1]”.
b. It will display the value of a[1].
c. It will produce an exception.
d. It will display nothing.

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”);
}
Select one:
a. display 1
b. display 1234
c. display 1111
d. display 111

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. short num = scan.nextShort();
c. int num = scan.nextLong();
d. int num = scan.nextInt();

You might also like