top of page
  • Facebook
  • Twitter
  • Instagram

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

11

When we mention the prototype of a function?

a.

Defining

b.

Declaring

c.

Prototyping

d.

Calling

Correct Answer & Explanation:

b

A function prototype in C or C++ is a declaration of a function that omits the function body but does specify the function's name, argument types and return type.

Q

12

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

a.

/ + * -

b.

* - / +

c.

+ - / *

d.

/ * + -

Correct Answer & Explanation:

d

Simply called as BODMAS (Bracket of Division, Multiplication, Addition and Subtraction).

Q

13

Which of the following is the correct order if calling functions in the below code? a = f1(23, 14) * f2(12/4) + f3();

a.

f1, f2, f3

b.

f3, f2, f1

c.

Order may vary from compiler to compiler

d.

None of above

Correct Answer & Explanation:

c

Here, in which order the functions would be called is undefined.

Q

14

In C all functions except main() can be called recursively.

a.

TRUE

b.

FALSE

c.

None

d.

None

Correct Answer & Explanation:

b

Any function including main() can be called recursively.

Q

15

In which header file is the NULL macro defined?

a.

stdio.h

b.

stddef.h

c.

stdio.h and stddef.h

d.

math.h

Correct Answer & Explanation:

c

The macro "NULL" is defined in locale.h, stddef.h, stdio.h, stdlib.h, string.h, time.h, and wchar.h.

Q

16

How will you print \n on the screen?

a.

printf("\n");

b.

echo "\\n";

c.

printf('\n');

d.

printf("\\n");

Correct Answer & Explanation:

d

The statement printf("\\n"); prints '\n' on the screen.

Q

17

Which of the following function is used to find the first occurrence of a given string in another string?

a.

strchr()

b.

strrchr()

c.

strstr()

d.

strnset()

Correct Answer & Explanation:

c

The function strstr() Finds the first occurrence of a substring in another string

Q

18

Which of the following operations can be performed on the file "A.TXT" using the below code? FILE *fp; fp = fopen("A.TXT", "r+");

a.

Reading

b.

Writing

c.

Appending

d.

Read and Write

Correct Answer & Explanation:

d

r+ Open an existing file for update.

Q

19

Which files will get closed through the fclose() in the following program? #include

a.

"A.C" "B.C" "C.C"

b.

"B.C" "C.C"

c.

"A.C"

d.

Error in fclose()

Correct Answer & Explanation:

d

Extra parameter in call to fclose().

Q

20

Pick the correct statements. I. The body of a function should have only one return statement. II. The body of a function may have many return statements. III. A function can return only one value to the calling environment. IV. If return statement is omitted, then the function does its job but returns no value to the calling environment.

a.

I and II

b.

I and III

c.

II and III

d.

II anf IV

Correct Answer & Explanation:

c

II and III

bottom of page