Programming MCQs

Objective Questions on C Programming set-6

Pinterest LinkedIn Tumblr

Here are the collections of objective questions on C programming includes multiple choice questions on fundamental of C programming language. It includes objective questions on the statement terminator and arrays in C, passing an array as an argument to a function, loop structure used on C and the conditional operators used in C programming.

1. Which symbol is used as a statement terminator in C?
A) !
B) ~
C) #
D) ;

2. If the size of the array is less than the number of initializes then, ……….
A) extra values are being ignored
B) generates an error message
C) size of array is increased
D) size is neglected when values are given

3. In C, if you pass an array as an argument to a function, what actually gets passed?
A) Value of elements in array
B) First element of the array
C) Base address of the array
D) Address of the last element of array

4. How many times the following loop be executed? { .. ch=’b’; while (ch>=’a’ && ch<==’z’) ch++; }
A) 0
B) 25
C) 26
D) 1

5. If a=8 and b=15 then the statement x=(a>b) ? a:b;
A) assigns a value 8 to x
B) gives an error message
C) assigns a value 15 to x
D) assigns a value 7 to x

6. What is the output of the following code. int n=0, m=1; do { printf(“%d”, m); m++; } while (m<=n);
A) 0
B) 2
C) 1
D) 4

7. A C program contains the following declaration int i=8, j=5 what would be the value of following expression? abs(i-2*j)
A) 2
B) 4
C) 6
D) 8

Read Also: Solved MCQ on C Programming Language

8. The output of the following is . int a=75; printf(“%d%%”, a);
A) 75
B) 75%%
C) 75%
D) None of the above

9. How many times the following program would print (“abc”)? main( ) { printf(“nabc”); main( ); }
A) Infinite number of times
B) 32767 times
C) 65535 times
D) Till the stack does not overflow

10. Which of the following is the correct usage of conditional operators used in C?
A) a>b?c=30:c=40;
B) a>b?c=30;
C) max=a>b?a>c?a:c:b>c?b:c
D) return (a>b)?(a:b)

Answers:

1. Which symbol is used as a statement terminator in C?
D) ;

2. If the size of the array is less than the number of initializes then, ……….
B) generates an error message

3. In C, if you pass an array as an argument to a function, what actually gets passed?
C) Base address of the array

4. How many times the following loop be executed? { .. ch=’b’; while (ch>=’a’ && ch<==’z’) ch++; }
B) 25

5. If a=8 and b=15 then the statement x=(a>b) ? a:b;
C) assigns a value 15 to x

6. What is the output of the following code. int n=0, m=1; do { printf(“%d”, m); m++; } while (m<=n);
C) 1

7. A C program contains the following declaration int i=8, j=5 what would be the value of following expression? abs(i-2*j)
A) 2

8. The output of the following is . int a=75; printf(“%d%%”, a);
D) None of the above

9. How many times the following program would print (“abc”)? main( ) { printf(“nabc”); main( ); }
A) Infinite number of times

10. Which of the following is the correct usage of conditional operators used in C?
C) max=a>b?a>c?a:c:b>c?b:c

Read Next: Solved MCQ Questions on C++ Set-1

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.