wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

AIASA Code Rewind

Total questions: 24

Worksheet time: 16mins

Name
Class
Date
1.

Switch Statement

a)

Is a statement with a set of conditions called cases

b)

Is a case

c)

Is a condition with no cases

d)

Is a boolean statement

2.

Which of the following are correct file opening modes in C?

a)

r

b)

rb

c)

w

d)

All of the above

3.

cstdlib

a)

Can convert a number into a letter

b)

It doesn't have any use

c)

Is the same as iostream

d)

Can convert a number into absolute number

4.

ctime

a)

Manipulates your CPU

b)

Manipulates other libraries

c)

Manipulates date and time information

d)

It just counts

5.

For a random number generator, you write it as

a)

sin()

b)

rand()

c)

cos()

d)

abs()

6.
The process of creating a new variable without value
a)
declaration
b)
naming
c)
instantiation
d)
assigning
7.


If p is an integer pointer with a value 1000, then what will the value of p + 5 be?

a)

1004

b)

1020

c)

1005

d)

1015

8.

What is the disadvantage of arrays in C?

a)

the amount of memory to be allocated needs to be known beforehand.

b)

Elements are stored in contiguous memory blocks

c)

Elements can be accessed in constant time

d)

None

9.

Which of the following is NOT a logical operator in C++ language?

a)

&

b)

&&

c)

||

d)

!

10.

If originally x=2,y=0, and z=1, what is the value of x, y, and z after executing the following code?


if (x>y)


y=x;

else

z=x;

a)

x=2 y=2 z=1

b)

x=0 y=2 z=0

c)

x=2 y=1 z=1

d)

x=2 y=0 z=1

11.

what is the o/p?

a)

0

b)

5

c)

-5

d)

10

12.

A function can have _____ inside the parenthesis

a)

loops

b)

Arguments/Parameters

c)

Braces

d)

Types

13.

what will be the output of the given code?

a)

3 3

b)

3 5

c)

5 3

d)

5 5

14.

A function that is not void needs to have a _____ _______

a)

variable calculation

b)

printing statement

c)

Return statement

d)

cout statement

15.

The #include <stdio.h> is a ______________.

a)

Inclusion directive

b)

File inclusion directive

c)

Preprocessor directive

d)

None of the above

16.

Which of the following is a correct comment?

a)

*/ Comments */

b)

** Comment **

c)

/* Comment */

d)

{ Comment }

17.

Out of the following, which one is not valid as an if-else statement?

a)

if ((char) x){}

b)

if (x){}

c)

if (func1 (x)){}

d)

if (if (x == 1)){}

18.

What is the range of values that can be stored by int datatype in C?

a)

-(2^31) to (2^31) - 1.

b)

-256 to 251

c)

0 to (2^31) -1

d)

-256 to 255

19.
a)

Equal strings

b)

There will be a compile error and it will not run

c)

Nothing will be output on the console

d)

None of the above

20.

Do while loops

a)

Runs a statement once

b)

Runs a statement twice

c)

Runs a statement multiple times or not within a boolean condition

d)

Doesn't run at all

21.

What will be the output of the following C code?

a)

3 2 3

b)

2 2 3

c)

3 2 2

d)

2 3 3

22.

What will be the output of the following C code?

a)

Run time error

b)

7

c)

8

d)

Depends on compiler

23.

What will be the output of the following C code?

a)

H

b)

H is printed infinite times

c)

Compile time error

d)

Varies

24.

What is the default return type if it is not specified in function definition?

a)

void

b)

int

c)

double

d)

short int