wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

DADT02 APP Quiz Topic 2

Total questions: 10

Worksheet time: 10mins

Name
Class
Date
1.

What is the main purpose of a named constant in programming?

a)

To store temporary values

b)

To create a fixed value that cannot be changed

c)

To act as a placeholder for variables

d)

To optimize memory usage

2.

How is a named constant typically declared in Java?

a)

Using var

b)

Using final

c)

Using constant

d)

Using static

3.

What does the scope of a variables determine?

a)

The data type of the variable

b)

The lifespan and accessibility of the variable

c)

The memory allocation of the variable

d)

The value assigned to the variable

4.

Which of the following scopes is NOT a valid in programming?

a)

Local scope

b)

Global scope

c)

Function scope

d)

Unlimited scope

5.

Named constants can have their values changed during program execution.

a)

True

b)

False

6.

Define a named constant and provide an example of its declaration in any programming language

4 lines
7.

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

a)

String

b)

Array

c)

int

d)

Object

8.

What type of data can a boolean variable store?

a)

Text values

b)

Decimal numbers

c)

True or false values

d)

Large integers

9.

What is the purpose of garbage collection in programming?

a)

To allocate memory for variables

b)

To clean up unused objects and free memory

c)

To sort data in memory

d)

To delete all variables after a program ends

10.

How can you access an instance variable if it has the same name as a local variable in Java?

4 lines