logo

CuriousTab

CuriousTab

Discussion


Home Interview Technology Comments

  • Question
  • How many ways are there to initialize int with a constant?


  • Options
  • A. 1
  • B. 2
  • C. 3
  • D. 4

  • Correct Answer


  • Explanation

    There are two formats for initializers in C++ as shown in the example that follows. The first format uses the traditional C notation. The second format uses constructor notation.

    int foo = 123;

     

    int bar (123);

  • Tags: Software Architect

    Technology problems


    Search Results


    • 1. What do you mean by reference variable in c++?
    • Discuss
    • 2. Define Structure in C++.?
    • Discuss
    • 3. What is function prototype in C++?
    • Discuss
    • 4. What is the output of this program? #include using namespace std; void fun(int x, int y) { x = 20; y = 10; } int main() { int x = 10; fun(x, x); cout << x; return 0; }

    • Options
    • A. 10
    • B. 20
    • C. compile time error
    • D. none of these
    • Discuss
    • 5. What is the output of this program? #include using namespace std; struct sec { int a; char b; }; int main() { struct sec s ={25,50}; struct sec *ps =(struct sec *)&s; cout << ps->a << ps->b; return 0; }

    • Options
    • A. 252
    • B. 253
    • C. 254
    • D. 262
    • Discuss
    • 6. What is an explicit constructor?
    • Discuss
    • 7. How many ways of reusing are there in class hierarchy?

    • Options
    • A. 1
    • B. 2
    • C. 3
    • D. 4
    • Discuss
    • 8. What is meant by exception specification?

    • Options
    • A. A function is limited to throwing only a specified list of exceptions.
    • B. A catch can catch all types of exceptions.
    • C. A function can throw any type of exceptions.
    • D. none of the mentioned
    • Discuss
    • 9. Which operator is used in catch-all handler?

    • Options
    • A. ellipses operator
    • B. ternary operator
    • C. string operator
    • D. unary operator
    • Discuss
    • 10. To which type of class, We can apply RTTI?

    • Options
    • A. Encapsulation
    • B. Polymorphic
    • C. Derived
    • D. None of these
    • Discuss


    Comments

    There are no comments.

Enter a new Comment