
- 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 following code snippet?
#include<stdio.h> main() { char c = 'A'+255; printf("%c", c); }
Answer : A
Explanation
A, the range of ASCII values for the ASCII characters is 0-255. Hence the addition operation circulates back to ‘A’
Q 2 - What is the output of the following program?
#include<stdio.h> main() { float t = 2; switch(t) { case 2: printf("Hi"); default: printf("Hello"); } }
Answer : D
Explanation
Error, switch expression can’t be float value.
Answer : B
Explanation
‘cc’ full form is C Compiler and is the compiler for UNIX. gcc is GNU C compiler for linux. Borland and vc++ (Microsoft visual c++) for windows.
Q 4 - What is the output of the following program?
#include<stdio.h> int x = 5; int* f() { return &x; } main() { *f() = 10; printf("%d", x); }
Answer : D
Explanation
The returned address is global variables and 10 being stored in it. Therefore x is 10.
Q 5 - What is the output of the following program?
#include<stdio.h> main() { int x = 3; x += 2; x =+ 2; printf("%d", x); }
Answer : A
Explanation
+ in unary form is dummy operator, therefore ‘x’ is overwritten with the value +2 finally.
Q 6 - In normalized form, if the binary equivalent of 5.375 is “0100 0000 1010 1100 0000 0000 0000 0000” then what will be the output of the program in Intel core machine?
#include<stdio.h> #include<math.h> int main () { float a = 5.375; char *p; int i; p = (char*)&a; for(i=0; i <= 3; i++) printf("%02x\n", (unsigned char)p[i]); return 0; }
Answer : B
Explanation
Depends upon the machine whether its big endian or small endian machine. Byte by byte is fetched from right end.
#include<stdio.h> #include<math.h> int main () { float a = 5.375; char *p; int i; p = (char*)&a; for(i=0; i <= 3; i++) printf("%02x\n", (unsigned char)p[i]); return 0; }
Q 7 - Which of the following operator can be used to access value at address stored in a pointer variable?
Answer : A
Explanation
Pointer operator,
* (Value Operator) = Gives Value stored at Particular address
& (Address Operator) = Gives Address of Variable
Q 8 - In DOS, how many bytes exist for near, far and huge pointers?
Answer : C
Explanation
In DOS, numbers of byte exist for near pointer = 2, far pointer = 4 and huge pointer = 4.
In Windows and Linux, numbers of byte exist for near pointer = 4, far pointer = 4 and huge pointer = 4.
Q 9 - Choose the correct order of evaluation,
A - Relational Arithmetic Logical Assignment
B - Arithmetic Relational Logical Assignment
Answer : B
Explanation
As per the operators preference.
Q 10 - In the given below statement, what does the “pf” indicate?
int (*pf)();
Answer : A
Explanation
pf is a pointer as well holds some functions reference.