Placement Preparation Questions

Placement Preparation questions are free resources offered by mobiprep that can help you ace any company placement process. We have curated a list of the most important MCQ questions which are asked in most companies such as Infosys, TCS, Wipro, Accenture, etc. The placement preparation questions also have detailed explanations for every question ensuring you revise all the questions with detailed answers and explanations.

Q

1

What is the output of following program #include

a.

15

b.

15.3

c.

Error

d.

None of the above

Correct Answer & Explanation:

b

Implicit coversion is done here to convert into float,hence 15.30 is correct answer.

Q

2

What is the output of following program #include

a.

16.66

b.

16

c.

16.OO

d.

None of the above

Correct Answer & Explanation:

c

both n1 and n2 are integers so in division it ignores the decimal part but as we assigned result as float it prints 16.00

Q

3

Which of the following is invalid floating literal

a.

1.32E+09

b.

-1.61E-03

c.

1.63E+05

d.

1.38E+06

Correct Answer & Explanation:

d

At least a digit must follow the decimal point

Q

4

What is the output of following program #include

a.

333

b.

321

c.

123

d.

111

Correct Answer & Explanation:

b

storage class is auto,as soon as it exit from block variable gets destroyed.

Q

5

What is the output of following program #include

a.

60 62

b.

61 62

c.

60 61

d.

None of the above

Correct Answer & Explanation:

d

60 is displayed then it is incremented to 61.after ++() in first statement it's value is now 62.in ++x it is first increament then displayed .so it changes from 62 to 64 and now 64 is the new value. But due to two increment operator in printf it will display an error

Q

6

What will be the result of 12<<1

a.

OOO11011

b.

OOOO1100

c.

OO110000

d.

11000000

Correct Answer & Explanation:

b

The right shift operator shift all the bits towards right

Q

7

What is the output of following program #include

a.

Hello

b.

Hello will be printed infinite times

c.

Error

d.

None of the above

Correct Answer & Explanation:

b

Hello will be printed infinite times.

Q

8

What will be output if you will compile and execute the following c code? void main(){ int i=320; char *ptr=(char *)&i; printf("%d",*ptr); }

a.

320

b.

1

c.

64

d.

compilation error

Correct Answer & Explanation:

c

char pointer ptr is pointing to only first byte as shown above figure.*ptr i.e. content of first byte is 01000000 and its decimal value is 64.

Q

9

Is there any difference between following declarations? 1 : extern int fun(); 2 : int fun();

a.

Both are identical

b.

No difference, except extern int fun(); is probably in another file

c.

int fun(); is overrided with extern int fun();

d.

None of these

Correct Answer & Explanation:

b

extern int fun(); declaration in C is to indicate the existence of a global function and it is defined externally to the current module or in another file.

Q

10

In the following program where is the variable a getting defined and where it is getting declared? #include

a.

extern int a is declaration, int a = 20 is the definition

b.

int a = 20 is declaration, extern int a is the definition

c.

int a = 20 is definition, a is not defined

d.

a is declared, a is not defined

Correct Answer & Explanation:

a

During declaration we tell the datatype of the Variable.During definition the value is initialized.