0% found this document useful (0 votes)
12 views14 pages

PPS - Unit-3 - MCQ

The document contains 40 multiple choice questions about C programming concepts like loops, functions, recursion, and parameter passing. The questions cover topics like the different types of loops in C, break and continue statements, function definition and calling, recursion, and call by value parameter passing.

Uploaded by

sharmanikki8381
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views14 pages

PPS - Unit-3 - MCQ

The document contains 40 multiple choice questions about C programming concepts like loops, functions, recursion, and parameter passing. The questions cover topics like the different types of loops in C, break and continue statements, function definition and calling, recursion, and call by value parameter passing.

Uploaded by

sharmanikki8381
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Unit 3 MCQ

1. Exit Controlled loop is

(a) while

(b) goto

(c) for

(d) do while

Answer: Option (d)

2. which of the following is not jump statement

(a) break

(b) goto

(c) continue

(d) switch

Answer: Option (d)

3. continue statement cannot be used with

(a) while

(b) switch

(c) for

(d) do while

Answer: Option (b)

4. Which of the following statement is used to break the recursion

(a) return

(b) break

(c) exit

(d) Both b and c

Answer: Option (a)


5. Entry Controlled loop is

(a) while

(b) goto

(c) for

(d) do while

Answer: Option (a,c)

6. What is the output of the following code

void main()

int i = 1;

for(;;)

if(i > 5)

break;

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

(a) 1 2 3 4 5

(b) for loop is incorrect

(c) 1 2 3 4 5 6

(d) no output

Answer: Option (a)

7. Which statement is true about "break" and "continue" statements in C.

(a) "break" and "continue" can be used in "for", "while", "do-while" loop body and "switch"
body.
(b) "break" and "continue" can be used in "for", "while" and "do-while" loop body. But only
"break" can be used in "switch" body.

(c ) "break" and "continue" can be used in "for", "while" and "do-while" loop body. Besides,
"continue" and "break" can be used in "switch" and "if-else" body.

(d) "break" can be used in "for", "while" and "do-while" loop body.

Answer: Option (c)

8. What is the final value of x

int x;

for(x=0; x<10; x++)

{ }

(a) 10

(b) 0

(c) 9

(d) 1

Answer: Option (a)

9.What is the output

void main()

{int i;

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

{ printf(“ %d”, i}

(a) 1 to 10

(b) 11

(c) Error

(d) None

Answer: Option (b)


10. How many time “QUIZ” will be printed?

int main()

int i = 1024;

for (; i; i >>= 1)

printf("QUIZ");

return 0;

(a) 10

(b) 11

(c) infinite

(d) Error

Answer: Option (b)

11. How many times is a do while loop guaranteed to loop?

(a) 0

(b) 1

(c) infinite

(d) not defined

Answer: Option (b)

12. How many times “QUIZ” will be printed?

void main()

for(;;)

{
printf("QUIZ");

break;

(a) 1 time

(b) infinite

(c) No output

(d) compiler error

Answer: Option (a)

13. What is the default return type of any function

(a) float

(b) int

(c) void

(d) double

Answer: Option (b)

14. Choose the correct statement.

I. A function returns only one value

II. A function default type is void

III. main() is same as int main()

IV. If a function is not returning any value then it should be int type

(a) I,II,III

(b) I,II,IV

(c) I,II,IV

(d) I,III
Answer: Option (d)

15. Types of function in C

(a) Library functions

(b) User defined function

(c) Both a and b

(d) None

Answer: Option (c)

16. Choose the correct statement about call by value

(a) Pass By Value copies the variable value in one more memory location.

(b) Pass By Value does not use Pointers.

(c) Pass By Value protects your source or original variables from changes in outside
functions or called functions.

(d) All of the above

Answer: Option (d)

17. A program must have at least

(a) one function

(b) two function

(c) no function

(d) n no of function

Answer: Option (a)

18. which statement is used to transfer back the control to the calling function

(a) back

(b) goto

(c) return

(d) switch

Answer: Option (c)


19. What is the output?

void main()

int i = 0, n = 0;

do

if(i % 5 == 0)

printf("%d",n);

n++;

++i;

}while(i<10);

printf("%d",n);

(a) 01

(b) 12

(c) 012

(d) No output

Answer: Option (c)

20 What is the output?

#include<stdio.h>

int main()

{printf("Hello");

main();
return 0;

(a) infinite times

(b) Till stack overflow

(c) no output

(d) one time

Answer: Option (a)

21. Memory is allocated to the function when

(a) function is defined

(b) function is declared

(c) function is called

(d) function is returned

Answer: Option (a)

22. The name of a function is global

(a) true

(b) false

Answer: Option (a)

23. What is the output?


void main()

{ int i=0;

char c='0';

while(i<10)

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

i++;}

}
(a) 0123456789

(b) 123456789

(c) opqrstuvw

(d) None

Answer: Option (a)

24. Which variable retains its value between function call

(a) auto

(b) static

(c) register

(d) extern

Answer: Option (b)

25.A function can be defined in main

(a) true

(b) false

Answer: Option (b)

26. If a function explicitly calls itself than it is called

(a) Indirectly recursive

(b) Directly recursive

(c) Tree

(d) Trail

Answer: Option (b)

27. Recursion follows a top down approach to problem solving

(a) True

(b) False

Answer: Option (a)


29. What is the output?

#include<stdio.h>

void main()

{ static int i=4;

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

if(i)

main();

(a) 4444

(b) 3210

(c) infinite

(d) 4321

Answer: Option (d)

30. The recursive function are executed in.

(a) FIFO order

(b) Queue

(c) LIFO

(d) Tree

Answer: Option (c)

31. void main()

int fun();

int i;

i = fun();

printf("%d\n", i);
}

int fun()

int _AX = 1990;

return(_AX);

(a) 0

(b) garbage

(c) no output

(d) 1990

Answer: Option (d)

32. void Test(int, int*);

int main()

int i=5, j=2;

Test(i, &j);

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

return 0;

void Test(int i, int *j)

i = i*i;

*j = *j**j;

(a) 5,4
(b) 25,4

(c) 5,2

(d) Error

Answer: Option (a)

33.Function Declaration statement identifies a function with its

(a) Name

(b) return type

(c) argument

(d) all of the above

Answer: Option (d)

34. It is necessary to have initialization,testing, and updating expression within the for
statement

(a) True

(b) false

Answer: Option (b)

35. do while loop is post tested loop

(a) True

(b) False

Answer: Option (a)

36. Output?

void main()

int i=5;

for(i=1;i<=10;i++)

{ if(i==5)
continue;

printf("%d", i);

}}

(a) 12346789110

(b) Error

(c) No output

(d) 1

Answer: Option (a)

37. Functions can return structure in c?

(a) Yes

(b) No

(c) Maybe

(d) Cannot say

Answer: Option (a)

38. Which of the following statement is used to skip some statements in the loop.

(a) break

(b) goto

(c) continue

(d) switch

Answer: Option (c)

39. Semicolon after for loop produce error

(a) true

(b) False

(c) May be

(d) Cannot say


Answer: Option (b)

40. By default how the value is passed in c

(a) call by reference

(b) call by value

(c) call by pointer

(d) None

Answer: Option (b)

You might also like