0% found this document useful (0 votes)
5 views4 pages

Program MCQ

The document contains a series of C programming questions, each with multiple-choice answers regarding the output of various code snippets. The questions cover topics such as increment operators, loops, conditional statements, and array manipulation. Each question presents a specific code example and asks for the expected output.

Uploaded by

arishkannan941
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)
5 views4 pages

Program MCQ

The document contains a series of C programming questions, each with multiple-choice answers regarding the output of various code snippets. The questions cover topics such as increment operators, loops, conditional statements, and array manipulation. Each question presents a specific code example and asks for the expected output.

Uploaded by

arishkannan941
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

1. What is the output?

#include <stdio.h>

int main() {

int a = 10;

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

return 0;

A) 10 12

B) 10 11

C) 11 12

D) Undefined behavior

2. What is the output?

#include <stdio.h>

int main() {

int i = 0;

while(i < 3) {

printf("%d ", i);

i++;

return 0;

A) 0 1 2

B) 1 2 3

C) 0 1 2 3

D) Infinite loop
3. What is the output?

#include <stdio.h>

int main() {

int x = 5;

if(x = 0)

printf("True");

else

printf("False");

return 0;

A) True

B) False

C) Compilation error

D) Runtime error

4. What is the output?

#include <stdio.h>

int main() {

int a = 5, b = 10;

printf("%d", a > b ? a : b);

return 0;

A) 5

B) 10

C) 0

D) Error
5. What is the output?

#include <stdio.h>

int main() {

int i;

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

printf("%d", i);

return 0;

A) 5

B) 6

C) Infinite loop

D) Compilation error

6. What is the output?

#include <stdio.h>

int main() {

int arr[] = {1, 2, 3, 4};

printf("%d", *(arr + 2));

return 0;

A) 1

B) 2

C) 3

D) 4
7. What is the output?

#include <stdio.h>

int main() {

int a = 2;

switch(a) {

case 1: printf("One");

case 2: printf("Two");

case 3: printf("Three");

return 0;

A) Two

B) TwoThree

C) OneTwoThree

D) Compilation error

8. What is the output?

#include <stdio.h>

int main() {

int i = 5;

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

return 0;

A) 5 5 7

B) 5 6 7

C) Undefined behavior

D) 5 5 6

You might also like