wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Mastering C Programming Concepts

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What are the basic data types available in C?

a)

int8, int16, int32, int64, float

b)

string, boolean, list, map, object

c)

int, float, double, char, void

d)

byte, short, long, decimal, reference

2.

How do you declare an integer variable in C?

a)

int myVariable;

b)

float myVariable;

c)

num myVariable;

d)

integer myVariable;

3.

What is the result of the expression 5 + 3 * 2 in C?

a)

11

b)

8

c)

10

d)

9

4.

Which operator is used for logical AND in C?

a)

&

b)

and

c)

&&

d)

||

5.

What is the purpose of the 'if' statement in C?

a)

To declare variables and their types in a program.

b)

To execute code conditionally based on a boolean expression.

c)

To define a loop that iterates over a set of values.

d)

To handle exceptions and errors during runtime.

6.

What is the size of a 'char' data type in C?

a)

4 bytes

b)

1 byte

c)

1 kilobyte

d)

2 bytes

7.

How do you declare a variable with a float data type?

a)

my_float = 3,14

b)

float my_float = 3.14

c)

my_float : 3.14

d)

my_float = 3.14

8.

What is the output of the expression (10 > 5) && (5 < 3)?

a)

null

b)

undefined

c)

true

d)

false

9.

What control structure would you use to execute a block of code multiple times?

a)

Exception handling (try, catch)

b)

Loop (for, while, do-while)

c)

Function call (invoke, execute)

d)

Conditional statement (if, switch)

10.

What is the difference between '==' and '=' in C?

a)

'=' is for both assignment and comparison.

b)

'=' is for comparison; '==' is for assignment.

c)

'=' is for assignment; '==' is for comparison.

d)

'==' is used for variable declaration; '=' is for initialization.

11.

How do you declare a constant variable in C?

a)

int myConstant = 10;

b)

const int myConstant = 10;

c)

const myConstant = 10;

d)

define const myConstant = 10;

12.

Which operator is used for logical OR in C?

a)

&&

b)

|

c)

||=

d)

||

13.

What is the purpose of the 'switch' statement in C?

a)

The 'switch' statement is used for defining functions in C.

b)

The purpose of the 'switch' statement in C is to simplify multi-way branching based on the value of a variable.

c)

The 'switch' statement handles error exceptions in C.

d)

The 'switch' statement is for creating loops in C.

14.

What is the range of values for a signed int in C?

a)

-128 to 127

b)

0 to 4294967295

c)

-32768 to 32767

d)

-2147483648 to 2147483647

15.

What control structure is used for decision making in C?

a)

for and while

b)

do-while and foreach

c)

try-catch and finally

d)

if-else and switch