Programming MCQs

Solved MCQ on C Programming Language set-5

Pinterest LinkedIn Tumblr
Here is the collection of solved MCQ on C programming language includes the solved MCQ questions on writing the output of sample program in fundamentals of C programming.

1. What will be output of the following C program? #include int main() {int goto=5; printf(“%d”,goto); return 0;}
A) 5
B) 10
C) **
D) compilation error

2. Output of the following C program fragment is. x=5; y=x++; printf(“%d %d”, x,y);
A) 5, 6
B) 5, 5
C) 6, 5
D) 6, 6

3. What will be output of the following C program? #include int xyz=10; int main() { int xyz=20; printf(“%d”, xyz); return 0;}
A) 10
B) 20
C) 30
D) compilation error

4. Following program fragment. main(){ printf(“%pn”, main( ) ); }
A) Prints the address of main function
B) Prints 0
C) Is an error
D) In an infinite loop

5. What will be output of the following program? #include int main() {int a=2, b=7, c=10; c=a==b; printf(“%d”,c); return 0;}
A) 0
B) 7
C) 10
D) 2

6. What is the output of the following program segment? main( ) { long i=65536; printf(“%dn”, i); }
A) 0
B) 65536
C) -1
D) 65

Read Also: Objective Questions of C with answer

7. What will be the output of the program? # include int main() {int a[5]={5,1,15,20,25}; int i, j, m; i=++a[1]; j=a[1]++; m=a[i++]; printf(“%d, %d, %d”, i,j,m); return0;}
A) 2, 1, 15
B) 1, 2, 5
C) 3, 2, 15
D) 2, 3, 20

8. What is the output of the following program segment? main( ) { int=1; do { printf(“%d . . “, i); } while (i–); }
A) 0 . . 1 . .
B) 1 . . 0 . .
C) 0
D) -1

9. Output of the program below is. int i; main( ) { printf(“%d”, i); }
A) 1
B) 0
C) -1
D) Null

10. What will be the output of the following program? main( ) { int i=5; printf(“%d”, i=++i==6); }
A) 0
B) 7
C) 6
D) 1

Answers:

1. What will be output of the following C program? #include int main() {int goto=5; printf(“%d”,goto); return 0;}
A) 5

2. Output of the following C program fragment is. x=5; y=x++; printf(“%d %d”, x,y);
C) 6, 5

3. What will be output of the following C program? #include int xyz=10; int main() { int xyz=20; printf(“%d”, xyz); return 0;}
B) 20

4. Following program fragment. main(){ printf(“%pn”, main( ) ); }
A) Prints the address of main function

5. What will be output of the following program? #include int main() {int a=2, b=7, c=10; c=a==b; printf(“%d”,c); return 0;}
A) 0

6. What is the output of the following program segment? main( ) { long i=65536; printf(“%dn”, i); }
A) 0

7. What will be the output of the program? # include int main() {int a[5]={5,1,15,20,25}; int i, j, m; i=++a[1]; j=a[1]++; m=a[i++]; printf(“%d, %d, %d”, i,j,m); return0;}
C) 3, 2, 15

8. What is the output of the following program segment? main( ) { int=1; do { printf(“%d . . “, i); } while (i–); }
B) 1 . . 0 . .

9. Output of the program below is. int i; main( ) { printf(“%d”, i); }
B) 0

10. What will be the output of the following program? main( ) { int i=5; printf(“%d”, i=++i==6); }
D) 1

Read Next: Objective Type Questions in C Programming Language set-6

Please follow and like us:
RSS
Follow by Email
X (Twitter)
Visit Us
Follow Me
YouTube
YouTube
LinkedIn
linkedIn | Solved MCQ on C Programming Language set-5
Share

Author

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 8 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

Comments are closed.

RSS
Follow by Email
X (Twitter)
Visit Us
Follow Me
YouTube
YouTube
LinkedIn
Share