wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

AI-Quiz2

Total questions: 80

Worksheet time: 1hrs 5mins

Name
Class
Date
1.
a)

/

b)

%

c)

bitwise operator

d)

*

2.
a)

-1 1

b)

1 -1

c)

-1 -1

d)

1 1

3.
a)

14

b)

11

c)

12

d)

13

4.
a)

10 5 3 4

b)

10 5 4 4

c)

10 5 3 3

d)

10 5 4 3

5.

Find The Output

int a = 3;

printf("%d %d %d %d", a , a++ ,a, a);

(a)  

6.

int a = 10;

int b = a++ + ++a;

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

(a)  

7.

int a = 3;

printf("%d %d %d %d",++a , a++ ,a, --a);

(a)  

8.



(a)  

9.
a)

14 8

b)

3 8

c)

3 7

d)

4 8

10.
a)

50 10 24 50

b)

50 13 24 50

c)

50 13 24 13

d)

50 13 11 13

11.



(a)  

12.



(a)  

13.



(a)  

14.

a)

44

b)

55

c)

1510

d)

error

15.
a)

4

b)

40

c)

1

d)

10

16.
a)

20

b)

10

c)

9

d)

1

17.
a)

Hello

b)

World

c)

1

d)

0

18.
a)

4 4

b)

4 1

c)

1 4

d)

1 1

19.



(a)  

20.
a)

-65535 -65535

b)

65535 -65536

c)

-65535 65535

d)

65535 65535

21.

Operator % in C Language is called.?

a)

Percentage Operator

b)

Quotient Operator

c)

Modulus

d)

Division

22.

Which of the following is not logical operator?

a)

&

b)

||

c)

!

d)

&&

23.

Which operator performs operations on data in Binary Level.

a)

Logical operator

b)

Bitwise operator

c)

Conditional operator

d)

None

24.

#include <stdio.h>

int main()

{

int a=10, b;

b=a%3;

printf("%d",b);

return 0;

}

a)

0

b)

2

c)

4

d)

1

25.

int a = 3.5 + 4.5;

a)

a = 0

b)

a = 7

c)

a = 8.0

d)

a = 8

26.

The size of character variable in c

a)

2 byte

b)

5 byte

c)

8 byte

d)

1 byte

27.

#include <stdio.h>

int main(){

int x= 5*9/3+9;

printf("%d",x);

return 0;

}

a)

8

b)

24

c)

25

d)

None

28.

#include <stdio.h>

int main(){

int x= 5%2 *3/2;

printf("%d",x);

return 0;

}

a)

1

b)

2

c)

3

d)

99

29.

Pickup odd one out

a)

a=a+1;

b)

a+=1

c)

a++

d)

a=+1

30.

int main()

{

float c = 3.5 + 4.5;

printf("%f", c);

return 0;

}

a)

7

b)

8

c)

9

d)

8.000000

31.

Which of the following correctly shows the hierarchy of arithmetic operations in C?

a)

/ + * -

b)

* - / +

c)

+ - / *

d)

/ * + -

32.

Which of the following is the correct usage of conditional operators used in C?

a)

a>b ? c=30 : c=40;

b)

a>b ? c=30;

c)

max = a>b ? a>c?a:c:b>c?b:c

d)

return (a>b)?(a:b)

33.

What is a format specifier in C language.?

a)

A format Specifier tells compiler to treat a variable value is predefined way.

b)

Different format specifiers are used to print different type of data.

c)

Format specifiers are used to write data to files in a formatted way.

d)

All the above

34.

Which among the following is the odd one out?

a)

printf

b)

fprintf

c)

putchar

d)

scanf

35.

For a typical program, the input is taken using _________

a)

scanf

b)

Files

c)

Command-line

d)

All of the mentioned

36.

What is the value of EOF?

a)

-1

b)

1

c)

0

d)

10

37.

What is the use of getchar()?

a)

The next input character each time it is called

b)

EOF when it encounters end of file

c)

The next input character each time it is called EOF when it encounters end of file

d)

None of the mentioned

38.

What is the return value of putchar()?

a)

The character written

b)

EOF if an error occurs

c)

Nothing

d)

Both character written & EOF if an error occurs

39.

Choose a C Formatted Input Output function below.

a)

printf(), scanf()

b)

sprintf(), sscanf()

c)

fprintf(), fscanf()

d)

All the above

40.

Choose a correct C statement.?

a)

SCANF can accept all types of data from keyboard including numbers and strings

b)

GETS can accept only one String of any length and any number of words. GETCHAR can accept only one character constant from keyboard.

c)

SCANF can accept only single word Strings

d)

All the above

41.

Constants in C can be divided into categories ?

a)

3

b)

6

c)

2

d)

4

42.

______not a primary constant.

a)

Integer Constant

b)

Real constant

c)

Character constant

d)

Enum constant

43.

What is constant?

a)

Constants have fixed values that do not change during the execution of a program

b)

Constants have fixed values that change during the execution of a program

c)

Constants have unknown values that may be change during the execution of a program

d)

None of the above

44.

Which is the right way to declare constant in C?

a)

int constant var =10;

b)

int const var = 10;

c)

const int var = 10;

d)

B & C Both

45.

Which operators are known as Ternary Operator?

a)

::, ?

b)

?, :

c)

?, ;;

d)

None of the above

46.

What is the default return-type of getchar()?

a)

char

b)

int

c)

char *

d)

reading character doesn’t require a return-type

47.

What is the return value of putchar()?

a)

The character written

b)

EOF if an error occurs

c)

Nothing

d)

Both character written & EOF if an error occurs

48.

Which of the following is example of relational operator in C language?

a)

<

b)

>

c)

!=

d)

all the above

49.

!= is the example of ____________________ operator.

a)

Relational

b)

Logical

c)

Assignment

d)

Conditional

50.

Choose a C Formatted Input Output function below.

a)

printf(), scanf()

b)

sprintf(), sscanf()

c)

fprintf(), fscanf()

d)

All the above

51.
A console is a command line interface to take inputs from stdin and display outputs in stdout. Which of the following constitute console?
a)
The Mouse, The Keyboard
b)
The CPU , The Mouse
c)
The Screen, The Keyboard
d)
The CPU, The Screen
52.
C language has, scanf and printf as built-in I/O functions. To which category does scanf() function belong to?
a)
Un-Formatted Input Function
b)
Formatted Input Function
c)
Un-Formatted Output Function
d)
Formatted Output Function
53.
C language has, scanf and printf as built-in I/O functions. To which category does print() function belong to?
a)
Un-Formatted Input Function
b)
Formatted Input Function
c)
Un-Formatted Output Function
d)
Formatted Output Function
54.
Format specifier tells compiler the datatype of the variable. What format specifier is used for signed int datatype?
a)
%lf
b)
%f
c)
%ld
d)
%d
55.
Format specifier tells compiler the datatype of the variable. What format specifier is used for signed long int datatype?
a)
%lf
b)
%f
c)
%ld
d)
%d
56.
Format specifier tells compiler the datatype of the variable. What format specifier is used for float datatype?
a)
%lf
b)
%f
c)
%ld
d)
%d
57.
Format specifier tells compiler the datatype of the variable. What format specifier is used for double datatype?
a)
%lf
b)
%f
c)
%ld
d)
%d
58.
Format specifier tells compiler the datatype of the variable. What format specifier is used for char datatype?
a)
%c
b)
%d
c)
%f
d)
%s
59.
Format specifier tells compiler the datatype of the variable. What format specifier is used for string datatype?
a)
%c
b)
%d
c)
%f
d)
%s
60.

What is the output of the code,

printf("%06.2f", 6.66666);

a)
6.66667
b)
6.66666
c)
006.66
d)
006.67
61.

What is the output of the code,

printf("%6.3f", 66666.66666);

a)
66.667
b)
66666.667
c)
66666.6
d)
666.666
62.
In the printf("%-10.4f", a); statement,what does the (-) sign represent?
a)
printing - sign before the value of a
b)
subtracting 10 from the value of variable a
c)
right justification
d)
left justification
63.

What is the output of the code,

printf("%.3s", "hellohere");

a)
hel
b)
hellohere
c)
ere
d)
helloh.ere
64.
Escape sequences in c language are also called as ____________
a)
Frontslash characters
b)
Backslash characters
c)
Backspace Characters
d)
Shift Characters
65.
We want to print : I secured 60%. Which is the correct statement? \' is an escape sequence representing _____________
a)
int a = 60;<br />printf("%d", a%);
b)
int a = 60%;<br />printf("%d", a);
c)
int a = 60;<br />printf("%d%%",a);
d)
int a = 60;<br />printf("%d%%",a, %);
66.

What is the output of the statement?

printf("marks \\ total");

a)
marks \ total
b)
marks \\ total
c)
marks total
d)
Error
67.
What is the input function that reads a single character, the instant it is typed, without waiting for the Enter key to be hit.
a)
scanf()
b)
gets()
c)
getchar()
d)
getch()
68.
What is the input function that reads a single character, and displays it on the screen, the instant it is typed, without waiting for the Enter key to be hit.
a)
getch()
b)
getche()
c)
getchar()
d)
gets()
69.
What is the input function that reads a single character, and displays it on the screen, but it needs the Enter key to be hit.
a)
getch()
b)
getche()
c)
getchar()
d)
gets()
70.
The program needs to read "I have input data" typed by keyboard. Which fuction, should be used for this?
a)
getch()
b)
getche()
c)
getchar()
d)
gets()
71.
The program needs to output "I have received data" to the monitor. Which fuction, should be used for this?
a)
gets()
b)
puts()
c)
getch()
d)
putch()
72.
When the instructions are executed in the same order, as they appear in a program, then such control of instruction is called as ______________
a)
Sequence Control Instruction
b)
Selection or Decision Control Instruction
c)
Repetition or Loop Control Instruction
d)
Case Control Instruction
73.
Which of the following is used for writing a decision making statement?
a)
for
b)
while
c)
do…while
d)
if
74.
Which of the following is used for bi-directional control statement?
a)
while
b)
if - else
c)
do…while
d)
for
75.
Which of the following is used for multi-directional control statement?
a)
while
b)
if
c)
switch
d)
for
76.

What will be the output for the following program?

void main()

{

int a=300,b,c;

if(a>=400)

b=300;

c=200;

printf(“\n%d ,%d”,b,c);

}

a)
300, 200
b)
200, 200
c)
garbage value,200
d)
garbage value, garbage value
77.

What will be the output for the following program?

void main()

{

int a=500,b,c;

if(a>=400)

b=300;

c=200;

printf(“\n%d ,%d”,b,c);

}

a)
300, 200
b)
200, 200
c)
garbage value,200
d)
garbage value, garbage value
78.

What will be the output for the following program?void main()

{

int i=65;

char j=’A’;

if(i==j)

printf(“BETA”);

else

printf(“Bye”);

}

a)
Bye
b)
BETA
c)
No output
d)
garbage value
79.

What will be the output for the following program?

void main()

{

int i=5;

if (i = 4)

printf(“The value of i is 5”);

else

printf(“The value of i is not 5”);

}

a)
The value of i is 5
b)
Garbage value
c)
The value of i is not 5
d)
Error
80.
What is the ASCII value for "ESC" key?
a)
13
b)
14
c)
27
d)
26