Sunday, September 5, 2010

C and C++ objective type questions

Q1. The braces that surround the code in a 'C' program
a. show what code goes in a particular function
b. delimit a section of code
c. separate the code from the constant
d. separate the source file from the subject file
e. none of the above

Q2. Almost every C program begins with the statement
a. main()
b. printf()
c. #include
d. scanf()
e. none of the above

Q3. A single character input from the keyboard can be obtained by using the function
a. printf()
b. getchar()
c. putchar()
d. scanf()
e. none of the above

Q4. The function scanf() reads
a. a single character
b. character and strings
c. any possible variable type
d. any possible number
e. none of the above

Q5. A field width specifier in a printf() function
a. specifies the maximum value of a number
b. controls the size of type used to print numbers
c. controls the margins of the program
d. specifies how many character positions will be used for a number
e. none of the above

Ans: 1. b , 2. c , 3. b , 4. c , 5. d

No comments: