More C++ placement model paper

More C++ placement model paper


1. Following is the not a correct statement for preprocessor directive declaration?

a) #include<iostream.h>
b) #include<iostream.h> #define LEFT 1
c) #define LEFT 1
d) #define ABS(a) (a)<0 ? –(a) : (a)
View Answer / Hide Answer

ANSWER: b) #include<iostream.h> #define LEFT 1




2. In C++ if return statements is written in a non-void function without any specified value, what will be return value of the function?

a) undefined
b) 1
c) 0
d) -1
View Answer / Hide Answer

ANSWER: a) undefined




3. In C++ how many return statements are allowed in a non-void function?

a) 1
b) as many as you like
c) 0
d) 2
View Answer / Hide Answer

ANSWER: b) as many as you like




4. In C++ if program executed successfully, following value will be returned to the calling process, if nothing specified in return statement?

a) 0
b) 1
c) -1
d) 2
View Answer / Hide Answer

ANSWER: a) 0




5. Individual characters in a string are accessed as following

a) cout << S.at(i);
b) cout << S[i];
c) both a) and b)
d) None
View Answer / Hide Answer

ANSWER: c) both a) and b)




6. Which of the following keyword is not used in exception handling

a) Try
b) allow
c) Catch
d) Throw
View Answer / Hide Answer

ANSWER: b) allow




7. We can throw exception in catch block

a)True
b)false
View Answer / Hide Answer

ANSWER: True




8. Which of the following is invalid header file name?

a) <iostring>
b) <string>
c) <iostream >
d) <sstream>
View Answer / Hide Answer

ANSWER: <iostring>




9. Following is not the correct syntax for exception handling

a) Type function (arg-list) throw(type-list)
{
}

b) Try (type-list)
{
}
Catch(type arg)
{
}

c) Try
{
_____
throw;
}
Catch(type arg)
{
Throw;
}

d) Try
{
_____
throw;
}
Catch(type arg)
{
Throw(exception);
}
Catch(type arg)
{
Throw;
}
View Answer / Hide Answer

ANSWER: b)




10. You can use C++ as a procedural, as well as an object-oriented language?

a) true
b) false
View Answer / Hide Answer

ANSWER: a) true




11. Inheriting a derived class from a base class needs vital changes to the base class?

a) true
b) false
View Answer / Hide Answer

ANSWER: b) false




12. The pow functions returns _____:

a) int
b) double
c) string
d) float
View Answer / Hide Answer

ANSWER: b) double




13. In the following statements,

class sports {};
class test : public student{};
class result : public test, public sports {};

//Here result class have implemented,

a) Hierarchical inheritance
b) Multiple inheritance
c) Multilevel inheritance
d) Both b) and c)
View Answer / Hide Answer

ANSWER: d) Both b) and c)




14. Which of the following are valid array declaration

a) int num(5)
b) float avg[5]
c) double[5] marks
d) counter int[5]
View Answer / Hide Answer

ANSWER: b) float avg[5]




15. Which of the following are valid array declaration

a) char str1[3] = “ab”
b) char str1[3] = “abc”
c) char str1[2] = “ab”
d) char str1[0] = “ab”
View Answer / Hide Answer

ANSWER: a) char str1[3] = “ab”




16. C++ supports ….

a) constant pointer
b) pointer to a constant
c) None of above
d) Both of above
View Answer / Hide Answer

ANSWER: d) Both of above




17. char * const ptr1 = “nice”;

//this is example of ,

a) constant pointer
b) pointer to a constant
c) None of above
d) Both of above
View Answer / Hide Answer

ANSWER: a) constant pointer




18. int const *ptr1 = &m;

// this is example of,

a) Constant pointer
b) Pointer to a constant
c) Both of above
d) None of above
View Answer / Hide Answer

ANSWER: b) Pointer to a constant




19. In the following statement,
const char * const cp = “xyz”;

a) Address assigned to pointer cp cannot be changed
b) contents it points to cannot be changed
c) Both of above
d) None of above
View Answer / Hide Answer

ANSWER: c) Both of above




20. In C++, symbolic constants created using

a) const
b) enum
c) Both of above
d) None of above
View Answer / Hide Answer

ANSWER: c) Both of above




21. A friend class in C++, can access the "__________" members of the class in which it is declared as a friend

a) private and protected
b) private and public
c) public and protected
d) Public
View Answer / Hide Answer

ANSWER: a) private and protected




22. A friend function that is a "friend" of a given class is allowed access to ______data in that class.

a) public, private, or protected
b) public or private
c) public
d) protected
View Answer / Hide Answer

ANSWER: a) public, private, or protected




23. Object can be used as a function argument by..

a) Pass by value
b) Pass by reference
c) None of above
d) All of above
View Answer / Hide Answer

ANSWER: d) All of above




24. In the following statements,

class X
{
int fun1 ();
};
class Y
{
friend int X :: fun1 ();
};

a) Function fun1() is member of class Y and friend of class X.
b) Function fun1() is member of class X and friend of class Y.
c) Function fun1() is member of class X and friend of class X.
d) Function fun1() is member of class Y and friend of class Y.
View Answer / Hide Answer

ANSWER: b) Function fun1() is member of class X and friend of class Y.




25. In the following statements,

class Z
{
friend class X;
};
a) All member function Z of are friend to X
b) All member function of X are friend to Z
c) All member function of X are friend to X
d) All member function of Z are friend to Z
View Answer / Hide Answer

ANSWER: b) All member function of X are friend to Z




26. In the following statements,

class ABC;
class ABC
{
};

a) It is called as forward declaration
b) It is called as backward declaration
c) It is called as middle declaration
d) It is called as simple declaration
View Answer / Hide Answer

ANSWER: a) It is called as forward declaration




27. Member function of one class can be friend function of another class

a) true
b) false
View Answer / Hide Answer

ANSWER: a) true




28. All member function of one class can be declared as friend function of another class, is called as

a) friend class
b) neighbor class
c) sister class
d) inherited class
View Answer / Hide Answer

ANSWER: a) friend class




29. in C++, an object can be returned as argument

a) false
b) true
View Answer / Hide Answer

ANSWER: b) true




30. Following is the dereferencing operator

a) ?::
b) &*
c) ->>
d) ->*
View Answer / Hide Answer

ANSWER: d) ->*




31. Inventor of C++ language is

a) John Dell
b) Bjarne Stroustrup
c) Thomusn Steve
d) Karl Thomus
View Answer / Hide Answer

ANSWER: b) Bjarne Stroustrup




32. Destructor can have following number of argument

a) 2
b) 1
c) 0
View Answer / Hide Answer

ANSWER: c) 0




33. While executing a program we first need to translate the source code into object code, it is called as

a) debugging
b) executing
c) compiling
View Answer / Hide Answer

ANSWER: c) compiling




34. Array elements are accessed using

a) ::
b) .
c) ->
d) Index number
View Answer / Hide Answer

ANSWER: d) Index number




35. Following operator cannot be used for operator overloading

a) +
b) ==
c) sizeof
View Answer / Hide Answer

ANSWER: c) sizeof




36. A function that is called automatically when an object is created is called as

a) constant
b) constructor
c) static
d) friend
View Answer / Hide Answer

ANSWER: b) constructor




37. The null character will take space of

a) 0 byte
b) 2 byte
c) 1 byte
d) 8 byte
View Answer / Hide Answer

ANSWER: c) 1 byte




38. This operator is used to allocate memory

a) new
b) delete
c) static
d) real

View Answer / Hide Answer

ANSWER: a) new




Post your comment

    Discussion

  • RE: More C++ placement model paper -sathyapriya (08/19/15)
  • we want
    program codes
  • RE: More C++ placement model paper -riaz (05/11/15)
  • answer of 6 question is---> throw