1. Question: Which of the following are NOT valid C++ casts

    A
    dynamic_cast

    B
    reinterpret_cast

    C
    static_cast

    D
    const_cast

    E
    void_cast

    Note: Not available
    1. Report
  2. Question: Sample Code
    typedef char *monthTable[3];
    Referring to the code above, which of the following choices creates two monthTable arrays and initializes one of the two?

    A
    monthTable(winter,spring={"March","April","May"});

    B
    monthTable winter, spring;

    C
    monthTable, winter, spring;

    D
    monthTable, winter,spring={"March","April","May"};

    E
    monthTable winter,spring={"March","April","May"};

    Note: Not available
    1. Report
  3. Question: Consider the sample code given below and answer the question that follows.
    class Person
    {
    public:
       Person();
          virtual ~Person();
    };
    class Student : public Person
    {
    public:
       Student();
       ~Student();
    };
    
    main()
    {
       Person *p = new Student();
       delete p;
    }
    Why is the keyword "virtual" added before the Person destructor?

    A
    To make it impossible for this particular destructor to be overloaded

    B
    To ensure that correct destructor is called when p is deleted

    C
    To ensure that the destructors are called in proper order

    D
    To improve the speed of class Person's destruction

    E
    To prevent the Person class from being instantiated directly making it an abstract base class

    Note: Not available
    1. Report
  4. Question: Consider the following code:
    template<class T> void Kill(T *& objPtr)
    {
       delete objPtr;
       objPtr = NULL;
    }
    
    class MyClass
    {
    };
    
    void Test()
    {
       MyClass *ptr = new MyClass();
       Kill(ptr);
       Kill(ptr);
    }
    Invoking Test() will cause which of the following?

    A
    Code will Crash or Throw and Exception

    B
    Code will Execute, but there will be a memory leak

    C
    Code will execute properly

    D
    Code will exhibit undefined behavior

    Note: Not available
    1. Report
  5. Question: Consider the following class hierarchy:
    class Base
    {
    }
    
    class Derived : public Base
    {
    }
    Which of the following are true?

    A
    The relationship between the Base and Derived can be described as: Base is a Derived

    B
    The relationship between the Base and Derived can be described as: Base has a Derived

    C
    Derived can access only public member functions of Base

    D
    Derived can access public and protected member functions of Base

    E
    The following line of code is valid: Base *object = new Derived();

    Note: Not available
    1. Report
  6. Question: What linkage specifier do you use in order to cause your C++ functions to have C linkage

    A
    extern "C"

    B
    extern C

    C
    _stdcall

    D
    _cdecl

    E
    _fastcall?

    Note: Not available
    1. Report
  7. Question: Which of the following techniques should you use to handle a destructor that fails?

    A
    Return an error code from the destructor

    B
    Throw an exception from the destructor

    C
    Write the error to a log file

    D
    Use "delete this;" in the destructor

    E
    None

    Note: Not available
    1. Report
  8. Question: Which of the following techniques should you use to handle a constructor that fails?

    A
    Return an error code from the constructor

    B
    Throw an exception from the constructor

    C
    Write the error to a log file

    D
    Use "delete this;" in the constructor

    E
    None

    Note: Not available
    1. Report
  9. Question: Which of the following statements about function overloading, is true?

    A
    Which of the following statements about function overloading, is true?

    B
    Overloaded functions may not be declared as "inline"

    C
    Although the return types and parameter types of overloaded functions can be different, the actual number of parameters cannot change

    D
    Function overloading is possible in both C and C++

    E
    The parameter lists and const keyword are used to distinguish functions of the same name declared in the same scope

    Note: Not available
    1. Report
  10. Question: Consider the following code:
    #include<stdio.h>
    
    int main(int argc, char* argv[])
    {
            enum Colors
            {
                    red,
                    blue,
                    white = 5,
                    yellow,
                    green,
                    pink
            };
    
            Colors color = green;
            printf("%d", color);
            return 0;
    }
    What will be the output when the above code is compiled and executed?

    A
    The code will have compile time errors

    B
    5

    C
    6

    D
    7

    E
    8

    Note: Not available
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd