C++ quiz questions

C++ interview questions

  • 1.

    How many characters are specified in the ASCII scheme?

    1. 64

    2. 128

    3. 256

    4. none of the mentioned

    Answer
  • 2.

    Evaluate the following

    (false && true) || false || true

    1. 0

    2. 1

    3. false

    4. none of the mentioned

    Answer
  • 3.

    What is the value of p?

        #include <iostream>
        using namespace std;
        int main()
        {
            int p;
            bool a = true;
            bool b = false;
            int x = 10;
            int y = 5;
            p = ((x | y) + (a + b));
            cout << p;
            return 0;
        }

     

    1. 0

    2. 16

    3. 12

    4. 2

    Answer
  • 4.

    What is the output of the following program?

        #include <iostream>
        using namespace std;
        int f(int p, int q)
        {
            if (p > q)
                return p;
            else
                return q;
        }
        main()
        {
            int a = 5, b = 10;
            int k;
            bool x = true;
            bool y = f(a, b);
            k =((a * b) + (x + y));
            cout << k;
        }

     

    1. 55

    2. 62

    3. 52

    4. none of the mentioned

    Answer
  • 5.

    Which of the two operators ++ and — work for the bool datatype in C++?

    1. None

    2. ++

    3. Both

    Answer
  • 6.

    For what values of the expression is an if-statement block not executed?

    1. 0 and all negative values

    2. 0 and -1

    3. 0

    4. 0, all negative values, all positive values except 1

    Answer
  • 7.

    Which of the following statements are false?

    1. bool can have two values and can be used to express logical expressions.

    2. bool cannot be used as the type of the result of the function.

    3. bool can be converted into integers implicitly

    4. a bool value can be used in arithemetic expressions.

    Answer
  • 8.

    What happens when a null pointer is converted into bool?

    1. An error is flagged

    2. bool value evaluates to true

    3. bool value evaluates to false

    4. the statement is ignored

    Answer
  • 9.

    What is the value of the bool?

    bool is_int(789.54)

     

    1. True

    2. False

    3. 1

    4. none of the mentioned

    Answer
  • 10.

    Find the odd one out:

    1. std::vector<int>

    2. std::vector<short>

    3. std::vector<long>

    4. std::vector<bool>

    Answer
  • 11.

    Is bool a fundamental datatype in C++?

    1. Yes

    2. No, it is a typedef of unsigned char

    3. No, it is an enum of {false,true}

    4. No, it is expanded from macros

    Answer
  • 12.

    Pick the odd one out.

    1. integer, character, boolean, floating

    2. enumeration, classes

    3. integer, enum, void

    4. arrays, pointer, classes

    Answer
  • 13.

    When a language has the capability to produce new data type mean, it can be called as

    1. overloaded

    2. extensible

    3. encapsulated

    4. reprehensible

    Answer
  • 14.

    The value 132.54 can represented using which data type?

    1. double

    2. void

    3. int

    4. bool

    Answer
  • 15.

    Which of the following statements are true?

    int f(float)

    1. f is a function taking an argument of type int and retruning a floating point number

    2. f is a function taking an argument of type float and returning a integer.

    3. f is a function of type float

    4. none of the mentioned

    Answer
  • 16.

    Identify the user-defined types from the following?

    1. enumeration

    2. classes

    3. both a and b

    4. int

    Answer
  • 17.

    Which type is best suited to represent the logical values?

    1. integer

    2. boolean

    3. character

    4. all of the mentioned

    Answer
  • 18.

    What does a escape code represent?

    1. alert

    2. backslash

    3. tab

    4. form feed

    Answer
  • 19.

    Which datatype is used to represent the absence of parameters?

    1. int

    2. short

    3. void

    4. float

    Answer
  • 20.

    Pick the odd one out

    1. array type

    2. character type

    3. boolean type

    4. integer type

    Answer

© 2017 QuizBucket.org