wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Grade 11 - IT - Quiz 1 - Mrs. Dina Mohamed

Total questions: 23

Worksheet time: 17mins

Name
Class
Date
1.

What is Java primarily used for?

a)

Designing graphics

b)

Creating video games

c)

Writing system software

d)

Developing mobile apps

2.

What does platform independence in Java mean?

a)

Java programs can run on any device with a JVM

b)

Java can only run on Windows

c)

Java requires specific hardware

d)

Java is only for mobile devices

3.

What symbol is used to end a statement in Java?

a)

,

b)

:

c)

;

d)

.

4.

Which of the following is a keyword in Java?

a)

function

b)

className

c)

variable

d)

int

5.

What is the entry point of a Java program?

a)

main()

b)

execute()

c)

start()

d)

run()

6.

What does the System.out.println() method do?

a)

Creates a new class

b)

Reads input from the user

c)

Prints text to the console

d)

Declares a variable

7.

Which data type is used to store whole numbers in Java?

a)

String

b)

char

c)

int

d)

float

8.

What is the output of the following code: System.out.println("The sum is: " + (10 + 20));?

a)

The sum is: 30

b)

The sum is: 10

c)

The sum is: 10 + 20

d)

The sum is: 20

9.

What type of comment is represented by // ?

a)

Multi-line comment

b)

Single-line comment

c)

Block comment

d)

Documentation comment

10.

What is the purpose of the main() method in Java?

a)

To print output

b)

To declare variables

c)

To execute the program

d)

To define a class

11.

What will be the output of the following code: System.out.println("Hello, World!");?

a)

World, Hello!

b)

Hello, World

c)

Hello World!

d)

Hello, World!

12.

Which of the following is a valid way to declare a character variable?

a)

char grade = 'A';

b)

char grade = "A";

c)

char grade = A;

13.

What does the '+' operator do in Java?

a)

Concatenates strings

b)

Adds two numbers

c)

Both adds and concatenates

d)

Subtracts two numbers

14.

Java is short for "JavaScript".

a)

true

b)

false

15.

How do you create a variable with the numeric value 5?

a)

float x = 5;

b)

x = 5;

c)

int x = 5;

d)

num x = 5

16.

Which operator is used to add together two values?

a)

The + sign

b)

The * sign

c)

The & sign

17.

what is the output?

System.out.println("10" + 15);

a)

25

b)

1015

c)

"10"15

d)

Errors/Warnings

18.

What will be the output of this code?

class Codechef {

public static void main(String[] args) {

int a = 10, b = 3 ;

System.out.print("a / b");

} }

a)

3.333

b)

3

c)

4

d)

a / b

19.

What will be the output of this code?

class Codechef {

public static void main(String[] args) {

int a = 10 ;

int b = 2 ;

int c = a / b;

System.out.print(c); } }

a)

3.333

b)

5

c)

4

d)

a / b

20.

14. What will be the output of this code? class Codechef {

public static void main(String[] args) {

System.out.print("Add2 ");

System.out.print("");

System.out.print("to3"); } }

a)

Add2to3

b)

Add 2 to 3

c)

Add2 to3

d)

Add2to 3

21.

What will be the output of this code?

class Codechef {

public static void main(String[] args) {

System.out.println(82);

System.out.print(2);

System.out.print(" 3");

} }

a)

82

2 3

b)

82

23

c)

822 3

d)

822" "3

22.

Which line of code will output the sum of 7 and 19?

a)

System.out.print(7 + 19);

b)

System.out.print("7 + 19");

c)

system.out.print(7 + 19);

d)

System.out.print(7 + 19)

23.

Which line of code will output the string "Hi"?

a)

Sys.out.print("Hi");

b)

System.out.print("Hi");

c)

System.out.print(Hi);

d)

System.out.print("Hi")