wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C CODE MASTER A

Total questions: 20

Worksheet time: 28mins

Name
Class
Date
1.

Which keyword is used to prevent any changes in the variable within a C program?

a)

immutable

b)

const

c)

 volatile

d)

mutable

2.

In C language what are the basic building blocks that are constructed together to write a program?

a)

keywords

b)

tokens

c)

identifiers

d)

functions

3.

Which is the smallest program to compile and run without errors?

a)

main() { ; }

b)

main() { }

c)

int main() {return 0;}

d)

main()

4.

In which segment does dynamic memory allocation takes place?

a)

BSS Segment

b)

data segment

c)

heap

d)

stack

5.

By default c uses the call by value method to pass arguments to functions. How can you invoke the call by reference method?

a)

by using recursive functions

b)

by using pointers

c)

by using global variables

d)

by declaring functions separately from defining them

6.

what is the output of following program.

a)

B D

b)

B C

c)

A B

d)

error

7.

What is the output of following programe.

a)

TRUE

b)

FALSE

c)

RUN TIME ERROR

d)

COMPILATION ERROR

8.

For 16-bit compiler allowable range for integer constant is ____

a)

-32668 to 32667

b)

-32767 to 32768

c)

-32768 to 32767

d)

-3.4e38 to 3.4e38

9.

Which one of the following is not a reserved Keywords in C.

a)

auto

b)

main

c)

case

d)

default

e)

none of these

10.

What is the difference btw a declaration and definiton of a variable?

a)

A definition occurs once, but a declaration may occur many times.

b)

Both can occur multiple times, but a declaration must occur first.

c)

Both can occur multiple times, but a definition must occur first

d)

A declaration occurs once, but a definition may occur many times.

e)

There is no difference between them

11.

Which of the following is true about arrays in C.

a)

For every type T, there can be an array of T.

b)

For every type T except void and function type, there can be an array of T.

c)

When an array is passed to a function, C compiler creates a copy of array.

d)

2D arrays are stored in column major form

12.

Which of the following is true :-

a)

gets() doesn't do any array bound testing and should not be used.

b)

gets() cannot read strings with spaces

c)

fgets() should be used in place of gets() only for files, otherwise gets() is fine

d)

None of the above

13.

Which one of the following is correct for overloaded functions in C++ ?

a)

Compiler sets up a separate function for every definition of function.

b)

Compiler does not set up a separate function for every definition of function. 

c)

Overloaded functions cannot handle different types of objects.

d)

Overloaded functions cannot have same number of arguments.

14.

Which of the following is NOT possible with any 2 operators in C?

a)

Same precedence, different associativity

b)

Different precedence, different associativity

c)

Different precedence, same associativity

d)

All of the mentioned

15.

The C-preprocessors are specified with ____ symbol.

a)

*

b)

%

c)

#

d)

" "

16.

What will be the output of the following C function?

a)

Segmentation fault

b)

Compilation error

c)

1 2 3 4 5

d)

Undefined behaviour

17.

Is it necessary that in a function which accepts variable argument list there should be at least be one fixed argument?

a)

True

b)

False

18.

To scan a and b given below, which of the following scanf() statement will you use?

a)

scanf("%f %lf", &a, b);

b)

scanf("%Lf %Lf", &a, &b);

c)

scanf("%f %Lf", &a, &b);

d)

scanf("%f %lf", &a, &b);

19.

Which of the following statement is correct prototype of the malloc() function in c ?

a)

int* malloc(int);

b)

char* malloc(char);

c)

unsigned int* malloc(unsigned int);

d)

void* malloc(size_t);

20.

Iteration requires more system memory than recursion.

a)

True

b)

False