0% found this document useful (0 votes)
75 views3 pages

MCQ of C

The document contains 10 multiple choice questions about C programming concepts. Some of the concepts covered in the questions include: - The results of logical/relational expressions in C - The continue keyword and what it is used for - How many times a condition is checked in a while loop - What is passed when an array is passed as a function argument - The output of a bitwise operation example - Keywords that can be used to exit recursion - Functions for reading input from a file - Whether a code sample with a missing statement would compile - The purpose of the file open mode "w+" - What the "a" means in a file open operation

Uploaded by

bhesh chaudhary
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)
75 views3 pages

MCQ of C

The document contains 10 multiple choice questions about C programming concepts. Some of the concepts covered in the questions include: - The results of logical/relational expressions in C - The continue keyword and what it is used for - How many times a condition is checked in a while loop - What is passed when an array is passed as a function argument - The output of a bitwise operation example - Keywords that can be used to exit recursion - Functions for reading input from a file - Whether a code sample with a missing statement would compile - The purpose of the file open mode "w+" - What the "a" means in a file open operation

Uploaded by

bhesh chaudhary
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/ 3

MCQ of C Programming [ 1 x 10 =10]

1. What is the result of logical or relational expression in C?


a) True or False
b) 0 or 1
c) 0 if an expression is false and any positive number if an expression is true
d) None of the mentioned

2. Which keyword is used to come out of a loop only for that iteration?
a) break b) continue c) return d) void
3. How many times i value is checked in the following C program?

#include <stdio.h>
int main()
{
int i = 0;
while (i < 3)
i++;
printf("In while loop\n");
}

a) 2

b) 3

c) 4

d) 1

4. In C, if you pass an array as an argument to a function, what actually gets passed?


a) Value of elements in an array.
b) First element in an array.
c) The address of first element in an array.
d) The address of last element in an array.

5. What will be the output of the following C code?

#include <stdio.h>

int main()

int c = 2 ^ 3;

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

a) 1

b) 8

c) 9

d) 0

6. Which keyword can be used for coming out of recursion?

a) break

b) return

c) exit

d) both break and return

7. Which function is used to record input from file?


a) ftell()
b) fwrite()
c) fprintf()
d) fread()

8. Will the following C code compile without any error?

#include <stdio.h>
int main()
{
for (int k = 0; k < 10; k++);
return 0;
}

a) Yes

b) No

c) Depends on the C standard implemented by compilers

d) Error
9. What is the function of the mode ‘ w+’?

a) create text file for writing, discard previous contents if any

b) create text file for update, discard previous contents if any

c) create text file for writing, do not discard previous contents if any

d) create text file for update, do not discard previous contents if any

10. What is meant by ‘a’ in the following C operation?


fp = fopen("Random.txt", "a");
a) Attach
b) Append
c) Apprehend
d) Add

You might also like