wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C Programming Fundamentals

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the purpose of operators in C?

a)

To define variables in C

b)

To manage memory allocation

c)

The purpose of operators in C is to perform operations on data.

d)

To create functions in C

2.

List the basic data types available in C.

a)

string

b)

array

c)

int, float, double, char, void

d)

boolean

3.

Explain the structure of a C program.

a)

A C program consists only of comments and whitespace.

b)

A C program is made up of classes and objects.

c)

A C program is structured with preprocessor directives, a main function, variable declarations, function definitions, statements, and comments.

d)

A C program is structured with only variable declarations and loops.

4.

What is the difference between a variable and a constant in C?

a)

A variable can change its value, while a constant cannot.

b)

A variable is a fixed value, while a constant can change.

c)

Both variables and constants can change their values.

d)

A variable is only used for numbers, while a constant is for text.

5.

How do you declare a variable in C?

a)

To declare a variable in C, use the syntax: type variable_name; (e.g., int num;).

b)

var num: int;

c)

declare int num;

d)

int num = new;

6.

What are arithmetic operators in C?

a)

==, !=, >, <, >=, <=

b)

The arithmetic operators in C are +, -, *, /, and %.

c)

&, |, ^, ~, <<, >>

d)

++ , --, **, //, //=

7.

Describe the use of the 'main' function in C.

a)

The 'main' function is responsible for memory allocation.

b)

The 'main' function is used for defining global variables.

c)

The 'main' function is the entry point of a C program, where execution starts.

d)

The 'main' function is where all functions are declared.

8.

What is a pointer and how is it used in C?

a)

A pointer is a variable that holds the address of another variable, used for direct memory access and manipulation in C.

b)

A pointer is used to create loops in C.

c)

A pointer is a variable that stores a string value.

d)

A pointer is a type of function in C.

9.

Explain the concept of type casting in C.

a)

Type casting in C is only done implicitly.

b)

Type casting in C is the process of changing variable names.

c)

Type casting in C refers to the allocation of memory for variables.

d)

Type casting in C is the conversion of a variable from one data type to another, either explicitly or implicitly.

10.

What are the rules for naming variables in C?

a)

Variable names can include special characters like @ and #

b)

Variable names in C must start with a letter or underscore, can include letters, digits, and underscores, are case-sensitive, cannot be reserved keywords, and have a maximum length.

c)

Variable names are not case-sensitive

d)

Variable names can start with a digit