
- 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 below code snippet?
#include<stdio.h> main() { unsigned x = 5, y=&x, *p = y+0; printf("%u",*p); }
Answer : D
Explanation
5, as p holds the address of x which is y+0
Q 2 - What is the output of the following program?
#include<stdio.h> main() { int r, x = 2; float y = 5; r = y%x; printf("%d", r); }
Answer : D
Explanation
Compile Error, It is invalid that either of the operands for the modulus operator (%) is a real number.
Q 3 - Identify the invalid constant used in fseek() function as whence reference.
Answer : C
Explanation
SEEK_BEG, all the rest are valid constants defined in stdio.h
Q 4 - What is the output of the following program?
#include<stdio.h> main() { fprintf(stdout,"Hello, World!"); }
Answer : C
Explanation
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> main() { char s[] = "Hello\0Hi"; printf("%d %d", strlen(s), sizeof(s)); }
Answer : A
Explanation
Length of the string is count of character upto \0. sizeof reports the size of the array.
Q 6 - The C library functionrewind()reposition the file pointer at the beginning of the file.
Answer : A
Explanation
void rewind(FILE *stream): In C, therewind functionreposition the file position to the beginning of the file of the givenstream. It also erases the error and end-of-file indicators forstream.
Q 7 - What is a pointer?
A - A keyword used to create variables
B - A variable used to store address of an instruction
Answer : C
Explanation
Ifvaris a variable then&varis an address in memory.
Q 8 - fgets() function is safer than gets() because in fgets() function you can specify the size of the buffer into which the supplied string will be stored.
Answer : A
Explanation
Both functions retrive and store a string from console or file, but fgets() functions are more safer to use then gets() because gets()doesn't facilitate to detail the length of the buffer to store the string in and fgets() facilitates to specify a maximum string length.
char *fgets(char *s, int size, FILE *stream); char *gets(char *s);
Q 9 - The correct order of evaluation for the expression z = x + y * z / 4 % 2 1
Answer : D
Explanation
* / % holds highest priority than + - . All with left to right associativity.
Q 10 - The library functionstrrchr() finds the first occurrence of a substring in another string.
Answer : B
Explanation
Strstr() finds the first occurrence of a substring in another string.