wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

day5

Total questions: 21

Worksheet time: 12mins

Name
Class
Date
1.

What will the result of 'num' variable after execution of the following statements?

int num = 58;

num % = 11;

a)

3

b)

5

c)

8

d)

11

2.

int main()


{


char arr[7]="Network";


printf("%s", arr);


return 0;


}

a)

Network

b)

N

c)

Garbage Value

d)

Compilation error

3.

#include<stdio.h>

int main()

{

float a=0.7;

if(a<0.7)

{

printf("C");

}

else

{

printf("C++");

}

}

a)

C

b)

C++

c)

Compilation Error

d)

None of the these

4.

int main()


{


int a = 1, b=2, c=3;


char d = 0;


if(a,b,c,d)


{


printf("EXAM");


}


}

a)

No Output and No Error

b)

EXAM

c)

Run time error

d)

Compile time error

5.

What will be output of the following c program?

#include<stdio.h>

int main()

{

int max-val=100;

int min-val=10;

int avg-val;

avg-val = max-val + min-val / 2;

printf("%d",avg-val);

}

a)

55

b)

105

c)

60

d)

Compilation error

6.

Input/output function prototypes and macros are defined in which header file?

a)

conio.h

b)

stdlib.h

c)

stdio.h

d)

dos.h

7.

The "\n" character does which of the following operations?

a)

Double line spacing

b)

Character deletion

c)

Character backspace

d)

Places cursor on the next line

8.

The switch statement takes a given integer value then seeks a matching value among a number of _______ statements.

a)

break

b)

case

c)

switch

d)

goto

9.

Which of the following is an exit control statement

a)

for

b)

while

c)

do while

d)

continue

10.

What will be the output of following program ?

a)

Hello

b)

ERROR

c)

No Output

d)

Garbage Value

11.

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

a)

APACHE HEROHONDA

b)

HEROHONDA

c)

No Output

d)

Compiler error

12.

What is output of below program?


int main()

{

int i;

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

{

printf("Hello");

}

return 0;

}

a)

Hello is printed 5 times

b)

Compilation Error

c)

Hello is printed 2 times

d)

Hello is printed 3 times

13.

What will be the output of following program?

a)

Hello

b)

OK

c)

Hello

OK

d)

Error

14.

What does the following code fragment write to the monitor?

a)

Under

b)

Over

c)

Under the limit

d)

Over the limit

15.

#include<stdio.h>

int main()

{

char j=1;

while(j < 5)

{

printf("%d, ", j);

j = j+1;

}

printf("\n");

return 0;

}

a)

1 2 3 ... 127

b)

1 2 3 ... 255

c)

1 2 3 ... 127 128 0 1 2 3 ... infinite times

d)

1, 2, 3, 4

16.

What will print?

a)

s

b)

m

c)

d

d)

e

17.

What will print?

a)

10

b)

20

c)

30

d)

40

18.

What will print?

a)

20

b)

40

c)

60

d)

50

19.
How can you fetch data from the array?
a)
using index
b)
using value
c)
using arrayname
d)
using operator
20.

What is the output of this C code?


int main()

{

int i = -5;

int k = i %4;

printf("%d\n", k);

}

a)

Compile time error

b)

-1

c)

1

d)

None

21.

Is this quiz helping you to improve technical skills

a)

yes

b)

no