Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Quiz on Keyword, Constants and Variable

Total questions: 15

Worksheet time: 7mins

Name
Class
Date
1.

What is a keyword in the C programming language?

a)

A keyword in C is a reserved word with a predefined meaning.

b)

A keyword in C is a comment in the code.

c)

A keyword in C is a variable name.

d)

A keyword in C is a user-defined function.

2.

How many keywords are there in C?

a)

24

b)

16

c)

32

d)

40

3.

Can keywords in C be used as variable names? Why or why not?

a)

Keywords can be redefined as variable names in C.

b)

Yes, keywords can be used as variable names if they are not reserved.

c)

No, keywords in C cannot be used as variable names.

d)

Keywords can be used as variable names in certain contexts.

4.

What is the significance of the 'void' keyword in C?

a)

The 'void' keyword indicates a function returns a pointer.

b)

The 'void' keyword signifies that a function does not return a value.

c)

The 'void' keyword is used to declare a variable of any type.

d)

The 'void' keyword is a data type that can hold values.

5.

What is the role of the 'const' keyword in C?

a)

The 'const' keyword defines constant variables that cannot be modified after their initial assignment.

b)

The 'const' keyword is a data type that represents a variable with a fixed size.

c)

The 'const' keyword is used to declare functions that cannot be called.

d)

The 'const' keyword allows variables to be modified at any time.

6.

How does the 'sizeof' keyword work in C?

a)

'sizeof' is used to declare new data types in C.

b)

'sizeof' returns the size in bytes of a data type or variable.

c)

'sizeof' can only be used with integer data types.

d)

'sizeof' calculates the total number of variables in a program.

7.

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

a)

int a3;

b)

int 3a;

c)

int _A3;

d)

int a_3

8.

All keywords in C are in ____________

a)

Lowercase

b)

Uppercase

c)

Camelcase

d)

None of these

9.

Which is variable declaration?

a)

int a,b;

b)

c=a+b;

c)

printf("%d%d",a,b)

d)

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

10.

Which is valid C variable declarations?

a)

int my_num = 100,000;

b)

int my_num = 100000;

c)

int my num = 1000;

d)

int $my_num = 10000;

11.

How to print a and b variable of int and float respectively?

a)

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

b)

printf("%d %f", a, b);

c)

printf("%f %d", a, b);

d)

printf("%f %d", &a, &b);

12.

Find the output of the program

a)

error

b)

7

c)

2

d)

4

13.

The enum in C is _______

a)

built-in data type

b)

legal data type

c)

user-defined data type

d)

function defined type

14.

How enum differ from macro?

a)

Both are same

b)

define predefined values for macro and enum

c)

macro used for large porgrams enum used for small programs

d)

Macro can be used to define the name constants, but enum, all the name constants can be grouped together in a single statement.

15.

Choose a not valid constant variable creation using #define.

a)

#define value 10

b)

#define VALUE 10

c)

#define Value = 10

d)

#define VaLuE 10