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

C Programming MCQ Without Ans 2024-08-23 04-50-36-837477

The document contains multiple-choice questions (MCQs) related to C programming, covering topics such as output of code snippets, pointers, and bitwise operations. Each question includes several options for answers. The questions test the understanding of C syntax and behavior in various scenarios.

Uploaded by

rengasri13953
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 views3 pages

C Programming MCQ Without Ans 2024-08-23 04-50-36-837477

The document contains multiple-choice questions (MCQs) related to C programming, covering topics such as output of code snippets, pointers, and bitwise operations. Each question includes several options for answers. The questions test the understanding of C syntax and behavior in various scenarios.

Uploaded by

rengasri13953
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 Questions

C programming

Question 1: What is the output of the following C program?


#include <stdio.h>
int main() {
int a = 300, b = 5, c = 10;
printf("%d", a > b < c);
return 0;
}

Options:

1) 1

2) 0

3) 5

4) 300

Question 2: Which of the following statements about pointers is correct in C?

Options:

1) A void pointer can be directly dereferenced.

2) The size of a pointer is always the same as the size of the data type it points to.

3) A pointer can point to an array, and array elements can be accessed via the pointer.

4) The address of a local variable is valid throughout the program.

Question 3: Consider the following code segment:


#include <stdio.h>
void test(int *arr) {
int temp = 10;
arr = &temp;
}
int main() {
int x = 5;
test(&x);
printf("%d", x);
return 0;
}
What is the output?

Options:

1) 5

2) 10

3) Garbage value

4) Compilation error

Question 4: What would be the result of the following C code?


#include <stdio.h>
int main() {
for (int i = 0; i < 5; i++) {
static int num = 5;
num++;
printf("%d ", num);
}
return 0;
}

Options:

1) 6 7 8 9 10

2) 6 6 6 6 6

3) 5 5 5 5 5

4) None of the above

Question 5: What is the output of following C code?


#include <stdio.h>
int main() {
int a = 5, b = 2, c;
c = a^b;
printf("%d", c);
return 0;
}

Options:
1) 7

2) 3

3) 2

4) Error

You might also like