wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Basic C

Total questions: 39

Worksheet time: 16mins

Name
Class
Date
1.

Who invented C programming language ?

a)

Ken Thompson

b)

James Gosling

c)

Dennis Ritchie

d)

James Thompson

2.

In C, program execution always starts from ________

a)

int a = 30

b)

#include<stdio.h>

c)

main()

d)

#include<conio.h>

3.

Which of the following are Relational Operators in C?

a)

=

b)

>=

c)

!=

d)

||

4.

In C, what is the correct hierarchy of arithmetic operations?

a)

*/ + -

b)

* +- /

c)

/ *+ -

d)

+ - / *

5.

Which one of the following is correct variable declaration?

a)

coding13

b)

13coding

c)

_CoDiNg_ChAlLeNgE

d)

coding.challenge

6.

Which loop can be used in C language so that the loop gets executed atleast once?

a)

while

b)

for

c)

switch

d)

do while

7.

int a = 1;

int b = 18;

a++;

b--;

what is the value of a and b?

a)

a=2

b=19

b)

a=2

b=17

c)

a=1

b=17

d)

a=1

b=19

8.

How many times the loop will get executed?

for(int i=5;i<=10;i++)

a)

5

b)

6

c)

4

d)

0

9.

which is the correct format specifier for int ?

a)

%c

b)

%i

c)

%d

d)

%int

10.

int a=20;

a%=20;

what is the value of a?

a)

20

b)

1

c)

0

d)

None of the above

11.

A default statement is optional in SWITCH CASE.

true or false?

a)

TRUE

b)

FALSE

12.

Which is the right order

a)

int > char > float

b)

char < int < double

c)

char > int > float

d)

double < char < int

13.

When was the C Language developed?

a)

1970

b)

1972

c)

1975

d)

1976

14.

C program should be written in

a)

Upper case

b)

Title case

c)

lower case

d)

none of these

15.

Every statement in a C program should end with a -------------

a)

Colon(:)

b)

semicolon(;)

c)

comma(,)

d)

fullstop(.)

16.

What is the result of 6%4 ?

a)

4

b)

3

c)

2

d)

1

17.

The symbol of a new line character is -----------------------

a)

\n

b)

\t

c)

\d

d)

\f

18.

Commonly used input function is --------------

a)

scanf()

b)

printf()

c)

getch()

d)

putch()

19.

Commonly used output function is ------------

a)

printf()

b)

scanf()

c)

getch()

d)

none of these

20.

%f specifies ---------------- data type

a)

float

b)

int

c)

char

d)

string

21.

No --------------- is allowed in variable

a)

+ sign

b)

- sign

c)

0

d)

Blank space

22.
How will you print \n on the screen?
a)
printf("\n");
b)
echo "\\n";
c)
printf('\n');
d)
printf("\\n");
23.
Which of the following is not a correct variable type?
a)
float
b)
real
c)
int
d)
double
24.
How to comment in C language?
a)
//Comment
b)
A & B
c)
* Comment *
d)
<---Comment---->
25.

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

a)

int number;

b)

float rate;

c)

int variable_count;

d)

int $main;

26.

All keywords in C are in ____________

a)

LowerCase letters

b)

UpperCase letters

c)

CamelCase letters

d)

None of the mentioned

27.

Which of the following is true for variable names in C?

a)

They can contain alphanumeric characters as well as special characters

b)

It is not an error to declare a variable to be one of the keywords(like goto, static)

c)

Variable names cannot start with a digit

d)

Variable can be of any length

28.

Which of the following is not a logical operator?

a)

&&

b)

!

c)

||

d)

|

29.

How many keywords are there in C language?

a)

30

b)

31

c)

32

d)

33

30.

6. Which of the following cannot be a variable name in C?

a)

volatile

b)

true

c)

friend

d)

export

31.

Which keyword is used to prevent any changes in the variable within a C program?

a)

immutable

b)

mutable

c)

const

d)

volatile

32.

What is the result of logical or relational expression in C?

a)

True or False

b)

0 or 1

c)

0 if an expression is false and any positive number if an expression is true

d)

None of the mentioned

33.

What is #include <stdio.h>?

a)

Preprocessor directive

b)

Inclusion directive

c)

File inclusion directive

d)

None of the mentioned

34.

Which of the following are C preprocessors?

a)

#ifdef

b)

#define

c)

#endif

d)

all of the mentioned

35.

The C-preprocessors are specified with _________ symbol.

a)

#

b)

&

c)

%

d)

*

36.

scanf() is a predefined function in______header file.

a)

stdlib. h

b)

ctype. h

c)

stdio. h

d)

stdarg. h

37.

What will be the output of the following C code?

a)

Compile time error

b)

Hello World! 34

c)

Hello World! 1000

d)

Hello World! followed by a junk value

38.

Which is valid C expression?

a)

int my_num = 100,000;

b)

int my_num = 100000;

c)

int my num = 1000;

d)

int $my_num = 10000;

39.

What will be the final value of x in the following C code?

a)

3.75

b)

Depends on compiler

c)

24

d)

3