C Programming Quiz : Basics Of C Programming 2

C Quiz : Basics Of C Programming 2

C Programming Quiz : Basics Of C Programming 2

C Programming Quiz - Basics Of C Programming 2

1. What is an Identifier in C Language.?
  • A) Name of a Function or Variable
  • B) Name of Structure or Union
  • C) Name of a Macros
  • D) All the above.

Answer is D)
Description:
int age=15; Here, age is an Identifier

2. An Identifier may contain.?
  • A) Numbers
  • B) Characters A-z, a-z
  • C) _(Underscore) Symbol
  • D) All of the above

Answer is D)
Description:
An identifier may contain any character (A-Z, a-z), Underscore and Number.

3. What is the number of characters used to distinguish Identifier or Names of Functions and Global variables.?
  • A) 28
  • B) 31
  • C) 34
  • D) 27

Answer is B)
Description:
First 31 characters in general. If first 31 characters are same for two different identifiers, compiler gets confused.

4. An Identifier can start with.?
  • A) _(Underscore) Symbol
  • B) Alphabet
  • C) Option A & Option B
  • D) None of the above

Answer is C)
Description:
Identifier is just a name given to a Function, Variable etc. Identifier name should contain only Letter, Numbers and Underscore.

5.What are the types of Constants in C Language.?
  • A) Basic Constants and Advanced Constants
  • B) Primary Constants and Secondary Constants
  • C) Secondary Constants Only
  • D) Primary Constants Only

Answer is B)
Description:
Primary Constants are Integer (int), Floating Point (float) , Character (char).
Secondary Constants are Structure, Union, Array and Enum.

6. Choose correct statements
  • A) A constant value does not change. A variable value can change according to needs.
  • B) A constant can change its values. A variable can have one constant value only.
  • C) There is no restriction on number of values for constants or variables.
  • D) Constants and Variables can not be used in a singe main function.

Answer is A)
Description:
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.

7. Find an integer constant.
  • A) "125"
  • B) 34
  • C) 3.145
  • D) None of the above

Answer is B)
Description:
Integer constant is a full or whole number without any decimal point. So 3.14 is a floating point number or Real number.

8. A Variable of a particular type can hold only a constant of the same type. Choose right answer.
  • A) TRUE
  • B) FALSE

Answer is A)
Description:
An int can hold only Integer constant. A float can hold only Real Number constants.
A char can hold only Character constants.

9. Choose the correct variable declaration.
  • A) int my age = 10;
  • B) int my,age = 10;
  • C) int my_age = 10;
  • D) int 10age = 10;

Answer is C)
Description:
Only Underscore ( _ ) symbol is allowed in a variable name i.e identifier name. Space, Comma and other special characters are not allowed.

10. Number of Keywords present in C Language are .?
  • A) 30
  • B) 32
  • C) 64
  • D) 62

Answer is B)
Description:
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. __keyword


Submit your Quiz Question
Submit your quiz question to us, We will feature your quiz question in our blog with your credits.