wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PPL 223 - (QUIZ 3) Data Types and Structures

Total questions: 15

Worksheet time: 5mins

Name
Class
Date
1.

Which of the following is a primitive data type?

a)

Array

b)

Integer

c)

Record

d)

Class

2.

What is the main characteristic of an array?

a)

Elements of different types

b)

Elements of the same type

c)

Variable size

d)

None of the above

3.

Which data type is best suited for representing a single character?

a)

Boolean

b)

Integer

c)

Float

d)

Character

4.

In a record, fields can be of:

a)

Only primitive types

b)

Only array types

c)

Different types

d)

Only string types

5.

What is the purpose of a discriminant field in a variant record?

a)

To hold multiple types simultaneously

b)

To store metadata about the record

c)

To determine which type of data is currently stored

d)

To provide a default value for fields

6.

Which type of type checking is done at compile-time?

a)

Dynamic

b)

Static

c)

Run-time

d)

Hybrid

7.

In Python, what is the inferred type of the variable age in the following code? age = 25

a)

String

b)

Float

c)

Integer

d)

Boolean

8.

Which statement is true about implicit typing?

a)

Requires explicit type annotations

b)

Reduces code readability

c)

The type is inferred from the assigned value

d)

Always results in type errors

9.

Which of the following is an example of a floating-point number?

a)

42

b)

'A'

c)

3.14

d)

True

10.

What is the primary benefit of using records in a program?

a)

Reducing code execution time

b)

Grouping related data

c)

Simplifying arithmetic operations

d)

Optimizing memory usage

11.

Variant records can store different types of data simultaneously.

a)

TRUE

b)

FALSE

12.

Type inference makes code more verbose.

a)

TRUE

b)

FALSE

13.

In arrays, all elements must be of the same type.

a)

TRUE

b)

FALSE

14.

Type checking ensures that operations on data types are valid.

a)

TRUE

b)

FALSE

15.

A boolean data type can hold true or false values.

a)

TRUE

b)

FALSE