0% found this document useful (0 votes)
108 views

Computer Programing 2 Answer

This document contains 13 multiple choice questions about Java programming concepts like compiling and running Java programs from the command line, Java keywords, variables, data types, errors, and more. Each question has 4 or 5 possible answer choices to select from.

Uploaded by

Jesse Jaucian
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views

Computer Programing 2 Answer

This document contains 13 multiple choice questions about Java programming concepts like compiling and running Java programs from the command line, Java keywords, variables, data types, errors, and more. Each question has 4 or 5 possible answer choices to select from.

Uploaded by

Jesse Jaucian
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 86

Question 

1
Not yet answered
Marked out of 1.00

Flag question

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

Select one:
a.
javac HelloWorld.java
b.
javac HelloWorld
c.
java HelloWorld.java
d.
java HelloWorld
Clear my choice

Question 2
Not yet answered
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
b.
javac HelloWorld.java
c.
java HelloWorld
d.
java HelloWorld.java
Clear my choice

Question 3
Not yet answered
Marked out of 1.00

Flag question

Question text
Can we directly compile codes from notepad?

Select one:
a.
None of these
b.
It depends, if there is a compiler embedded in Notepad.
c.
No, We can only write codes in Notepad
d.
Yes, Because we can call Java compiler from notepad
Clear my choice

Question 4
Not yet answered
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.
path C:\Program Files\Java\jdk1.6.0_23\bin
c.
set path
d.
C:\Program Files\Java\jdk1.6.0_23\bin
e.
All of the given choices are correct
Clear my choice

Question 5
Not yet answered
Marked out of 1.00

Flag question

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

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

Question 6
Not yet answered
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 no error after compilation.
b.
There will be a syntax error after compilation.
c.
There will be a runtime error after compilation.
d.
There will be a logical error after compilation.
Clear my choice

Question 7
Not yet answered
Marked out of 1.00

Flag question

Question text
When was the officially released of Java?

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

Question 8
Not yet answered
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 syntax error
b.
To resolve runtime error
c.
To make JavaC available or accessible in command line.
d.
It is part of the compilation process
Clear my choice

Question 9
Not yet answered
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, we can only write codes in NetBeans
c.
None of these
d.
Yes, because we can call Java compiler from NetBeans
Clear my choice

Question 10
Not yet answered
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.
Notepad
b.
NetBeans
c.
eclipse
d.
None of these
e.
BlueJ

Which of the following is not a Java comment?

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

Question 2
Not yet answered
Marked out of 1.00

Flag question

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

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

Question 3
Not yet answered
Marked out of 1.00

Flag question

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

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

Question 4
Not yet answered
Marked out of 1.00

Flag question

Question text
Which of the following is a valid identifier?

Select one:
a.
None of these
b.
true
c.
public
d.
name
e.
static
Clear my choice
Question 5
Not yet answered
Marked out of 1.00

Flag question

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

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

Question 6
Not yet answered
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.
All of these
d.
_id
e.
id
Clear my choice

Question 7
Not yet answered
Marked out of 1.00

Flag question

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

Select one:
a.
short
b.
long
c.
byte
d.
None of these
e.
String
Clear my choice

Question 8
Not yet answered
Marked out of 1.00
Flag question

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

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

Question 9
Not yet answered
Marked out of 1.00

Flag question

Question text
Which of the following is not Java Literal?

Select one:
a.
None of the above
b.
Character value
c.
Boolean value
d.
Integer value
e.
Float value
Clear my choice

Question 10
Not yet answered
Marked out of 1.00

Flag question

Question text
What is floating-point literal?

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

Question 1
Not yet answered
Marked 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.
Runtime errors occur after compilation.
c.
None of these
d.
Runtime errors occur during run-time.
Clear my choice

Question 2
Not yet answered
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.
Syntax errors are usually typing errors.
c.
All of these
d.
Incorrect capitalization leads to syntax error.
Clear my choice

Question 3
Not yet answered
Marked out of 1.00
Flag question

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

Select one:
a.
javac HelloWorld.java
b.
javac HelloWorld
c.
java HelloWorld
d.
java HelloWorld.java
Clear my choice

Question 4
Not yet answered
Marked out of 1.00

Flag question

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

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

Question 5
Not yet answered
Marked out of 1.00

Flag question

Question text
What is the input for Java Compiler?

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

Question 6
Not yet answered
Marked out of 1.00

Flag question

Question text
Which of the following is a valid identifier?

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

Question 7
Not yet answered
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.
java HelloWorld.java
c.
javac HelloWorld
d.
javac HelloWorld.java
Clear my choice

Question 8
Not yet answered
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.
Float value
d.
Character value
e.
None of the above
Clear my choice

Question 9
Not yet answered
Marked 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
Clear my choice

Question 10
Not yet answered
Marked out of 1.00

Flag question

Question text
JVM is responsible for

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

Question 11
Not yet answered
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.
NetBeans
b.
eclipse
c.
BlueJ
d.
Notepad
e.
None of these
Clear my choice

Question 12
Not yet answered
Marked 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.
It could be double or float value.
d.
By default it is double type.
e.
An integer literal with decimal point.
Clear my choice

Question 13
Not yet answered
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
Clear my choice

Question 14
Not yet answered
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.
Multithreaded
c.
Code Security
d.
Platform independent
Clear my choice

Question 15
Not yet answered
Marked out of 1.00

Flag question

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

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

Question 16
Not yet answered
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 no error after compilation.
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.
Clear my choice

Question 17
Not yet answered
Marked out of 1.00

Flag question

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

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

Question 18
Not yet answered
Marked out of 1.00

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

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

Question 19
Not yet answered
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.
It depends, if there is a compiler embedded in Notepad.
c.
None of these
d.
No, We can only write codes in Notepad
Clear my choice
Question 20
Not yet answered
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.
To make JavaC available or accessible in command line.
d.
To resolve syntax error
Clear my choice

Question 21
Not yet answered
Marked out of 1.00

Flag question

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

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

Question 22
Not yet answered
Marked out of 1.00

Flag question

Question text
When was the officially released of Java?

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

Question 23
Not yet answered
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.
C:\Program Files\Java\jdk1.6.0_23\bin
c.
set path
d.
path C:\Program Files\Java\jdk1.6.0_23\bin
e.
< JavaC directory >
Clear my choice

Question 24
Not yet answered
Marked out of 1.00

Flag question

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

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

Question 25
Not yet answered
Marked out of 1.00

Flag question

Question text
Can we directly compile codes from NetBeans?

Select one:
a.
None of these
b.
Yes, because we can call Java compiler from NetBeans
c.
No, we can only write codes in NetBeans
d.
It depends, if there is a compiler embedded in NetBeans.
Clear my choice

Question 26
Not yet answered
Marked out of 1.00

Flag question

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

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

Question 27
Not yet answered
Marked out of 1.00

Flag question

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

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

Question 28
Not yet answered
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 these
Clear my choice

Question 29
Not yet answered
Marked out of 1.00

Flag question

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

Select one:
a.
byte
b.
long
c.
None of these
d.
short
e.
String
Clear my choice

Question 30
Not yet answered
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.
NetBeans
b.
BlueJ
c.
Notepad
d.
eclipse
e.
None of these

Question 1
Not yet answered
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.
3.1416
c.
All of these
d.
double value
e.
12.0
Clear my choice

Question 2
Not yet answered
Marked out of 1.00

Flag question

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

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

Question 3
Not yet answered
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.
if (boolean_expression)
e.
None of these
Clear my choice

Question 4
Not yet answered
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 num = scan.nextText();
b.
None of these
c.
String str = JOptionPane.showInputDialog("");
d.
string str = scan.nextShort();
e.
String str = scan.nextString();
Clear my choice
Question 5
Not yet answered
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.
None of these

b.
10
 

c.
1
 

d.
0
 

e.
11
 

Clear my choice

Question 6
Not yet answered
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 1
 

d.
display 1234
 
e.
None of these

Clear my choice

Question 7
Not yet answered
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.
nextString()
b.
All of these
c.
nextText()
d.
nextLine()
e.
nextValue()
Clear my choice

Question 8
Not yet answered
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.
None of these

b.
Do nothing

c.
print "Hello World" infinitely

d.
print "Hello World"

e.
The code will not run because of syntax error

Clear my choice

Question 9
Not yet answered
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.
if (x<y);
 

e.
None of these

Clear my choice

Question 10
Not yet answered
Marked out of 1.00

Flag question

Question text
Which is not a decision control structure?

Select one:
a.
if else
b.
None of these
c.
if
d.
switch
e.
if else-if else
Question 1
Not yet answered
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.
None of these

b.
The given code is not valid

c.
12356

d.
123567

e.
765321

Clear my choice

Question 2
Not yet answered
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.
The given code is not valid

b.
0000000000

c.
012356789

d.
None of the choices

e.
1235678910

Clear my choice

Question 3
Not yet answered
Marked 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.
int[][] intArray;
c.
int[] intArray;
d.
int intArray[][];
e.
All of these
Clear my choice

Question 4
Not yet answered
Marked out of 1.00

Flag question

Question text
y[3]? 

Select one:
a.
6

b.
None of the choices

c.
4

d.
5

e.
7

Clear my choice

Question 5
Not yet answered
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.
4

b.
6

c.
5

d.
7

e.
None of the choices

Clear my choice

Question 6
Not yet answered
Marked 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 these
d.
int intArray[][][];
e.
int[][][][] intArray;
Clear my choice

Question 7
Not yet answered
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 these
b.
31
c.
0
d.
30
e.
29
Clear my choice

Question 8
Not yet answered
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.
None of the choices

b.
6

c.
5

d.
4

e.
7

Clear my choice

Question 9
Not yet answered
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[7];
c.
intArray[6];
d.
intArray[10];
e.
None of these
Clear my choice
Question 10
Not yet answered
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[7];
b.
intArray[6];
c.
None of these
d.
intArray[10];
e.
stringArray[5];

Question 1
Not yet answered
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 = scan.nextString();
b.
string str = scan.nextShort();
c.
None of these
d.
String num = scan.nextText();
e.
String str = JOptionPane.showInputDialog("");
Clear my choice

Question 2
Not yet answered
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.
3.1416
c.
12.0
d.
All of these
e.
floating-point literal
Clear my choice

Question 3
Not yet answered
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.
236

c.
128
 

d.
512
 

e.
None of these

Clear my choice

Question 4
Not yet answered
Marked out of 1.00

Flag question

Question text
What is the return value of this method: int test(){return 1;}  ?
Select one:
a.
int

b.
test

c.
All of the choices

d.
1

e.
return 1

Clear my choice

Question 5
Not yet answered
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.
1.0

c.
1.01.0

d.
None of the choices

e.
11

Clear my choice

Question 6
Not yet answered
Marked out of 1.00

Flag question

Question text
Which is not a decision control structure?

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

Question 7
Not yet answered
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.
4

b.
7

c.
6

d.
None of the choices

e.
5

Clear my choice

Question 8
Not yet answered
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.
None of these

b.
display 1111
 

c.
display nothing
 

d.
display 1234
 

e.
display 1
 

Clear my choice

Question 9
Not yet answered
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.
The given code is not valid

b.
123567

c.
12356

d.
None of these

e.
765321

Clear my choice

Question 10
Not yet answered
Marked out of 1.00

Flag question

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

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

Question 11
Not yet answered
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.
None of these

b.
1
 

c.
0
 

d.
11
 

e.
10
 
Clear my choice

Question 12
Not yet answered
Marked out of 1.00

Flag question

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

Select one:
a.
int

b.
None of the choices

c.
test

d.
6

e.
7

Clear my choice

Question 13
Not yet answered
Marked out of 2.00

Flag question

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

Select one:
a.
None of these

b.
compute

c.
compute grade

d.
final

e.
int

Clear my choice

Question 14
Not yet answered
Marked out of 2.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;
Clear my choice
Question 15
Not yet answered
Marked out of 1.00

Flag question

Question text
Which is not a repetition control structure?

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

Question 16
Not yet answered
Marked out of 2.00

Flag question

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

Select one:
a.
if (y>y)
 

b.
if (x!<y)
 

c.
if (x>y)
 

d.
if (x<>y)
 

e.
None of these

Clear my choice

Question 17
Not yet answered
Marked 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.
None of these
c.
if (boolean_expression)
d.
if boolean_expression
e.
if boolean_expression
Clear my choice

Question 18
Not yet answered
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.
1235678910

b.
0000000000

c.
None of the choices

d.
The given code is not valid

e.
012356789

Clear my choice

Question 19
Not yet answered
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.
nextString()
c.
nextText()
d.
nextLine()
e.
All of these
Clear my choice

Question 20
Not yet answered
Marked out of 1.00

Flag question

Question text
Which of the following shows Overloading method?

Select one:
a.
All of these

b.
void test(int x){} void test(double x){}

c.
void test(){} void test(){}

d.
void test(int x){} void test(int y){}

Clear my choice
Question 21
Not yet answered
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.
print "Hello World" infinitely

c.
The code will not run because of syntax error

d.
None of these

e.
Do nothing

Clear my choice

Question 22
Not yet answered
Marked out of 1.00

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

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

Question 23
Not yet answered
Marked 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.
int intArray[][][];
d.
int[][][][] intArray;
e.
All of these
Clear my choice

Question 24
Not yet answered
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 these
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.
Clear my choice

Question 25
Not yet answered
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.
stringArray[5];
c.
None of these
d.
intArray[7];
e.
intArray[10];
Clear my choice

Question 26
Not yet answered
Marked out of 2.00

Flag question

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

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

Question 27
Not yet answered
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.
6

b.
111111

c.
222

d.
None of the choices

Clear my choice

Question 28
Not yet answered
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[7];
b.
None of these
c.
intArray[6];
d.
stringArray[5];
e.
intArray[10];
Clear my choice

Question 29
Not yet answered
Marked out of 1.00

Flag question

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

Select one:
a.
None of these

b.
1

c.
int

d.
void

e.
test()

Clear my choice

Question 30
Not yet answered
Marked out of 2.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.
4

d.
5

e.
None of the choices

Clear my choice

Question 31
Not yet answered
Marked out of 2.00

Flag question

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

Select one:
a.
None of these

b.
void test(char x, int y){} void test(int x, char y){}
c.
void test(){} void test(){}

d.
void test(int x){} void test(int y){}

Clear my choice

Question 32
Not yet answered
Marked 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.
x

b.
1

c.
void

d.
sum

e.
None of the choices

Clear my choice

Question 33
Not yet answered
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.
6

b.
4

c.
5

d.
None of the choices

e.
7

Clear my choice

Question 34
Not yet answered
Marked out of 2.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
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.
Clear my choice

Question 35
Not yet answered
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 these

d.
if (x>y)?:
 

e.
if (x<>y)
 

Clear my choice

Question 36
Not yet answered
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.
3

b.
11

c.
1

d.
2

e.
None of the choices

Clear my choice

Question 37
Not yet answered
Marked out of 2.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.
0
c.
31
d.
None of these
e.
29
Clear my choice

Question 38
Not yet answered
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.
3
c.
128
d.
short value
e.
None of these
Clear my choice

Question 39
Not yet answered
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" infinitely
 

c.
None of these

d.
The code will not run because of syntax error
 

e.
print "Hello World"
 

Clear my choice

Question 40
Not yet answered
Marked 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.
None of these
c.
short num = scan.nextShort();
d.
short num = scan.nextInt();
e.
int num = scan.nextLong();

e.
Object
Clear my choice

Question 9
Not yet answered
Marked 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.
short x=1; int y = x; 

c.
All of these

d.
Object obj = new Object();

Clear my choice

Question 10
Not yet answered
Marked 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.
false
c.
true
d.
“a”
e.
None of these
Question 1
Not yet answered
Marked out of 1.00

Flag question

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

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

Question 2
Not yet answered
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.
The code is not valid.

b.
int 25

c.
0

d.
None of these

e.
String 25

Clear my choice

Question 3
Not yet answered
Marked 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.
false
e.
None of these
Clear my choice

Question 4
Not yet answered
Marked out of 1.00
Flag question

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

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

Question 5
Not yet answered
Marked out of 1.00

Flag question

Question text
It is a template for creating an object?

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

Question 6
Not yet answered
Marked out of 1.00

Flag question

Question text
Which of the following show casting object?

Select one:
a.
(className)     object;

b.
All of the choices

c.
Employee emp = new Employee(); VicePresident veep = new VicePresident(); veep =
(VicePresident)emp;

d.
SuperClass sc = new SuperClass(); SubClass sbc = new SubClass(); sbc = (SubClass) sc;

Clear my choice

Question 7
Not yet answered
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.
String str = new String();

c.
Test t = new Test();

d.
Object obj = new Object();

e.
All of the choices

Clear my choice

Question 8
Not yet answered
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.
Object Oriented
b.
None of these
c.
Encapsulation
d.
Class
e.
Object
Clear my choice

Question 9
Not yet answered
Marked 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.
short x=1; int y = x; 

c.
All of these

d.
Object obj = new Object();

Clear my choice

Question 10
Not yet answered
Marked 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.
false
c.
true
d.
“a”
e.
None of these

Question 1
Answer saved
Marked out of 1.00

Flag question

Question text
What keyword is used to perform class inheritance?

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

Question 2
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.
this()
b.
super.call()
c.
this.call()
d.
super()
Clear my choice

Question 3
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 these

b.
public class Person extends [InterfaceName] {}

c.
public class Person apply [InterfaceName] {}
d.
public class Person implements [InterfaceName] {}

e.
public class Person use [InterfaceName] {}

Clear my choice

Question 4
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 abstract class Person {}

b.
None of these

c.
public final class Person {}

d.
class Person{}

e.
public class Person {}

Clear my choice

Question 5
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 static void setName(){}

b.
public void setName(){}

c.
public no_override void setName(){}

d.
public final void setName(){}

e.
None of these

Clear my choice

Question 6
Answer saved
Marked out of 1.00

Flag question

Question text
Which of the following is true about Interface?

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

Question 7
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.
class Person{}

b.
public final class Person {}

c.
None of these

d.
public abstract class Person {}

e.
public class Person {}

Clear my choice

Question 8
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.
Interface
c.
Polymorphism
d.
None of these
e.
Abstraction
Clear my choice

Question 9
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.
public interface [InterfaceName] {}

c.
public [InterfaceName] {}

d.
interface: [InterfaceName]

Clear my choice

Question 10
Answer saved
Marked out of 1.00

Flag question

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

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy