
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C Programming - Online Quiz
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); }
Answer : A
Explanation
a=5,b=3 , as there are only two format specifiers for printing.
Q 2 - The type name/reserved word ‘short’ is ___
Answer : D
Explanation
short is used as an alternative of short int.
Q 3 - What is the output of the following program?
#include<stdio.h> main() { int a[3] = {2,,1}; printf("%d", a[a[0]]); }
Answer : D
Explanation
Compile error, invalid syntax in initializing the array.
Q 4 - What is the output of the below code snippet.
#include<stdio.h> main() { printf("%d", -11%2); }
Answer : B
Explanation
Modulus (%) operator is meant to give reminder for integer division.
Q 5 - What is the output of the following program?
#include<stdio.h> void main() { char *s = "C++"; printf("%s ", s); s++; printf("%s", s); }
Answer : B
Explanation
After s++, s points the string “++”.
Q 6 - Which header statement is missing in the given below program to get the desired output?
#include<stdio.h> #include<math.h> int main () { double x = 1234321; double result = sqrt(x); printf("The square root of %.2lf is %.2lf\n", x, result); return 0; }
D - Above program is absolutely correct to give desired result
Answer : B
Explanation
In C programming, math.h is a header file in the standard library designed for basic mathematical operations.
Output of above code: The square root of 1234321.00 is 1111.00
#include<stdio.h> #include<math.h> int main () { double x = 1234321; double result = sqrt(x); printf("The square root of %.2lf is %.2lf\n", x, result); return 0; }
Answer : A
Explanation
Logical NOT operator will make false.
Q 8 - Which library function can convert an unsigned long to a string?
Answer : B
Explanation
ultoa() - Convert an unsigned long integer into a string.
Q 9 - Choose the correct order from given below options for the calling function of the code “a = f1(23, 14) * f2(12/4) + f3();”?
Answer : D
Explanation
Evaluation order is implementation dependent.
Q 10 - The maximum combined length of the command-line arguments as well as the spaces between adjacent arguments is – a) 120 characters, b) 56 characters, c) Vary from one OS to another
Answer : D
Explanation
The maximum combined length of the command-line arguments and the spaces between adjacent arguments vary from one OS to another.