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

Comprogram

The document contains 30 multiple choice questions about Java programming concepts. Some of the questions ask about valid Java syntax, keywords, data types, comments, identifiers, errors, literals, and features of the Java language.

Uploaded by

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

Comprogram

The document contains 30 multiple choice questions about Java programming concepts. Some of the questions ask about valid Java syntax, keywords, data types, comments, identifiers, errors, literals, and features of the Java language.

Uploaded by

gm22 mermaid
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

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

Select one:

a.
short x;

b.
float x = 2.0D;

c.
int x = 1;

d.
None of these

e.
int x;

Question 2
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.
None of these

c.
Yes, because we can call Java compiler from NetBeans

d.
It depends, if there is a compiler embedded in NetBeans.
Question 3
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.
else

c.
if

d.
goto

e.
None of these

Question 4
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 no error after compilation.

c.
There will be a runtime error after compilation.

d.
There will be a syntax error after compilation.

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_1

b.
_id

c.
All of these

d.
$id

e.
id

Question 6
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 resolve runtime error

b.
It is part of the compilation process

c.
To make JavaC available or accessible in command line.

d.
To resolve syntax error

Question 7
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.
javac HelloWorld.java

b.
javac HelloWorld

c.
java HelloWorld
d.
java HelloWorld.java

Question 8
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.
Runtime errors occur after compilation.

c.
Runtime errors occur when there is a design flaw in your program

d.
None of these

Question 9
Correct
Mark 1.00 out of 1.00

Flag question

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

Select one:

a.
Oak
b.
C

c.
NetBeans

d.
Java

Question 10
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.
java

c.
j

d.
class

Question 11
Correct
Mark 1.00 out of 1.00

Flag question
Question text
JVM is responsible for

Select one:

a.
Interpreting bytecode

b.
Generating bytecode

c.
Compiling source code

d.
Reading bytecode

Question 12
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.
Notepad

c.
eclipse

d.
None of these

e.
NetBeans
Question 13
Correct
Mark 1.00 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

Question 14
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.
path C:\Program Files\Java\jdk1.6.0_23\bin

b.
All of the given choices are correct
c.
set path

d.
C:\Program Files\Java\jdk1.6.0_23\bin

e.
< JavaC directory >

Question 15
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.
Code Security

c.
Static

d.
Platform independent

e.
None of these

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

c.
Declaration Comments

d.
Multi-Line Comments

e.
Documentation Comments

Question 17
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.
Robust

b.
Code Security
c.
Multithreaded

d.
Platform independent

Question 18
Correct
Mark 1.00 out of 1.00

Flag question

Question text
Which of the following is not Java Literal?

Select one:

a.
Float value

b.
Character value

c.
None of the above

d.
Integer value

e.
Boolean value

Question 19
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.
It depends, if there is a compiler embedded in Notepad.

c.
Yes, Because we can call Java compiler from notepad

d.
No, We can only write codes in Notepad

Question 20
Correct
Mark 1.00 out of 1.00

Flag question

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

Select one:

a.
Incorrect capitalization leads to syntax error.

b.
You will have syntax errors if you misspell the Java command.

c.
All of these

d.
Syntax errors are usually typing errors.

Question 21
Correct
Mark 1.00 out of 1.00

Flag question

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

Select one:

a.
None of these

b.
\f

c.
\t

d.
\b

Question 22
Correct
Mark 1.00 out of 1.00

Flag question

Question text
What is the input for Java Compiler?

Select one:

a.
Byte Code

b.
Source Code

c.
Native Code

d.
Code

Question 23
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.
1.2345E+3

d.
12345678910F

e.
None of these

Question 24
Correct
Mark 1.00 out of 1.00

Flag question

Question text
Which of the following is a valid identifier?
Select one:

a.
true

b.
name

c.
None of these

d.
static

e.
public

Question 25
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.java

b.
java HelloWorld

c.
javac HelloWorld.java

d.
javac HelloWorld

Question 26
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.
NetBeans

b.
eclipse

c.
Notepad

d.
BlueJ

e.
None of these

Question 27
Correct
Mark 1.00 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 28
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.
Byte Code

c.
Class Code

d.
Executable file

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.
short

b.
None of these

c.
String

d.
long

e.
byte

Question 30
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.
Object Oriented

b.
Robust

c.
Platform independent

d.
High Performance

You might also like