Questions
Which of the following data structures is not implemented by STL (Standard Template Library)?
- List
- Queue
- Stack
- Pointer
What is the notation of scope resolution operator?
- :
- *
- ::
- None of the above
Which of the following is involved in implementation of the concept of generic programming?
- Virtual functions
- Strings
- Templates
- Operator overloading
The member function can be defined outside class using
- size of operator
- scope resolution operator
- subscript operator
- none of the above
Which of the following is not an unary operator?
- *
- ++
- --
- +
POD is used to describe
- C++ classes
- C classes
- C++ structures
- C structures
What is the name of the term given to derived data type in which all data elements share the same location in memory?
- Pointers
- Structures
- Classes
- Unions
What is the name of the non-member function that can access all the private and protected members of a class?
- Virtual functions
- Static functions
- Friend functions
- Constructors
In C++, what are the names given to the functions which are not actually called rather their codes are substitued every time they are invoked?
- Inline functions
- Constructors
- Destructors
- None of the above
When we are making all data members of class private, which property of OOP are we using?
- Inheritance
- Polymorphism
- Encapsulation
- None of the above
What is the size of a far pointer?
- 1 byte
- 2 bytes
- 3 bytes
- 4 bytes
What is the output of the following code snippet?
#include <iostream>
using namespace std;
int main ()
{
int numbers[5];
int * p; p = numbers; *p = 10; p++; *p = 20;
p = &numbers[2]; *p = 30;
p = numbers + 3; *p = 40;
p = numbers; *(p+4) = 50;
for (int n=0; n<5; n++) cout << numbers[n] << , ;
return 0;
}
- 10, 20, 30
- 10, 20, 30, 40
- 10, 20, 30, 40, 50
- None of the above
Which of the following statements about abstract class is false?
- It must contain atleast one pure virtual function.
- Pointers to abstract class can be created.
- References to abstract classes can be created.
- Objects of abstract classes can be created.
Which of the following is not a built-in stream in C++?
- cin
- cout
- cerr
- none of the above
Which of the following is not a type of iterator?
- Random access
- Bi-directional
- Linear
- Output
Identify the problem with the following function declaration.
int sum(int a = 0,int b);
- Function declaration is correct.
- Parameter cannot be given default value in function declaration.
- All parameters that take default value, must appear to right of those that do not.
- Default argument of parameter cannot be zero.
Which language has exercised the greatest influence in the development of C++?
- ALGOL
- PASCAL
- C
- Simula 67
What is the output of the following C code?
#include<stdio.h>
int main()
{
short int i=0;
for(i;++i;i>=99)
printf(%d,i);
return 0;
}
- Infinite loop
- 1 to 32767 and then from -32768 to -1
- Compiler error
- Print from 1 to 99
What is the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
cout.setf(ios::hex,ios::basefield);
cout<<100;
return 0;
}
- 100
- 144
- 64
- 40
Which of the following cast operators is used to override volatile attribute of variable?
- dynamic_cast
- static_cast
- const_cast
- reinterpret_cast
Which of the following keywords is not defined in C++?
- Ttry
- catch
- throw
- finally
What is the output of the following C code?
#include<stdio.h>
int main()
{
int i=0;
for(;i++;printf(%d,i));
printf(%d,i);
return 0;
}
- Infinite loop
- Compilation error
- Runtime error
- 1
What is the output of the following C++ code?
#include <stdio.h>
int main()
{
int a,b;
a = (b=2,b+3);
printf(%d,a);
return 0;
}
- 2
- Garbage value
- 5
- None of the above
Which of the following is not a reserved word in Standard C++?
- Inline
- Continue
- Return
- Overload
What is the output of the following C++ code?
#include <iostream>
using namespace std;
int main ()
{
int a;
for (a = 1; a <= 1; a++) cout << a++;
cout<< <<a;
return 0;
}
- 1 1
- 1 2
- 1 3
- 1 4