wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Java Programming Quizz-GX

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

Which of the following is a comment in the Java language?

a)

/ comment /

b)

/* comment */

c)

/ comment */

d)

<-- comment -->

2.

Which of the following is the correct main() method signature in Java?

a)

public static void main (String [] args)

b)

public static void Main (String [] args)

c)

public static void main (string [] args)

d)

public static void main (String args)

3.

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

a)

int 1myInteger = 0;

b)

int int = 0;

c)

Int my Integer = 0;

d)

int myInteger = 0;

4.

Which Java data type is used to store 64-bit floating-point numbers?

a)

int

b)

long

c)

float

d)

double

5.

What is the problem with this code?

Line 1: String myName = "Mary Jacobson";

Line 2: System.out.println ("My name is " + myname);

a)

Line 2: should be System.out.println ("My name is myName");

b)

Line 2: should be System.out.println ("My name is " + myName);

c)

Line 2: should be System.out.display("My name is " + myname);

d)

There is no problem with the code

6.

What is pseudocode?

a)

A simple java-like programming language

b)

Statements in plain English

c)

A control structure used in Java

d)

A java class

7.

What will be the output?

a)

24

b)

32

c)

23

d)

32

8.

Which example shows the correct syntax for a while loop?

a)

b)

c)

9.

If the value of inputtedNum is 6, then what is the output of the following code?

a)

<no output>

b)

The sun will shine bright

c)

The moon will glow bright

d)

Error

10.

Which control flow statement is represented by a diamond shape in a flowchart diagram?

a)

while

b)

if

c)

do while

d)

none

11.

How would you describe a while loop?

a)

Check the condition; if it is true, then run a code block. Otherwise, run a different code block.

b)

Check whether the condition is true; if it is true, then keep repeating until the condition is false.

c)

Run a block of code and then check the condition; if the condition is true, then repeat the block of code.

12.

Given a symbol in each question, choose the best answer.

a)

Represents a decision-making point

b)

Represents arithmetic operations and data manipulations

c)

Represents the start and the end of a flowchart

d)

Represents the flow of the algorithm

e)

Input-Output

13.

Given a symbol in each question, choose the best answer.

a)

Represents a decision-making point

b)

Represents arithmetic operations and data manipulations

c)

Represents the start and the end of a flowchart

d)

Represents the flow of the algorithm

e)

Input-Output

14.

Given a symbol in each question, choose the best answer.

a)

Represents a decision-making point

b)

Represents arithmetic operations and data manipulations

c)

Represents the start and the end of a flowchart

d)

Represents the flow of the algorithm

e)

Input-Output

15.

Given a symbol in each question, choose the best answer.

a)

Represents a decision-making point

b)

Represents arithmetic operations and data manipulations

c)

Represents the start and the end of a flowchart

d)

Represents the flow of the algorithm

e)

Input-Output

16.

Given a symbol in each question, choose the best answer.

a)

Represents a decision-making point

b)

Represents arithmetic operations and data manipulations

c)

Represents the start and the end of a flowchart

d)

Represents the flow of the algorithm

e)

Input-Output

17.

What is at the end of a line of code?

a)

#

b)

;

c)

)

d)

>

18.

A variable that holds a whole number?

a)

String

b)

Boolean

c)

Int

d)

Float

19.

A variable that holds words?

a)

String

b)

Boolean

c)

Int

d)

Float

20.

A variable that holds a decimal number?

a)

String

b)

Boolean

c)

Int

d)

Float

21.

A data type that deals with logical values?

a)

Boolean

b)

Cast Operator

c)

Character String

d)

Class

22.

Comments that are enclosed between /* and /. The compiler ignores anything that appears between / and */...

a)

Single-line comments

b)

Multiple-line comments

c)

comments

23.

A variable that holds a character?

a)

String

b)

Boolean

c)

Int

d)

Char

24.

Which of this command is the correct way of printing in Java?

a)

System.Out.print

b)

System.out.Print

c)

System.out.print

d)

system.out.print

25.

Name the data type: '3'

a)

int

b)

char

c)

string

d)

None of the above