Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C programming

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

Which data type is used to store decimal numbers in C?

a)

int

b)

float

c)

double

d)

char

2.

How many bytes are occupied by a 'char' data type in C?

a)

2

b)

1

c)

4

d)

8

3.

Which data type is used to store single characters in C?

a)

char

b)

int

c)

float

d)

string

4.

What is the difference between 'float' and 'double' data types in C?

a)

float is more accurate than double

b)

float is for integers, double is for decimals

c)

float is double-precision, double is single-precision

d)

float is single-precision, double is double-precision

5.

How is a character constant represented in C?

a)

Enclosing a single character within double quotes

b)

Using square brackets to represent the character

c)

Using backticks to enclose the character

d)

Enclosing a single character within single quotes

6.

-------------- is other name for the variable.

a)

Constant

b)

Identifier

c)

operator

d)

function

7.

Variables must start with ------

a)

letter

b)

number

c)

special key

d)

0

8.

What is variable declaration in C?

a)

Variable declaration in C is the process of specifying the data type and name of a variable before it is used in the program.

b)

Variable declaration in C is only required for functions

c)

Variable declaration in C is not necessary

d)

Variable declaration in C is the process of assigning a value to a variable

9.

What are constants in C programming?

a)

Variables that can be changed at any point in the program

b)

Data types that are not supported in C programming

c)

Functions that return different values each time they are called

d)

Fixed values that cannot be altered during program execution.

10.

What are the naming conventions for variables in C?

a)

Variable names in C should start with a number

b)

Variable names in C can contain spaces

c)

Variable names in C should follow the convention of starting with a letter or underscore, followed by letters, digits, or underscores. They should not be a keyword or contain special characters.

d)

Variable names in C should be all uppercase

11.

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

a)

int number;

b)

float rate;

c)

int variable_count;

d)

int $main;

12.

Based on the naming rules, which of these is a valid variable name?

a)

2nd_year

b)

student age

c)

_count

d)

int

13.

What is the primary function of "Defining" a variable?

a)

To tell the compiler the name without allocating memory.

b)

To allocate memory and optionally initialize the variable.

c)

To list the keywords used in the program.

d)

To define the special characters in the character set.

14.

What is the purpose of a variable in C programming?

a)

To create loops

b)

To define functions

c)

To manage memory allocation

d)

To store data values

15.

Which of the following is a valid way to initialize a variable in C?

a)

double a = 3.14.15;

b)

char z = "A";

c)

float y = '5.5';

d)

int x = 10;