Kodemania

20 Questions

Settings
Please wait...
Kodemania

Type description here.


Questions and Answers
  • 1. 
    Why can typecasting be dangerous?A)    Some conversions are not defined, such as char to int.B)    You might permanently change the value of the variable.C)    You might temporarily lose part of the data - such as truncating a float when typecasting to an int.D)    There are no dangers.
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 2. 
    Which header file do you need to include to use typecasting?A)    iostream.hB)    ctype.hC)    math.hD)    None
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 3. 
    What header file contains C++ file I/O instructions?A)    iostream.hB)    fstream.hC)    infstream.hD)    outstream.h
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 4. 
    What does ios::ate mean as an argument to ofstream?A)    Open file, but do not create.B)    Open file, create.C)    Open file for read access only.D)    Open file, set the position to the end
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 5. 
    Which of the following is not a valid ofstream argument?A)    ios::appB)    ios::truncC)    ios::noreplaceD)    ios::create
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 6. 
    Which of the following classes handlers file input?A)    ofstreamB)    ifstreamC)    instreamD)    inputfile
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 7. 
    Which of the following gives the memory address of the first element in array foo, an array with 100 elements?A)    foo[0];B)    foo;C)    &foo;D)    foo[1];
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 8. 
    Which properly declares a variable of struct foo?A)    struct foo;B)    foo var;C)    foo;D)    int foo;
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 9. 
    Which of the following accesses a variable in structure *b?A)    b->var;B)    b.var;C)    b-var;D)    b>var;
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 10. 
    Which of the following gives the memory address of a pointer a?A)    a;B)    *a;C)    &a;D)    address(a);
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 11. 
    Which of the following is not true for main() function?A)    It is the first function to be called when the program starts execution. B)    The function main() invokes other functions within it.C)    It returns an int value to the environment that called the program.D)    Recursive call is not allowed for main() 
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 12. 
    A __________is a single-parameter constructor that is declared without the function specifier explicit.A)    converting constructorB)    copy constantC)    dangling pointerD)    none of these
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 13. 
    The size of a structure can be determined bya. size of variable name b. size of (struct tag)A)    Only aB)    Only bC)    Both a and bD)    None of these options        
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 14. 
     What is the output of this C code?   #include <stdio.h>   void main()   {       double b = 3 && 5 & 4 % 3;       printf("%lf", b);   }A)     3.000000B)    4.000000C)    5.000000D)    1.000000
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 15. 
    Which of the following declaration throw run-time error?A)     int **c = &c;B)    int **c = &*c;C)     int **c = **c;D)     None of the mentioned
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 16. 
    What is the output of this C code?   #include <stdio.h>   int main()   {       int i = 11;       int *p = &i;       foo(&p);       printf("%d ", *p);   }   void foo(int *const *p)   {       int j = 10;       *p = &j;       printf("%d ", **p);   }A)    Compile time errorB)    10 10C)    Undefined behaviourD)    10 11
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 17. 
    What is the output of this program?   #include <iostream>   using namespace std;   int main()   {       int i, j;       j = 10;       i = (j++, j + 100, 999 + j);       cout << i;       return 0;   }A)    1000B)    11C)     1010D)    1001
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 18. 
     How many elements does a floating point number is composed of?A)    1B)    2C)    3D)    4
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 19. 
    Which is also called as abstract class?A)    virtual functionB)    pure virtual functionC)    derived classD)    None of the mentioned
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D

  • 20. 
    What is meant by pure virtual function?A)    Function which does not have definition of its own.B)    Function which does have definition of its own.C)    Function which does not have any return type.D)    None of the mentioned
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      D