Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C Programming Midterm Review

Total questions: 40

Worksheet time: 20mins

Name
Class
Date
1.

int main()


{


int a = 10, b = 25;


a = b++ + a++;


b = ++b + ++a;


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


}

a)

36 64

b)

35 62

c)

36 63

d)

30 28

2.

int main ()


{


int x = 24, y = 39, z = 45;


z = x + y;


y = z - y;


x = z - y;


printf ("n%d %d %d", x, y, z);


}

a)

24 39 63

b)

39 24 63

c)

24 39 45

d)

39 24 45

3.

Who is Father of C Language

a)

Bjarne Stroustrup

b)

James A. Gosling

c)

Dennis Ritchie

d)

Dr. E.F. Codd

4.

C Language is developed at ___________?

a)

AT & T's Bell Laboratories of USA in 1972

b)

AT & T's Bell Laboratories of USA in 1970

c)

Sun Microsystems in 1973

d)

Cambridge University in 1972

5.

C programs are converted into machine language with the help of

a)

An Editor

b)

A compiler

c)

An operating system

d)

None of these.

6.

Which is the only function all C programs must contain?

a)

start()

b)

system()

c)

printf()

d)

main()

7.

Which of the following is not a correct variable type?

a)

float

b)

real

c)

int

d)

char

8.

int main ()

{

int x = 24, y = 39, z = 45;

z = x + y;

y = z - y;

x = z - y;

printf ("%d %d %d", x, y, z);

}

a)

24 39 63

b)

39 24 63

c)

24 39 45

d)

39 24 45

9.
What punctuation is used to indicate the beginning and end of code blocks?
a)
{ }
b)
-> <-
c)
BEGIN and END
d)
( and )
10.

The process of removing a bug is known as

a)

Debugging

b)

Compilation

c)

Executing

d)

Running

11.

Every C Program Statement must be terminated with a

a)

.

b)

#

c)

;

d)

!

12.

Which of the following is the boolean operator for logical-AND?

a)

&

b)

&&

c)

|

d)

||

13.

All keywords in C are in ____________

a)

Lowercase

b)

Uppercase

c)

Camelcase

d)

None of these

14.

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

a)

int a3;

b)

int 3a;

c)

int _A3;

d)

int a_3

15.

The functions printf() and scanf() are defined in which of the following library file:-

a)

math.h

b)

conio.h

c)

stdio.h

d)

stdlib.h

16.

Which is variable declaration?

a)

int a,b;

b)

c=a+b;

c)

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

d)

scanf("%d%d",&a,&b);

17.
How will you print \n on the screen?
a)
printf("\n");
b)
echo "\\n";
c)
printf('\n');
d)
printf("\\n");
18.
Which of the following is the correct operator to compare two variables?
a)
:=
b)
=
c)
equal
d)
==
19.
Which symbol terminates a C statement?
a)
.
b)
;
c)
,
d)
}
20.
How to comment in C language?
a)
//Comment
b)
A & B
c)
* Comment *
d)
<---Comment---->
21.

Process of writing the C source code is called as ___________________

a)

Editing

b)

LInking

c)

Executing

22.

C programming consists of two section which are _________________ and ___________________

a)

Pre-processor directives ; Main function

b)

Pre-processor directives ; end statement

c)

statements ; Main function

23.
Which one will return an value?
a)
give 1;
b)
rerun 2;
c)
*a = 1;
d)
return 1;
24.
To add a certain amount (often 1), once or many times
a)
Increment
b)
Decrement
c)
Decompose
d)
Automate
25.
Instructions that can be understood and followed by a machine
a)
Data
b)
Program
c)
Automate
d)
Programming
26.

While assigning a value to a variable, which operators are used to perform arithmetic operations?

a)

Logical operator

b)

Assignment operator

c)

Increment operator

d)

Conditional opertor

27.

An Integrated Development Environment typically consists of:

a)

A text editor

b)

A compiler

c)

A debugger

d)

All of these

28.

Computer programs are also known as:

a)

Hardware

b)

Firmware

c)

Software

d)

Silverware

29.

What is the extension of C program source code?

a)

.cpp

b)

.py

c)

.c

d)

.java

30.

What is machine language?

a)

A language used by car

b)

Machine language is made of 1's and 0's

c)

Machine language is made of 7's and 8's

d)

A language that only understands plain English

31.

Which line of code is correct for the statement:

Add 1 variable to x.

a)

x++;

b)

x+1

c)

x+x

32.

Choose a correct C Statement.

a)

a++ is (a=a+1) POST INCREMENT Operator

b)

a-- is (a=a-1) POST DECREMENT Operator

--a is (a=a-1) PRE DECREMENT Operator

c)

++a is (a=a+1) PRE INCREMENT Operator

d)

All the above.

33.

The value 132.54 can be represented using which data type?

a)

double

b)

void

c)

int

d)

bool

34.

Which of the following is the boolean operator for logical-OR?

a)

&

b)

&&

c)

|

d)

||

35.

Which of the following is the boolean operator for logical-NOT?

a)

&

b)

&&

c)

!

d)

||

36.

What does <= mean?

a)

less than

b)

greater than

c)

less than or equal to

d)

greater than or equal to

37.

what data type store whole numbers?

a)

Float

b)

Character

c)

Logical

d)

Integer

38.

Which of the function is more appropriate for reading a multi-word string?

a)

puts()

b)

printf()

c)

scanf()

d)

gets()

39.

How does strings are declared?

a)

1. String name;

b)

Char name [20];

c)

Char name{20};

d)

None of the above

40.

The process of creating a new variable without value.

a)

declaration

b)

naming

c)

instantiation

d)

assigning