Cpp Programming 5

COEP
Lets Crack Online Exam

IT Interview Exam Questions: Cpp Programming 5 (IT Interview Exam Question, IT Campus Placement)

Subject: Cpp Programming 5

Part 5: List for questions and answers of C ++ Language

 

Q1. The signature of a function is its ….. ?

a) Function code

b) Prototype

c) Call

d) Parameter list

 

Q2. What is true about inline functions ?

a) It’s a compulsion on the compiler to make function inline

b) It’s a request to the compiler to make te function inline

c) It’s the indication to the compiler that the function is recursive

d) It’s the indication to the compiler that the function is member function

 

Q3. Which member function of class cannot modify its objects attributes ?

a) friend functions

b) Private member functions

c) Constant member functions

d) Static member functions

 

Q4. Which of the following parameter passing mechanism is/are supported by C++ but not in C?

a) Pass by value

b) Pass by reference

c) Pass by value result

d) All of the above

 

Q5. Which of the following type of function is an ideal candidate for being declared inline ?

a) A function that is small and is not called frequently

b) A function that is small and is called frequently

c) A function that is not small and is not called frequently

d) A function that is not small and is called frequently

 

Q6. One of the disadvantage of pass by reference is that the called function may inadvertently corrupt the called data.This is avoided by ?

a) passing pointers

b) declaring the formal parameters constant

c) declaring the actual parameters constant

d) all of above 

 

Q7. The library function exit() causes an exit from ?

a) The loop in which it occurs

b) The block in which it occurs

c) The function in which it occurs

d) The program in which it occurs

 

Q8. The getche() library function

a) returns a character when any key is pressed

b) returns a character when ENTER is pressed

c) displays a character on the screen when any key is pressed

d) does not display a character on the screen

 

Q9. When an argument is passed by reference

a) a variable is created in function to hold the argument value

b) the function cannot access the argument value

c) a temporary variable is created in the calling program to hold arguments value

d) None of these

 

Q10. Overloaded function

a) are a group of functions,with the same value

b) all have the same number and types of arguments

c) make life simpler for programmers

d) may fail unexpectedly due to stress

 

Q11. Using turbo C++ library function can ?

a) color any closed figure

b) draw lines and circles

c) write in variety of fonts and sizes

d) all of above

 

Q12. A friend function can be used to ?

a) avoid arguments between classes

b) allow access to classes whose source code is unavailable

c) allow one class to access an unrelated class

d) increase the versatility of an overloaded operator

 

Q13. A static function

a) should be called when an object is destroyed

b) is closely connected with an individual object of a class

c) can be called using the class name and function

d) is used when a dummy object must be created 

 

Q14. Dividing a program into functions

a) is the key to object oriented programming

b) makes the program easier to conceptualize

c) makes the program run faster

d) both (B) and (C)

 

Q15. Static Member function

a) can access any other member function and member variables

b) can access only static member variables and member functions

c) can be only called through object of the class

d) Returns only static data

 

Q16. A friend function

a) is declared as a friend and defined elsewhere in the program

b) is always an inline function

c) created objects without initialization

d) May be a static member function of the class

 

Q17. Which of the following function prototype is perfectly acceptable?

a) int Function(int Tmp = Show());

b) float Function(int Tmp = Show(int, float));

c) Both A and B

d) float = Show(int, float) Function(Tmp);

 

Q18. Which of the following statement is correct?

a) C++ enables to define functions that take constants as an argument

b) We cannot change the argument of the function that that are declared as constant

c) Both A and B

d) We cannot use the constant while defining the function

 

Q19. Which of the following statement is correct?

a) Overloaded functions can have at most one default argument

b) An overloaded function cannot have default argument

c) All arguments of an overloaded function can be default

d) A function if overloaded more than once cannot have default argument 

 

Q20. Which of the following statement will be correct if the function has three arguments passed to it?

a) The trailing argument will be the default argument

b) The first argument will be the default argument

c) The middle argument will be the default argument

d) All the argument will be the default argument 

 

Part 5: List for questions and answers of C ++ Language

 

Q1. Answer: b

 

Q2. Answer: b

 

Q3. Answer: c

 

Q4. Answer: b

 

Q5. Answer: b

 

Q6. Answer: b

 

Q7. Answer: d

 

Q8. Answer: a

 

Q9. Answer: a

 

Q10. Answer: c

 

Q11. Answer: d

 

Q12. Answer: c

 

Q13. Answer: c

 

Q14. Answer: c

 

Q15. Answer: b

 

Q16. Answer: a

 

Q17. Answer: a

 

Q18. Answer: c

 

Q19. Answer: c

 

Q20. Answer: a