Learn C Programming MCQ Questions and Answers on Basics to attend job placement exams, interview questions, college viva and Lab Tests. This paper covers C language invention history, standards and usages.
Go through C Theory Notes on Basics before studying questions.
#include<stdio.h> main() { /* Multi Line Comment This line is ignored by compiler */ printf("Hello C.."); }
#include main() { } is a mandatory function to be included in every C Program.
Answer C comments two lines with Multi-Line comment or BLOCK Comment characters /* ....*/
Only // is a Single Line Commenting characters.
Some keyboards in some countries do not contain Punctuation Keys. They have to use these Digraphs to represent the corresponding characters.
Eg.
int ary[] = { 1, 2}; is written as int ary<::> = <%1, 2%>;
Trigraphs are also present to support 1991 standard of representing 7 bit characters. ??( represents [.
int age=25;
//here age is an Identifier
First 31 characters in general. If first 31 characters are same for two different identifiers, compiler gets confused.
if 31 is present choose. Because old compilers support up to 31 only.
Upto first 63 characters you can show differentiation in the name of say
int abcdefghijklmnopqrstuvwxyz1234567788= 10;
int abcdefghijklmnopqrstuvwxyz1234567799 = 20;
Identifier is just a name given to a Function, Variable etc.
Identifier name should contain only Letter, Numbers and Underscore.
C is very fast to execute and safe to embed along with microprocessors. Device drivers are written in C and C++.
Primary Constants are Integer (int), Floating Point (float) , Character (char)
Secondary Constants are Structure, Union, Array and Enum.
Constant value is always constant. Constant is also called Literal.
Variable can have any number of arbitrary values and once value at any point of time. Variable is also called Identifier.
Integer constant is a full or whole number without any decimal point. So 3.14 is a floating point number or Real number.
Floating Point can be represented in two forms.
1. Fractional Form
eg. 12345.67
2. Exponential Form
(Mantissa)e(number) or (Mantissa)E(number)
eg. 123.4567E2
(e2 = 10 power 2 = 100)
'A' 'a'
'1' '9'
'$' '#'
A character constant contains only one character within Single Quotes. ' '. Single Quote is typed using Single Quote Double Quote Key near Enter Key in a Keyboard. Simply it is Right Single Quote.
Left Single Quote looks like this `
Right Single Quote looks like this '
An int can hold only Integer constant.
A float can hold only Real Number constants.
A char can hold only Character constants.
Only Underscore ( _ ) symbol is allowed in a variable name i.e identifier name. Space, Comma and other special characters are not allowed.
Only 32 Keywords originally. Compilers are individual companies can include and use extra keywords if required. Such keywords should preceed with __ ( two Underscore symbols before names).
eg. __mykeyword
e.g
int amount = 10;
float a,b;
SNO | Topic |
---|---|
1. | MCQs on C Basics 1 |
2. | MCQs on C Basics 2 |
3. | MCQs on Data Types and Storage Classes 1 |
4. | MCQs on Data Types and Storage Classes 2 |
5. | MCQs on Data Types and Storage Classes 3 |
6. | MCQs on C Arithmetic Operators 1 |
7. | MCQs on C Arithmetic Operators 2 |
8. | MCQs on C Conditional Operators 1 |
9. | MCQs on C Conditional Operators 2 |