- C Programming Tutorial
- 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 - Booleans
- C - Constants
- C - Literals
- C - Escape sequences
- C - Format Specifiers
- C - Storage Classes
- 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
- C - Decision Making
- C - if statement
- C - if...else statement
- C - nested if statements
- C - switch statement
- C - nested switch statements
- 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
- C - Functions
- C - Main Functions
- 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
- C - Scope Rules
- C - Static Variables
- C - Global Variables
- C - Arrays
- C - Properties of Array
- C - Multi-Dimensional Arrays
- C - Passing Arrays to Function
- C - Return Array from Function
- C - Variable Length Arrays
- 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
- C - Strings
- C - Array of Strings
- C - Special Characters
- C - Structures
- C - Structures and Functions
- C - Arrays of Structures
- C - Self-Referential Structures
- C - Nested 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 - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
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() { char s[]="hello", t[]="hello"; if(s==t){ printf("eqaul strings"); } }
Answer : C
Explanation
No output, as we are comparing both base addresses and they are not same.
Q 2 - What is the output of the following program?
#include<stdio.h> main() { int i = 1; while( i++<=5 ) printf("%d ",i++); }
Answer : C
Explanation
2 4 6, at while first compared and later incremented and in printf printed first and incremented later.
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 - For the below definition what is the data type of ‘PI’
#define PI 3.141
C - There is no type associated with PI, as it’s just a text substitution
D - Syntax error, semi colon is missing with the definition of PI
Answer : C
Explanation
The text associated with the macro name gets expanded at the line of call. The expanded text is by default a double constant whereas no type is associated with PI.
Q 5 - Which of the following functions disconnects the stream from the file pointer.
Answer : B
Explanation
fclose(), it flushes the buffers associated with the stream and disconnects the stream with the file.
Q 6 - What is (void*)0?
A - Symbolize the NULL pointer
B - Symbolize the void pointer
Answer : A
Explanation
In C programming, NULL indicates the value 0 of a pointer, which means; pointer that initializes with NULL value considered as NULL pointer.
Q 7 - Which header file can be used to define input/output function prototypes and macros?
Answer : C
Explanation
The stdio.h header is used to define variable types, macros, and various functions for performing input and output operation.
Answer : B
Explanation
Two immediate ampersand (&) symbols is logical AND operator.
Q 9 - Choose the correct unary operators in C – a) !, b) ~, c) ^&, d) ++
Answer : A
Explanation
In C, these are the unary operators,
Logical NOT = ! Address-of = & Cast Operator = ( ) Pointer dereference = * Unary Plus = + Increment = ++ Unary negation = –
Q 10 - Which statement can print \n on the screen?
Answer : A
Explanation
Option A is the correct answer. In C programming language, "\n" is the escape sequence for printing a new line character. In printf("\\n"); statement, "\\" symbol will be printed as "\" and “n” will be known as a common symbol.
To Continue Learning Please Login
Login with Google