The. C Declarations 37
Having studied the basics in the first chapter the reader is now exposed in the second chapter to the
additional fundamentals of C. These things are absolutely essential for writing the programs. The
reader is made aware of the following points. Readers are suggested to go through this chapter
thoroughly as the chapter contains the fundamentals and basics.
a) Different types of characters like letters, digits, white space, and special characters. Various
delimiters used with C statements, keywords and identifiers.
b) Different constants, variables, and data types.
c) Rules for defining variables and initializing them.
d) Type conversion of variable.
e) Constant and volatile variables.
A) Answer the following questions.
1) What are the different data types?
2) What are the differences between signed and unsigned data types?
3) What is meant by a variable and a constant?
4) Explain different types of constants in C.
5) What are the C keywords? Elaborate them.
6) List the rules for declaring a variable.
7) What are identifiers?
8) Explain the methods for initialization of variables.
9) Explain constants and volatile variables.
10) Write about space requirement for variables of different data types.
11) What are delimiters? Explain their uses.
12) Is main a keyword? Explain.
13) List any three keywords with their use.
14) What is the difference between %f and %g control strings? Can both be used for representing
float numbers?
15) What do you mean by type conversion? Why is it necessary?
B) Select the appropriate option fo r each o f the following questions.
1) A character variable can store only
a) 1 character
20 characters
c) 254 characters
none of the above
C variable cannot start with
a) a number
an alphabet
c) a character
none of the above
A short integer variable occupies memory
a) 2 bytes
4 bytes
c) 1 byte
8 bytes
38 Programming and Data Structures
4) C keywords are reserved words by
a) a compiler b)
c) header file d)
5) The maximum length of the C variable can be
a) 10 characters b)
c) 20 characters d)
6) The declaration of C variable can be done
a) anywhere in the program b)
c) in executable part d)
7) In C one statement can declare
a) only one variable b)
c) ten variables d)
8) The word 'inf is a
a) keyword b)
c) header file d)
9) The variables are initialized using
a) greater than (>) b)
c) twice equal to (==) d)
10) An unsigned integer variable contains values
a) greater than or equal to zero b)
c) only zeros d)
11) The keyword 'const' keeps the value of a variable
a) constant b)
c) variant d)
12) Identifiers are
a) user-defined names b)
c) C statements d)
13) In C every variable has
a) a type b)
c) a value d)
e) all of the above
14) The range of character data type is
a) -128 to 127 b)
c) 0 to 32767 d)
15) The keyword 'volatile' keeps the value of variable
a) constant b)
c) variant d)
16) Which is the incorrect variable name?
a) else b)
an interpreter
8 characters
none of the above
in declaration part
at the end of the program
two variables
any number of variables
none of the above
equal to (=)
an increment operator (++)
less than zero
(a) & (b) both
none of the above
reserved keywords
none of the above
a name
a size
0 to 255
none of the above
none of the above
The C Declarations 39
c) age
How many keywords are there in ANSI C?
a) 32
c) 42
How many variables can be initialized at a time?
a) one
c) five
any number of variables
Which of the following statements is wrong?
a) 5+5=a;
c) st='m' * 'b ';
is ='A'+10;
The ANSI Standard recognizes the maximum length of a variable up to
a) 31characters
8 characters
c) 25 characters
unlimited characters
The variable name can be started with
a) underscore symbol (_)
asterisk symbol (*)
c) ampersand symbol (&)
none of the above
22) What is the output of the following program?
# include <stdio.h>
# include <conio.h>
void main ()
unsigned long v=-l;
clrscr ();
printf ("\n %lu", v);
a) 4294967295
c) -1
23) What would be the value of variable c and u?
# include <stdio.h>
# include <conio.h>
void main ()
none of the above
char c=-127;
unsigned char u=-127;
clrscr ();
printf ("\n c=%d u= %d",c,u);
c=127 u=127
c=127 u=128
c= -127 u=127
none of the above

Get Programming and Data Structures now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.