wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

BSAIT 1-2 QUIZ

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What is a variable in Java?

a)

A constant value

b)

A named memory location that can store a value

c)

A method to execute code

d)

A type of data structure

2.

Which keyword is used to declare a named constant in Java?

a)

static

b)

final

c)

const

d)

immutable

3.

What does the main() method signify in a Java program?

a)

The end of the program

b)

The starting point for execution

c)

A method for input

d)

A method for output

4.

Which of the following is a primitive data type in Java?

a)

String

b)

Array

c)

int

d)

List

5.

What symbol is used to start a single-line comment in Java?

a)

/* */

b)

//

c)

#

d)

//* *//

6.

Which of the following is NOT a valid way to declare a variable in Java?

a)

int a = 5;

b)

float b = 2.5f;

c)

char c = 'A';

d)

string d = "Hello";

7.

Which of the following data types can hold decimal values?

a)

int

b)

char

c)

float

d)

boolean

8.

Which of the following statements about comments in Java is true?

a)

Comments are ignored by the compiler

b)

Comments must be written in uppercase

c)

Comments can affect the execution of the program

d)

omments are mandatory in every Java program

9.

What is the correct way to declare a variable of type double in Java?

a)

double d = 5.0;

b)

double d = 5;

c)

double d = "5.0";

d)

Doublr d = 5.0

10.

What is the correct way to declare a variable of type int in Java?

a)

int a = 4.5;

b)

int A = 4.0;

c)

Int a = 5;

d)

int a = 7;

11.

double Double = 78.5;

a)

True

b)

False

12.

char Char = B;

a)

True

b)

False

13.

boolean Boolean = True;

a)

True

b)

False

14.

String string = "Romeo";

a)

True

b)

False

15.

float Float = 45.6;

a)

True

b)

False

16.

byte Grade = 129;

a)

True

b)

False

17.

short Short = 33000;

a)

True

b)

False

18.

double Boolean = 46.78;

a)

True

b)

False

19.

int Char = 67;

a)

True

b)

False

20.

double Float = 90.0;

a)

True

b)

False