Computer Science Study Materials for Competitive Exams

Sample Questions, Previous Year Solved Papers, Study Materials For Competitive Examinations Like UGC NET, SET And GATE Computer Science.

Wednesday, 19 October 2016

C & C++ Programming Multiple Choice Questions - Set 30

1.       puts(argv[0]);
(A) prints the name of the source code file.
(B) prints argv.
(C) prints the number of command line arguments.
(D) prints the name of the executable code file.
Answer: D
argv[0] represent the filename where the executable code of the program is stored.
2.       printf(“%–10s”, “ABDUL”); displays
(A) ABDULbbbbb                    (B) bbbbbABDUL
(C) ABDULbbbbbbbbbb         (D) bbbbbbbbbbABDUL
Answer: A
-10s will print ABDUL in 10 space ABDUL followed by 5 blank space.
3.       The built-in library function isalnum( ) is testing to determine if the argument is ...............
(A) one of "all" numbers available from the keyboard
(B) an alphabet character
(C) an ASCII character
(D) an alphanumeric
Answer: D
4.       The built-in library function ceil(x) requires the ................... header file.
(A) <ctype.h>    (B) <math.h>
(C) <stdlib.h>    (D) <time.h>
Answer: B
5.       To raise any number to a power, ................ is used.
(A) the exponent symbol ^
(B) the built-in library function pow(x,y)
(C) the built-in library function pow10(x)
(D) concatenation
Answer: B

6.       Time_t is a .................
(A) variable used to hold a number from the computer's internal clock
(B) data type
(C) built-in library function which will return a value from the internal clock
(D) header file
Answer: B
7.       The rand() built-in library function ................
(A) is a true random number generator
(B) returns positive double values
(C) is a pseudo-random number generator
(D) returns a different sequence of values each time it is run
Answer: C
8.       Which type of data file is analogous to an audio cassette tape?
(A) random access file
(B) sequential access file
(C) binary file
(D) source code file
Answer: B
9.       Which of the following header files is required for creating and reading data files?
(A) ofstream.h              (B) fstream.h
(C) ifstream.h               (D) console.h
Answer: B
10.    The first digit of a decimal constant must be
(A) a zero                                  (B) a non zero number
(C) a negative number           (D) an integer
Answer: D
Decimal constants consist of a set of digit, 0 to 9, preceded by an optional – or + sign.

No comments:

Post a Comment