wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Technical MCQ

Total questions: 45

Worksheet time: 23mins

Name
Class
Date
1.

The format identifier ‘%i’ is also used for which data type?

a)

char

b)

int

c)

float

d)

double

2.

What is the size of an int data type?

a)

4 Bytes

b)

8 Bytes

c)

Depends on the system/compiler

d)

Cannot determine.

3.

Which is correct with respect to the size of the data types?

a)

char > int > float

b)

int > char > float

c)

char < int < double

d)

double > char > int

4.

What is the precedence of arithmetic operators (from highest to lowest)?

a)

%, *, /, +, –

b)

%, +, /, *, –

c)

+, -, %, *, /

d)

%, +, -, *, /

5.

Which of the following is a correct format for declaration of function?

a)

return-type (argument type)function-name;

b)

return-type function-name(argument type);

c)

return-type function-name(argument type) {}

d)

No idea!

6.

What is the default return type if it is not specified in function definition?

a)

void

b)

int

c)

double

d)

short int

7.

What are the different ways to initialize an array with all elements as zero?

a)

int array[5] = {};

b)

int array[5] = {0};

c)

int a=0, b=0, c=0; int array[5] = {a, b, c};

d)

All of the mentioned.

8.

How many times i value is checked in the following C code?

#include <stdio.h>

int main()

{ int i = 0;

  do {

   i++;

   printf("in while loop\n");

   } while (i < 3);  }

a)

2

b)

3

c)

4

d)

1

9.

Who is the father of C language?

a)

Steve Jobs

b)

James Gosling

c)

Dennis Ritchie

d)

Rasmus Lerdorf

10.

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

a)

int number;

b)

float rate;

c)

int variable_count;

d)

int $main;

11.

All keywords in C are in ____________

a)

LowerCase letters

b)

UpperCase letters

c)

CamelCase letters

d)

None of the mentioned

12.

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;

a)

int my_num = 100,000;

b)

int my_num = 100000;

c)

int my num = 1000;

d)

int $my_num = 10000;

13.

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

a)

immutable

b)

mutable

c)

const

d)

volatile

14.

What is an example of iteration in C?

a)

for

b)

while

c)

do-while

d)

all of the mentioned

15.

What is #include <stdio.h>?

a)

Preprocessor directive

b)

Inclusion directive

c)

File inclusion directive

d)

None of the above

16.

The C-preprocessors are specified with _________ symbol.

a)

#

b)

$

c)

%

d)

None of the above.

17.

The standard header _______ is used for variable list arguments (…) in C.

a)

<stdio.h >

b)

<stdlib.h>

c)

<math.h>

d)

<stdarg.h>

18.

What is the sizeof(char) in a 32-bit C compiler?

a)

1 bit

b)

2 bits

c)

1 Byte

d)

2 Bytes

19.

What will be the output of the following C code?

#include <stdio.h>

int main()

{

int y = 10000;

int y = 34;

printf("Hello World! %d\n", y);

return 0;

}

a)

Compile time error

b)

Hello World! 34

c)

Hello World! 1000

d)

Hello World! followed by a junk value

20.

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

#include <stdio.h>

void main()

{

int x = 5 * 9 / 3 + 9;

}

a)

3.75

b)

Depends upon compiler

c)

24

d)

3

21.

What are the elements present in the array of the following C code?

int array[5] = {5};

a)

5, 5, 5, 5, 5

b)

5, 0, 0, 0, 0

c)

5, (garbage), (garbage), (garbage), (garbage)

d)

(garbage), (garbage), (garbage), (garbage), 5

22.

What are true about Array in C language.?

a)

A group of elements of same data type.

b)

An array contains more than one element

c)

Array elements are stored in memory in continuous or contiguous locations

d)

All the above.

23.

An array Index starts with.?

a)

-1

b)

0

c)

1

d)

2

24.

What is the output of the following code snippet?

int main()

{ int sum = 2 + 4 / 2 + 6 * 2;

printf("%d", sum);

return 0;

}

a)

2

b)

15

c)

16

d)

18

25.

What is the output of the following code?

#include <stdio.h>

int main()

{

    int i = 3;

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

    return 0;

}

a)

3

b)

4

c)

5

d)

Compile time error

26.

What is the output of this statement "printf("%d", (a++))"?

a)

The value of (a + 1)

b)

The current value of a

c)

Error message

d)

Garbage Value

27.

What does this declaration mean?

int x: 4;

a)

X is a four-digit integer.

b)

X cannot be greater than a four-digit integer.

c)

X is a four-bit integer.

d)

None of the these

28.

How many times will the following loop execute?

for(j = 1; j <= 10; j = j-1)  

a)

forever

b)

never

c)

0

d)

1

29.

Which one of the following is a loop construct that will always be executed once?

a)

for

b)

while

c)

switch

d)

do-while

30.

How many characters can a string hold when declared as follows?

char name[20]:  

a)

19

b)

20

c)

Can't determine

d)

18

31.

What will the result of num1 variable after execution of the following statements?

int j = 1, num1 = 4;  

while (++j <= 10)  

{  

  num1++;  

}  

a)

11

b)

12

c)

13

d)

14

32.

Let p1 be an integer pointer with a current value of 2000. What is the content of p1 after the expression p1++ has been evaluated?

a)

2001

b)

2002

c)

2004

d)

2008

33.

What will be the output of this program?

int main()      

{      

int a=10, b=20;        

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

a=a+b;      

b=a-b;      

a=a-b;      

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

return 0;    

}     

a)

a = 20, b = 20

b)

a = 10, b = 20

c)

a = 20, b = 10

d)

a = 10, b = 10

34.

What does this statement mean?

x - = y + 1;  

a)

x = x - y + 1

b)

x = -x - y - 1

c)

x = x + y - 1

d)

x = x - y - 1

35.

Array is a _________ data structure.

a)

Non-linear

b)

Primary

c)

Linear

d)

Non-primary

36.

Study the following statement

printf ("%d", 9/5);  

What will be the output of this statement?

a)

1.8

b)

1.2

c)

1.5

d)

None of the aove

37.

A global variable is declared __________.

a)

Outside of the function

b)

Inside of the function

c)

With the function

d)

Anywhere in the program

38.

Who defines the user-defined function?

a)

Computer

b)

compiler

c)

Users

d)

None

39.

The enum keyword is used to assign names to the ________ constants.

a)

Integer

b)

String

c)

Character

d)

All of the above

40.

Which of the following is not an arithmetic operation?

a)

x * = 65;

b)

x / = 42;

c)

x % = 2;

d)

x ! = 56;

41.

Which of the following operator is represented a relational operation?

a)

==

b)

++

c)

||

d)

&&

42.

Which of the following keyword is used for union in c language?

a)

un

b)

uni

c)

ion

d)

union

43.

Study the following program:

main ()  

{  

 char x;  

 x = 'A' + 5;  

 printf("%c", x);  

}  

a)

A+5

b)

A

c)

F

d)

E

44.

Which one of the following operators is a unary operator in c language?

a)

&

b)

&&

c)

<<

d)

sizeof()

45.

How many types of variables are there in the C language?

a)

2

b)

4

c)

5

d)

3