- 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() { short unsigned int i = 0; printf("%u\n", i--); }
Answer : A
Explanation
0, with post decrement operator value of the variable will be considered as the expression’s value and later gets decremented.
Answer : D
Explanation
The size of ‘int’ depends upon the complier i.e. whether it is a 16 bit or 32 bit.
Q 3 - What is the output of the following program?
#include<stdio.h> main() { int i = 13, j = 60; i ^= j; j ^= i; i ^= j; printf("%d %d", i, j); }
Answer : B
Explanation
60 13, its swapping.
Q 4 - Choose the invalid predefined macro as per ANSI C.
Answer : D
Explanation
There is no macro define with the name __C++__, but __cplusplus is defined by ANSI)
Answer : C
Explanation
B is a programming language developed at Bell Labs in 1969. It is derived from BCPL (Basic Combined Programming Language). It is designed by Ken Thompson with Dennis Ritchie.
Q 6 - Turbo C in 16 bit DOS OS, the correct range of “long double” is,
Answer : B
Explanation
Explanation: The integral and precession value varies depending upon the number of bytes designated for a particular data type.
Q 7 - Similarity between a structure, union and enumeration,
A - All are helpful in defining new variables
B - All are helpful in defining new data types
Answer : B
Explanation
A structure, union and enumeration all of them can define a new data type.
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 - What will be the output of the following program?
#include<stdio.h> int main() { const int i = 0; printf("%d\n", i++); return 0; }
Answer : D
Explanation
It is because ++needs a value and a const variable can’t be modified.
#include<stdio.h> int main() { const int i = 0; printf("%d\n", i++); return 0; }
Q 10 - According to ANSI specification, how to declare main () function with command-line arguments?
A - int main(int argc, char *argv[])
B - int char main(int argc, *argv)
Answer : A
Explanation
Some time, it becomes necessary to deliver command line values to the C programming to execute the particular code when the code of the program is controlled from outside. Those command line values are called command line arguments. The command line arguments are handled by the main() function.
Declaration of main () with command-line argument is,
int main(int argc, char *argv[])
Where, argc refers to the number of arguments passed, and argv[] is a pointer array which points to each argument passed to the program.