
- C - Home
- C - Overview
- C - Features
- C - History
- C - Environment Setup
- C - Program Structure
- C - Hello World
- C - Compilation Process
- C - Comments
- C - Tokens
- C - Keywords
- C - Identifiers
- C - User Input
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Integer Promotions
- C - Type Conversion
- C - Type Casting
- C - Booleans
- Constants and Literals in C
- C - Constants
- C - Literals
- C - Escape sequences
- C - Format Specifiers
- Operators in C
- C - Operators
- C - Arithmetic Operators
- C - Relational Operators
- C - Logical Operators
- C - Bitwise Operators
- C - Assignment Operators
- C - Unary Operators
- C - Increment and Decrement Operators
- C - Ternary Operator
- C - sizeof Operator
- C - Operator Precedence
- C - Misc Operators
- Decision Making in C
- C - Decision Making
- C - if statement
- C - if...else statement
- C - nested if statements
- C - switch statement
- C - nested switch statements
- Loops in C
- C - Loops
- C - While loop
- C - For loop
- C - Do...while loop
- C - Nested loop
- C - Infinite loop
- C - Break Statement
- C - Continue Statement
- C - goto Statement
- Functions in C
- C - Functions
- C - Main Function
- C - Function call by Value
- C - Function call by reference
- C - Nested Functions
- C - Variadic Functions
- C - User-Defined Functions
- C - Callback Function
- C - Return Statement
- C - Recursion
- Scope Rules in C
- C - Scope Rules
- C - Static Variables
- C - Global Variables
- Arrays in C
- C - Arrays
- C - Properties of Array
- C - Multi-Dimensional Arrays
- C - Passing Arrays to Function
- C - Return Array from Function
- C - Variable Length Arrays
- Pointers in C
- C - Pointers
- C - Pointers and Arrays
- C - Applications of Pointers
- C - Pointer Arithmetics
- C - Array of Pointers
- C - Pointer to Pointer
- C - Passing Pointers to Functions
- C - Return Pointer from Functions
- C - Function Pointers
- C - Pointer to an Array
- C - Pointers to Structures
- C - Chain of Pointers
- C - Pointer vs Array
- C - Character Pointers and Functions
- C - NULL Pointer
- C - void Pointer
- C - Dangling Pointers
- C - Dereference Pointer
- C - Near, Far and Huge Pointers
- C - Initialization of Pointer Arrays
- C - Pointers vs. Multi-dimensional Arrays
- Strings in C
- C - Strings
- C - Array of Strings
- C - Special Characters
- C Structures and Unions
- C - Structures
- C - Structures and Functions
- C - Arrays of Structures
- C - Self-Referential Structures
- C - Lookup Tables
- C - Dot (.) Operator
- C - Enumeration (or enum)
- C - Structure Padding and Packing
- C - Nested Structures
- C - Anonymous Structure and Union
- C - Unions
- C - Bit Fields
- C - Typedef
- File Handling in C
- C - Input & Output
- C - File I/O (File Handling)
- C Preprocessors
- C - Preprocessors
- C - Pragmas
- C - Preprocessor Operators
- C - Macros
- C - Header Files
- Memory Management in C
- C - Memory Management
- C - Memory Address
- C - Storage Classes
- Miscellaneous Topics
- C - Error Handling
- C - Variable Arguments
- C - Command Execution
- C - Math Functions
- C - Static Keyword
- C - Random Number Generation
- C - Command Line Arguments
- C Programming Resources
- C - Questions & Answers
- C - Quick Guide
- C - Cheat Sheet
- C - Useful Resources
- C - Discussion
- C Online Compiler
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() { int x = 5; if(x=5) { if(x=5) break; printf("Hello"); } printf("Hi"); }
Answer : A
Explanation
compile error, keyword break can appear only within loop/switch statement.
Q 2 - What is the output of the following program?
#include<stdio.h> main() { int i = 1; while(++i <= 5) printf("%d ",i++); }
Answer : B
Explanation
2 4, at while first incremented and later compared and in printf printed first and incremented later
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 following program?
#include<stdio.h> void f(int a[]) { int i; for(i=0; i<3; i++) a[i]++; } main() { int i,a[] = {10, 20, 30}; f(a); for(i=0; i<3; ++i) { printf("%d ",a[i]); } }
Answer : B
Explanation
Arrays are always passed by reference.
Q 5 - What is the output of the following program?
#include<stdio.h> int main(); void main() { printf("Okay"); }
Answer : D
Explanation
Its compile error as the declaration of main() mismatches with the definition.
Q 6 - In Windows & Linux, how many bytes exist fornear, farandhugepointers?
Answer : B
Explanation
In DOS, numbers of byte exist for near pointer = 2,far pointer = 4andhuge pointer = 4.
In Windows and Linux, numbers of byte exist for near pointer = 4,far pointer = 4andhuge pointer = 4.
Q 7 - In Decimal system you can convert the binary number1011011111000101very easily.
Answer : B
Explanation
Hexadecimal is also known ashexorbase 16. It is a system help in writing and presenting numerical values. Binary(base 2) is a popular numeral system (represent numbers by just two digit values 0 and 1), used to present the language of computers. Hexadecimal system can easily convert those numbers.
Q 8 - In the given below code, the functionfopen()uses "r"to open the file source.txt in binary mode for which purpose?
#include<stdio.h> int main () { FILE *fp; fp = fopen("source.txt", "r"); return 0; }
Answer : A
Explanation
To open a file in C programming, we can use library function fopen(). In the given above code, fopen() function is opening a file source.txt for reading. Here, r stands for reading. If, fopen() function does not find any file for reading, returns NULL
#include<stdio.h> int main () { FILE *fp; fp = fopen("source.txt", "r"); return 0; }
Q 9 - What do the following statement defines?
int *ptr[10];
A - ptris a pointer to an array of 10 integer pointers.
B - ptris a array of 10 pointers to integers
Answer : B
Explanation
square parenthesis signify as array at declaration and type is int*, so array of integer pointers.
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.