wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CPR_Midterm online Exam

Total questions: 20

Worksheet time: 30mins

Name
Class
Date
1.

Programs are converted into machine language with the help of

a)

Editor

b)

Operating system

c)

Compiler

d)

None of the above

2.

What should be the output:

int main()

{

int a = 20%3;

printf("%d",a);

return 0;

}

a)

6.66

b)

6

c)

2

d)

0

3.

Which loop is most suitable to first perform the operation and then test the condition?

a)

for loop

b)

while loop

c)

do while loop

d)

None of the above

4.

What is the output of C Program.?

int main()

{

int a=25;

while(a <= 27)

{

printf("%d ", a);

a++;

}


return 0;

}

a)

25 25 25

b)

Compiler error

c)

25 26 27

d)

27 27 27

5.

Which of the following correctly accesses the ninth

element stored in arr, an array with 100 elements?

a)

arr[6]

b)

arr[8]

c)

arr[9]

d)

arr[10]

6.

What is the output of C Program with Strings.?

int main()

{

char a[]={'H','E','L','L','O'};

printf("%s",a);

return 0;

}

a)

HELLO\0

b)

H

c)

HELLO

d)

hello

7.

Space required in memory to store character data is-----byte

a)

4 byte

b)

2 byte

c)

1 byte

d)

0 byte

8.

'x--' is which type of operator?

a)

post decrement

b)

pre increment

c)

post increment

d)

pre decrement

9.

What is the output of C Program with arrays.?

int main()

{

int rollno[3]=[1001,1002,1003];

printf("%d",rollno[2]);

}

a)

0

b)

1002

c)

1001

d)

1003

10.

Which of the following operator takes only integer operands?

a)

+

b)

/

c)

*

d)

%

11.

What will be the output of following program ?

#include <stdio.h>

void main()

{

int i=1;

do

{

printf("%d,",i);

i=i+1;

}while(i>=10);

printf("\nAfter loop i=%d",i);

}

a)

1

After loop i=1

b)

1

After loop i=2

c)

After loop i=2

d)

none of the above

12.

What is the dimension of the array int a[10][5].?

a)

10

b)

1

c)

2

d)

5

13.

What is a String in C Language.?

a)

String is a new Data Type in C

b)

String is an array of Characters with null

character as the last element of array.

c)

String is an array of Characters with null

character as the first element of array

d)

String is an array of Integers with 0 as the

last element of array

14.

What is the output of C Program with switch statement.?


int main()

{

int a=3;

switch(a)

{

case 1: printf("Hello"); break;

case 2: printf("Zero "); break;

case 3: printf("You are right");break;

case default: printf("Rabbit ");

}

}

a)

Rabbit

b)

Zero

c)

Hello

d)

You are right

15.

How many choices are possible when using a single if-else statement?

a)

1

b)

2

c)

3

d)

4

16.

Above shape is used in flowchart

a)

for start and stop

b)

to indicate operation

c)

to take decision

d)

perform input or output operation

17.

What is the function of escape sequence'\t'

a)

Horizontal tab

b)

Backspace

c)

Newline

d)

Single quote

18.

what will be the output of the program?

#include<stdio.h>

#include<string .h>

void main()

{

char str1[20]="Welcome ", str2="to class";

strcat(str1,str2);

puts(str1);

return0;

}

a)

to class

b)

to

c)

Welcome

d)

welcome to class

19.

What is the output of C program.?


int main()

{

float marks[3] = {90.5, 92.5, 96.5};

int a=0;

while(a<3)

{

printf("%.f,", marks[a]);

a++;

}

}

a)

90 92 96

b)

90.50 92.50 96.50

c)

0.00 0.00 0.00

d)

Compiler error

20.

What is output of the program?


int main()

{

int i,j,count;

count=0;

for(i=0; i<5; i++)

{

for(j=0;j<5;j++)

{

count++;

}

}

printf("%d",count);

return 0;

}

a)

5

b)

20

c)

25

d)

10