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

1.       The ................... statement causes immediate termination of the loop.
(A) stop              (B) exit
(C) break           (D) jump
Answer: C
2.       The ............... in C++ is unconditional jump statement.
(A) goto              (B) jump
(C) next             (D) go
Answer: A
3.       Block statements are also called as .................. statements.
(A) group                       (B) multiple
(C) compound              (D) logical
Answer: C
4.       When using atoi() with an ap string variable ...................
(A) you must convert the apstring to a standard string by using .c_str( )
(B) all numbers within the string will be converted to integers
(C) all characters within the string will be converted to ASCII equivalents
(D) all alphabetic characters within the string will be counted
Answer: A
5.       Consider the following code segment:
int a[10], *p1, *p2;
p1 = &a[4];
p2 = &a[6];
Which of the following statements is incorrect w.r.t. pointers?
(A) p1 + 2                      (B) p2 – 2
(C) p2 + p1                    (D) p2 – p1
Answer: C
Explanation:
Addition of two pointers is not allowed.

6.       C can be used on ................
(A) Only MS-DOS operating system
(B) Only Linux operating system
(C) Only Windows operating system
(D) All the above
Answer: D
7.       C programs are converted into machine language with the help of ................
(A) An Editor                             (B) A compiler
(C) An operating system        (D) None of the above
Answer: B
8.       The real constant in C can be expressed in which of the following forms ?
(A) Fractional form only
(B) Exponential form only
(C) ASCII form only
(D) Both fractional and exponential forms
Answer: D
9.       A character variable can at a time store:
(A) 1 character                         (B) 8 characters
(C) 254 characters                   (D) None of the above
Answer: A
10.    The expression, a = 7 / 22 * ( 3.14 + 2 ) * 3 / 5 ; evaluates to
(A) 8.28              (B) 6.28
(C) 3.14             (D) 0
Answer: D


Post a Comment

0 Comments