wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

ARRAYS AND FUNCTIONS

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.
An array is...
a)
An arrangement of objects, pictures, or numbers in columns and rows
b)
An arrangement of objects, pictures, or numbers in unicorns and rainbows
c)
An arrangement of objects, pictures, or numbers in cheese and crackers
d)
An arrangement of objects, pictures, or numbers in dolphins and sea turtles
2.
Which array matches the word problem.
a)
6 x 6 = 36
b)
3 x 4 = 12
c)
6 x 4 = 24
d)
4 x 6 = 24
3.
Which equation matches this array?
a)
5 x 3 = 15
b)
3 x 5 = 15
c)
4 x 3 = 12
d)
3 x 4 = 12
4.

Each element in an array can be accessed using its what?

a)

By counting in the items in the array

b)

Position or index in the array

c)

By printing the items in the array

d)

By printing and counting the entire array

5.

Why are arrays useful?

a)

It saves storage space storing under one name

b)

You can store integers and strings together

c)

You can store thing related on different topics

d)

You may have lots of related data that you don't want to store separately

6.

Which element is at index 1 in the array?

a)

Pear

b)

Apple

c)

Orangle

d)

Orange

7.

What's the code doing here?

a)

Changing the value of the element at index 2

b)

Changing the value of the element at index 1

c)

Changing the element of the value at index 1

d)

Changing the index of the value

8.

What would this code print?

a)

Crumpet

b)

Apple

c)

Pork

d)

Beef

9.

Which of the following is true about return type of functions in C?

a)

Functions can return any type

b)

Functions can return any type except array and functions

c)

Functions can return any type except array, functions and union

d)

Functions can return any type except array, functions, function pointer and union

10.

In C, what is the meaning of following function prototype with empty parameter list

void fun()

{

/* .... */

}

a)

Function can only be called without any parameter

b)

Function can be called with any number of parameters of any types

c)

Function can be called with any number of integer parameters.

d)

Function can be called with one integer parameter

11.

What is the output of this C code?


int main()

{

void foo(), f();

f();

}

void foo()

{

printf("2 ");

}

void f()

{

printf("1 ");

foo();

}

a)

Compile time error as foo is local to main

b)

1 2

c)

2 1

d)

Compile time error due to declaration of functions inside main

12.

What is the output of this C code?


int main()

{

int i = -5;

int k = i %4;

printf("%d\n", k);

}

a)

Compile time error

b)

-1

c)

1

d)

None

13.

What is the value of x in this C code?


void main()

{

int x = 4 *5 / 2 + 9;

}

a)

6.75

b)

1.85

c)

19

d)

3

14.

#include is called

a)

Preprocessor directive

b)

Inclusion directive

c)

File inclusion directive

d)

None of the mentioned

15.

Which keyword can be used for coming out of recursion?

a)

break

b)

return

c)

exit

d)

Both (a) and (b)