Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

BASIC C PROGRAMMING

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

Which of the following is not a valid C variable name?

a)

int number;

b)

float rate;

c)

int variable_count;

d)

int $main;

2.

All keywords in C are in ____________

a)

LowerCase letters

b)

UpperCase letters

c)

CamelCase letters

d)

None of the mentioned

3.

Which of the following is true for variable names in C?

a)

They can contain alphanumeric characters as well as special characters

b)

It is not an error to declare a variable to be one of the keywords(like goto, static)

c)

Variable names cannot start with a digit

d)

Variable can be of any length

4.

Which of the following is not a logical operator?

a)

&&

b)

!

c)

||

d)

|

5.

How many keywords are there in C language?

a)

30

b)

31

c)

32

d)

33

6.

6. Which of the following cannot be a variable name in C?

a)

volatile

b)

true

c)

friend

d)

export

7.

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

a)

immutable

b)

mutable

c)

const

d)

volatile

8.

What is the result of logical or relational expression in C?

a)

True or False

b)

0 or 1

c)

0 if an expression is false and any positive number if an expression is true

d)

None of the mentioned

9.

What is #include <stdio.h>?

a)

Preprocessor directive

b)

Inclusion directive

c)

File inclusion directive

d)

None of the mentioned

10.

Which of the following are C preprocessors?

a)

#ifdef

b)

#define

c)

#endif

d)

all of the mentioned

11.

The C-preprocessors are specified with _________ symbol.

a)

#

b)

&

c)

%

d)

*

12.

scanf() is a predefined function in______header file.

a)

stdlib. h

b)

ctype. h

c)

stdio. h

d)

stdarg. h

13.

What will be the output of the following C code?

a)

Compile time error

b)

Hello World! 34

c)

Hello World! 1000

d)

Hello World! followed by a junk value

14.

Which is valid C expression?

a)

int my_num = 100,000;

b)

int my_num = 100000;

c)

int my num = 1000;

d)

int $my_num = 10000;

15.

What will be the final value of x in the following C code?

a)

3.75

b)

Depends on compiler

c)

24

d)

3