wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Quiz-1: Arrays

Total questions: 39

Worksheet time: 20mins

Name
Class
Date
1.

An Array is a collection of -

a)

Different data types

b)

Same data types

c)

Both (a) and (b)

d)

None of these

2.

Array elements are stored in -

a)

Scattered memory locations

b)

Sequential memory locations

c)

Both (a) and (b)

d)

None of these

3.

A character array is always ends with -

a)

Null ('\0') character

b)

Question Mark (?)

c)

Full stop (.)

d)

None of these

4.

If you declare array without static the elements it will be set to -

a)

A null value

b)

zero

c)

Garbage value

d)

None of these

5.

Arrays cannot be intialized if they are -

a)

Automatic

b)

external

c)

static

d)

None of the above

6.

All the elements in the array must be -

a)

Initialized

b)

Defined

c)

both (a) and (b)

d)

None of the above

7.

What will be the output of the following program - #include int main(){ int a1[5] = {1}; int b=0, k=0; for(b=0;b<=4;b++) print("%3d", ++a1[0]); return 0; }

a)

a) 2 3 4 5 6

b)

b) 1 2 3 4 5

8.

How many integer values can the array N[5][5] store?

a)

10

b)

16

c)

24

d)

25

9.

What index value should be used to access the last element of the integer array N[10]?

a)

10

b)

9

c)

11

d)

None of the above

10.

The process of creating a fixed-sized array by allocating memory space at compile time is called __________ .

a)

Static memory allocation

b)

Run time memory allocation

c)

Dynamic memory allocation

d)

None of the above

11.

An array N[3] = {1,2,3} has been declared and initialized in a C program. What will be the output of the following statement - printf("%d", N[3]);

a)

3

b)

2

c)

4

d)

Garbage value

12.

An array ARR[5][20] has been declared. What will be the output of the following statement? printf("%d", sizeof(ARR));

a)

100

b)

200

c)

400

d)

800

13.

The variable used as a subscript in an array is probably known as _______ variable.

a)

Control

b)

Index

c)

Constant

d)

None of the above

14.

An array can be initialized -

a)

Compile time

b)

Run time

15.

Array name -

a)

A common name shared by all elements

b)

An array variable

c)

A keyboard

d)

Not used in the program

16.

Array subscript in C always start at -

a)

-1

b)

0

c)

1

d)

any value

17.

An array of similar data types which themselves are a collection of dissimilar data type are

a)

Linked Lists

b)

Trees

c)

Array of Structure

d)

All of the mentioned

18.

An array of similar data types which themselves are a collection of dissimilar data type are

a)

Linked Lists

b)

Trees

c)

Array of Structure

d)

All of the mentioned

19.

Each element in an array has an index and the starting index is index 1.

a)

True

b)

False

20.

Which control structure is used to repeatedly execute a block of code in C?

a)

for loop

b)

if statement

c)

switch case

d)

while loop

21.

In C, what is the purpose of the 'break' statement within a loop?

a)

Continue to the next iteration

b)

Exit the program

c)

Terminate the loop and exit it

d)

Skip the current iteration

22.

What is the purpose of the 'else' statement in C's 'if-else' control structure?

a)

Execute the 'if' block

b)

Execute the 'else' block

c)

Execute both 'if' and 'else' blocks

d)

Skip the 'if' block

23.

Which control structure is used to make a decision between two or more alternatives in C?

a)

switch case

b)

for loop

c)

if statement

d)

while loop

24.

What is the result of the expression 5 > 3 && 4 < 6 in C?

a)

TRUE

b)

FALSE

c)

1

d)

0

25.

In C, what happens if the 'default' case is missing in a 'switch' statement?

a)

It causes a compilation error

b)

It has no effect

c)

It executes the 'default' case by default

d)

It generates a runtime error

26.

What is the purpose of the 'continue' statement in C?

a)

Skip the loop

b)

Exit the program

c)

Skip the current iteration

d)

Exit the loop

27.

How many times will a 'do-while' loop execute its body if the condition is initially false in C?

a)

0 times

b)

1 time

c)

Infinite times

d)

It depends on the loop body

28.

What is the result of the expression !(5 == 5) in C?

a)

TRUE

b)

FALSE

c)

1

d)

0

29.

In C, which control structure is used to iterate through a collection of items, such as an array or a list?

a)

for loop

b)

if statement

c)

switch case

d)

while loop

30.

What is the purpose of the 'if' control structure in C?

a)

Looping

b)

Decision making

c)

Function declaration

d)

Error handling

31.

What is the result of the expression 10 % 3 in C?

a)

1

b)

0

c)

3

d)

2

32.

In C, what happens if the 'break' statement is used outside of a loop or switch statement?

a)

It has no effect

b)

It generates a compilation error

c)

It exits the program

d)

It generates a runtime error

33.

Which control structure in C is used to perform a repetitive task while a condition is true?

a)

if statement

b)

for loop

c)

while loop

d)

switch case

34.

What is the result of the expression `7 || 0` in C?

a)

TRUE

b)

FALSE

c)

1

d)

0

35.

In C, what is the purpose of the 'goto' statement?

a)

Break out of a loop

b)

Terminate the program

c)

Transfer control to a labelled statement

d)

Execute a function

36.

What does the 'default' case in a 'switch' statement do in C?

a)

Executes when no other case matches

b)

Causes a compilation error

c)

Skips the 'switch' statement

d)

Exits the program

37.

How can you create an infinite loop in C?

a)

Use a 'for' loop

b)

Use a 'while' loop with a true condition

c)

Use a 'do-while' loop

d)

Use a 'switch' statement

38.

What is the result of the expression 2 && 0 in C?

a)

TRUE

b)

FALSE

c)

1

d)

0

39.

In C, which statement is used to exit the current iteration of a loop and continue with the next iteration?

a)

break

b)

return

c)

continue

d)

exit