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

1.       Minimum number of temporary variable needed to swap the contents of 2 variables is ...................
(A) 1                   (B) 4
(C) 2                   (D) 0
Answer: D
2.       A direct access file is ..................
(A) a file in which records are arranged in a way they are inserted in a file
(B) a file in which records are arranged in a particular order
(C) a file which is stored on a direct access storage medium
(D) none of the above
Answer: C
3.       Which of the following is not an advantage of secondary memory?
(A) It is cost-effective               (B) It has large storage capacity
(C) It has highest speed         (D) It is easily portable
Answer: C
4.       An inverted file is a file ..................
(A) that locates information about data in small files that are maintained apart from actual data record
(B) which stores opposite records
(C) which stores information about records of a system
(D) which stores data.
Answer: A
5.       The output of the following is
x = ‘a’;
printf(“%d”, x);
(A) ‘a’                 (B) a
(C) 97                 (D) None of the above
Answer: C
The printf statement is printing ASCII value of a, that is 97.

6.       What is the output of following program:-
int q, *p, n;
q = 176; If the address of q is 2801
p = &q; and p is 2600
n = *p;
printf(“%d”, n);
(A) 2801            (B) 176
(C) 2600            (D) None of the above
Answer: B
n is assigned a the value which is present at the address of q and that value is 176.
7.       To declare an array S that holds a 5-character string, you would write
(A) char S[5]                 (B) String S[5]
(C) char S[6]                 (D) String S[6]
Answer: A
A string is nothing but a char array.
8.       The ............. storage class is the only request to the compiler.
(A) extern                      (B) static
(C) register                    (D) auto
Answer: C
9.       The automatic conversion of all char and short int values to int is called ...............
(A) integral promotion             (B) type promotion
(C) value promotion                (D) cast
Answer: A
10.    The operands converted up to the type of largest operands are called .............
(A) integral promotion             (B) type promotion
(C) value promotion                (D) cast
Answer: B

Post a Comment