You are on page 1of 7

1. NULL Pointer can be used as A. To stop indirection in a recursive data structure B. As an error value C. As a sentinel Value D.

All of Above 2. Which one of the following is not the advantages of functions? A. Debugging is easier B. Testing is easier C. Recursive call is possible D. It consumes low disk space 3. To use the function tolower(), which of the following header file should include A. string.h B. conio.h C. ctype.h D. Dont need any header file 4. Which of the following is not a feature of C++ ? A. Operator overloading B. Namespaces C. Inheritance D. Reflection 5. What is the right way to declare a copy constructor of a class if the name of class is X ? A. X(const X* arg) B. X( const X& arg) C. X(X arg) D. X(X* arg) What is the correct value to return to the operating system upon the successful completion of a program? A. -1 B. 1 C. 0 D. Programs do not return a value. The result of a Relational operation is always A. either True or False B. is less than or is more than C. is equal or less or more D. All of these An Abstract class can be instantiated A. True B. False What is the difference between overloaded and overridden functions Overloading is a dynamic or run-time binding and Overriding is static or compile-time binding. Redefining a function in a friend class is called function overloading while Redefining a function in a derived class is called as overridden function Overloading is a dynamic or run-time binding and Overriding is static or compile-time binding Redefining a function in a friend class is called function overloading while Redefining a function in a derived class is called as overridden function. What is shallow copy? A shallow copy creates a copy of the dynamically allocated objects too A shallow copy just copies the values of the data as they are. A shallow copy creates a copy of the statically allocated objects too

6.

7.

8.

9. A. B. C. D. 10. A. B. C.

D. Both b and c above 11. Which operator is overloaded in given code

int FunctionObject::operator() (int inParam) { return doSquare(inParam); }


A. B. C. D. 12. No operator is overloaded Function call operator is overloaded Operator keyword is overloaded class FunctionObject is overloaded What is the output of the following code:

#include<iostream.h> main() { int *ptrl; ptrl=new int; *ptrl=20; *ptrl=*ptr+1; cout<< *ptrl; delete ptrl; return 0; }
A. B. C. D. 13. A. B. C. D. 14. A. B. 15. A. B. C. D. 16. 20 21 0x4536 An address of int. What defines a general set of operations that will be applied to various types of data? Template Class Function Template Class Both A and B There is nothing like a virtual constructor of a class. True False What is the Difference between struct and class in terms of Access Modifier? By default all the struct members are private while by default class members are public. By default all the struct members are protected while by default class members are private By default all the struct members are public while by default class members are private. By default all the struct members are public while by default class members are private. Which is correct with respect to size of the datatypes? A. char > int < float B. int < char > float C. char < int < float D. double < char > int 17. Void pointer can point to which type of objects? A. int B. float

18.

A. B. C. D. 19.

20.

21.

C. double D. all of the mentioned What is the output of this program? #include <iostream> using namespace std; int main() { int a[2][4] = {3, 6, 9, 12, 15, 18, 21, 24}; cout << *(a[1] + 2) << *(*(a + 1) + 2) << 2[1[a]]; return 0; } 15 18 21 21 21 21 24 24 24 Compile Time error What is meaning of following declaration? int(*p[5])(); A. p is pointer to function. B. p is array of pointer to function. C. p is pointer to such function which return type is array. D. p is pointer to array of function. What is the general syntax for accessing the namespace variable? A. namespaceid::operator B. namespace,operator C. namespace#operator D. none of the mentioned What will be the output of the program if value 25 given to scanf()?

#include<stdio.h> int main() { int i; printf("%d\n", scanf("%d", &i)); return 0; } A. 25 B. 2 C. 1 D. 5 22. Which of the following is correct way of using initialization list? a) b) c) d) 23. A::A(int x, char c) A::A()::x(5), c(a) A::A(x=6,c=a) None of the above Which of the following advantages we lose by using multiple inheritance? a) Dynamic binding

b) Polymorphism c) Both a & b d) None of the mentioned 24. What is the purpose of the given code:

void Fun(i, item) { queuePointer temp; MALLOC(temp, sizeof(*temp)); tempdata = item; templink = NULL; if (front[i]) rear[i]link = temp; else front[i] = temp; rear[i] = temp; }
a) Adds a node at first positions b) Adds a node at the last position c) Removes a first node d) Removes a last node 25. How many values can be held by each of the arrays a [n ], b [n ][m ], c [n ][2][3]? a) n, n+m, n+2+3 b) n, n*m, n*2*3 c) n,m, 3 d) 1, m, 2*3 26. What should be the most appropriate return type of the given function Fun

________ Stack<T>::Fun() const { return top == - 1;}


a) char b) float c) bool d) int 27. What is the run time complexity of reading an element from an array a) O(n) b) O(0) c) O(1) d) O(n2) 28. How do we define a destructor? A. X~(){}

B. X(){}~ C. ~X(){} D. X()~{} 29. The default access level assigned to members of a class in C++ is A. private B. public C. protected D. needs to be assigned 30. What are the following is/are not inherited from the base class? a) Constructor and its destructor b) Operator=() members c) Friends d) All of the above 31. Inline functions are invoked at the time of A. Run time B. Compile time C. Depends on how it is invoked D. Both b and c above

32. What is the output of the following program ? void strfunc(char **s) { char *n="Dylan"; *s=n;} void main() { char *str="Dylan"; *s=n; } void main() { char *str="Lennon''; strfunc(&str); cout<<str<<endl; }
A. B. C. D. Dylan Lennon Compile time error Run time error

33. A static variable is used a. not to retain a value b. to retain value c. to change the value

d. none of these. 34. Which of the following is not a storage class specifier ? a. auto b. static c. register d. constant e. None of these. 35. What will be the output of the following program ? #include<iostream.h> value(); main() { auto value=50; value=value==50; cout<<value; }
A. B. C. D. 1 50 2 3

36. An array element is accessed a. using dot operator b. using an index number c. using an element name d. none of these. 37. The statement weight = {26, 28, 32, 31}; a. assigns 28 to weight [0] b. assigns 28 to weight [1] c. assigns 32 to weight [3] d. none of these. 38. What is the output of the following program segment. char *NAME="CoMPuTER"; for(int x = 0; x<strlen(NAME);x++) if<islower(NAME[x]) NAME[x] = toupper(NAME[x]; else if(isupper(NAME[x] if<x%2 ==0)

NAME[x] = tolower(NAME[x]; else NAME[x] = NAME[x<196]; puts(NAME);


A. cOmmUTee. B. COMMUTEE C. Computer D. COMPUER 39. The Postfix form for A + [(B + C) + (D + E) * F]/G. A. ABC + DE + F* +G/+ B. ABCDE ++ F* +G/+ C. ABCDE ++ F +G/+* D. ABCDE++ F* +G/++

40. The null character is represented by A. \n B. \r C. \0 D. \l E. none of these.