wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C basics

Total questions: 25

Worksheet time: 8mins

Name
Class
Date
1.

Who is know as founder of C language

a)

Dennis Ritchie

b)

Bjarne Stroustroup

c)

Tim Berner Lee

d)

Rasmus Ledorf

2.

Which of these is not a correct variable data type?

a)

int

b)

float

c)

real

d)

char

3.

C is a

a)

Low level language

b)

Assembly language

c)

Medium level language

d)

High level language

4.

Which punctuation ends most of the lines of C code?

a)

.

b)

;

c)

,

d)

" "

5.

The starting point of C execution at

a)

==

b)

main()

c)

function()

d)

!=

6.

What do you think is the best ways to enhance your skill in programming

a)

Study Hard

b)

Practice and learn new

c)

Eating Fufu while coding

d)

Study one day and leave it

7.

Find if the condition is True or False where int x=10; y=12;

x == y

a)

1 (True)

b)

0 (False)

8.

What do you think is the output for the below code snippet?

int main(){

int a=10,b=20;

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

}

a)

Error

b)

0.2

c)

2

d)

30

9.

What do you need to import stdio.h a header file?

a)

Just a waste of time

b)

To run the code

c)

It helps in compilation to binary coded file

d)

To perform input and output operations

10.
Which keyword is used to prevent any changes in the variable within a C program?
a)
static
b)
const
c)
constant
d)
fixed
11.
Group of instructions written to perform a task is called as_______.
a)
information
b)
comment
c)
array
d)
program
12.
\n is a backslash constant for ________
a)
Vertical Tab space
b)
Horizontal Tab Space
c)
Form Feed
d)
New Line
13.
Keywords are pre-defined words in a C compiler. Keywords are written in ____________ case letters
a)
upper
b)
lower
c)
either lower or upper
d)
combined lower and upper
14.
Which special symbol is used in arrays for specifying the subscript?
a)
{ }
b)
[ ]
c)
( )
d)
< >
15.
Which is valid C expression?
a)
int my_num = 100,000;
b)
int my_num = 10000;
c)
 int my num = 1000;
d)
int my(num) = 10000;
16.

What will be the output of following program?

a)

Hello

b)

OK

c)

Hello

OK

d)

Error

17.

What is the output of the C statement.?

int main()

 {

 int a=0;

 a = 4 + 4/2*5 + 20; 

 printf("%d", a); 

 return 0; 

}  

4 lines
18.

(a)   statements executes a group of statements repeatedly as long as a condition is met  .

19.

What is a correct syntax to output "Hello World" in C?

a)

printf("Hello World");

b)

System.out.printline("Hello World");

c)

cout << "Hello World";

d)

Console.WriteLine("Hello World");

20.

How do you insert COMMENTS in C code?

a)

// This is a comment

b)

--This is a comment#

c)

This is a comment/

d)

* This is a comment

21.

How can you create a variable with the numeric value 5?

a)

num = 5;

b)

val num = 5;

c)

num = 5 int;

d)

int num = 5;

22.

How can you create a variable with the floating number 2.8?

a)

float num = 2.8;

b)

num = 2.8 float;

c)

num = 2.8 double;

d)

val num = 2.8;

23.

Which format specifier is often used to print integers?

a)

%d

b)

%c

c)

%s

d)

%f

24.

Which operator can be used to compare two values?

a)

==

b)

><

c)

=

d)

<>

25.

What do we call the following? int myNumbers[] = {25, 50, 75, 100};

a)

None of the above

b)

An array

c)

A class

d)

A pointer