Following quiz provides Multiple Choice Questions (MCQs) related to C Programming Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.
Q 1 - What is the output of the below code snippet?
#include<stdio.h> main() { int a = 5, b = 3, c = 4; printf("a = %d, b = %d\n", a, b, c); }
a=5,b=3 , as there are only two format specifiers for printing.
Q 2 - What is the output of the following program?
#include<stdio.h> main() { int a[] = {1,2}, *p = a; printf("%d", p[1]); }
2, as ‘p’ holds the base address then we can access array using ‘p’ just like with ‘a’
As the code of macro gets expanded at the line of call, therefore macro gets executed faster with no overhead of context switch.
Q 4 - What is the output of the following program?
#include<stdio.h> main() { fprintf(stdout,"Hello, World!"); }
stdout is the identifier declared in the header file stdio.h, need to include the same.
Q 5 - What is the output of the following program?
#include<stdio.h> int main(); void main() { printf("Okay"); }
It’s compile error as the declaration of main() mismatches with the definition.
Q 6 - In the standard library of C programming language, which of the following header file is designed for basic mathematical operations?
math.h is a header file in the standard library designed for basic mathematical operations
&& = Called Logical AND operator. If both the operands are non-zero, then condition becomes true.
|| = Called Logical OR Operator. If any of the two operands is non-zero, then condition becomes true.
! = Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then
Logical NOT operator will make false.
Q 8 - Why to use fflush() library function?
A - To flush all streams and specified streams
B - To flush only specified stream
In C programming, the fflush() function writes any unwritten data in stream's buffer. If, stream is a null pointer, fflush() function will flush all streams with unwritten data in the buffer.
int fflush(FILE *stream);
Q 9 - To print a double value which format specifier can be used?
Double value can be printed using %lf format specifier.
Q 10 - Choose the function that is most appropriate for reading in a multi-word string?
gets (); = Collects a string of characters terminated by a new line from the standard input stream stdin