C++ MCQ -7

Question 1

A variable is/are

a.    String that varies during program execution

b.    A portion of memory to store a determined value

c.    Those numbers that are frequently required in programs

d.    None of these

 
Question 2

Which of the following can not be used as identifiers?

a.    Letters

b.    Digits

c.    Underscores

d.    Spaces

Question 3

Which of the following identifiers is invalid?

a.    papername

b.    writername

c.    typename

d.    printname

Question 4

Which of the following can not be used as valid identifier?

a.    bitand

b.    bittand

c.    biand

d.    band

Question 5

The difference between x and ΓÇÿxΓÇÖ is

a.    The first one refers to a variable whose identifier is x and the second one refers to the character constant x

b.    The first one is a character constant x and second one is the string literal x

c.    Both are same

d.    None of above

Question 6

Which of the following is not a valid escape code?

a.    \t

b.    \v

c.    \f

d.    \w

Question 7

Which of the following statement is true?

a.    String Literals can extend to more than a single line of code by putting a backslash sign at the end of each unfinished line.

b.    You can also concatenate several string constants separating them by one or several blank spaces, tabulators, newline or any other valid blank character

c.    If we want the string literal to explicitly made of wide characters, we can precede the constant with the L prefix

d.    All of above

Question 8

Regarding #difine which of the following statement is false?

a.    It is not C++ statement but the directive for the preprocessor

b.    This does not require a semicolon at the end of line

c.    It is a C++ statement that declares a constant in C++

d.    None of the above

Question 9

Regarding following statement  which of the statements is true?

const int pathwidth=100;

a.    Declares a variable pathwidth with 100 as its initial value

b.    Declares a construction pathwidth with 100 as its initial value

c.    Declares a constant pathwidth whose value will be 100

d.    Constructs an integer type variable with pathwidth as identifier and 100 as value

Question 10

In an assignment statement

a.    The lvalue must always be a variable

b.    The rvalue might be a constant, a variable, an expression or any combination of these
c.    The assignment always takes place from right to left and never the other way

d.    All of above

Answers

1.     b. A portion of memory to store a determined value

2.     d.  Spaces

3.     c. Typename

4.     a. Bitand

5.     a. The first one refers to a variable whose identifier is x and the second one refers to the character constant x

6.     d. \w

7.     d. All of above

8.     c. It is a C++ statement that declares a constant in C++

9.    c. Declares a constant pathwidth whose value will be 100

10. d. All of above

Similar Posts

  • C++ MCQ-12

    Q.1   The address of a variable temp of type float is          (A) *temp  (B) &temp     (C) float& temp  (D) float temp&     Ans: B   Q.2   What is the output of the following code           char symbol[3]={ΓÇÿaΓÇÖ,ΓÇÿbΓÇÖ,ΓÇÿcΓÇÖ};            for (int index=0; index<3; index++)         cout << symbol…

  • C++ MCQ -5

    Question 1 Streams are a.       Abstraction to perform input and output operations in sequential media b.      Abstraction to perform input and output operations in direct access media c.       Objects  where a program can either insert or extract characters to and from it d.      Both a and c   Question 2 Which of the following is…

  • C++ MCQ -6

    Question 1 In an assignment statement a=b; Which of the following statement is true? a.    The variable a and the variable b are equal. b.    The value of b is assigned to variable a but the later changes on variable b will not effect the value of variable a c.    The value of b is…

  • C++ MCQ -4

    Question 1:   cin extraction stops execution as soon as it finds any blank space character   a.       true b.      false   Question 2:   Observe the following statements and decide what do they do.   string mystring;   getline(cin, mystring);   a.       reads a line of string from cin into mystring b.      reads a…

  • C++ MCQ-16

    Q.91   What will be the result of the expression 13 & 25? (A) 38  (B)  25 (C)  9  (D)  12      Ans:C  Q.92   Which of the following operator can be overloaded through friend function? (A)  ->   (B)  = (C)  ( )   (D)  *        Ans:D   Q.93  To access the public function…

  • C++ MCQ-10

    Q.16   If we create a file by ΓÇÿifstreamΓÇÖ, then the default mode of the file is _________    (A)  ios :: out  (B)  ios :: in (C)  ios :: app  (D)  ios :: binary     Ans: B   Q.17   A variable defined within a block is visible        (A) from the point of…

Leave a Reply

Your email address will not be published. Required fields are marked *