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

Subject: Cpp Programming 19

**Part 19: List for questions and answers of C ++ Language**

** **

**Q1. Which of the following expressions accesses the (i,j)th entry of an (m x n) matrix stored in**

**column major form?**

a) n x (i -1) + j

b) m x (n-j) + j

c) m x(j -1) + i

d) n x(m-i) + j

** **

**Q2. Sparse matrices have**

a) many zero entries

b) higher dimension

c) many non-zero entries

d) none of the above

** **

**Q3. The minimum number of edges in a connected cyclic graph on n vertices is**

a) n-1

b) n

c) n+1

d) none of the above

** **

**Q4. The minimum number of colors needed to color a graph having n (>3) vertices and 2 ****edges is**

a) 4

b) 3

c) 2

d) 1

** **

**Q5. Which of the following is useful in traversing a given graph by breadth first search?**

a) stacks

b) set

c) List

d) Queue

** **

**Q6. Which of the following is useful in implementing quick sort?**

a) Stacks

b) set

c) List

d) Queue

**Q7. The maximum degree of any vertex in a simple graph with n vertices is**

a) n

b) n-1

c) n+1

d) 2n-1

** **

**Q8. The number of edges in a regular graph of degree d and n vertices is**

a) maximum of n,d

b) n+d

c) nd

d) nd/2

** **

**Q9. Find the correct matching of the following pair**

(A) All pairs shortest path

(B) Quick sort

(C) Minimum weight spanning tree

(D) Connected Components

(1) Greedy (2) Depth-first search (3) Dynamic programming (4) Divide and conquer

a) A-2 , B-4 , C-1 , D-3

b) A-3 , B-4 , C-1 , D-2

c) A-3 , B-4 , C-2 , D-1

d) A-4 , B-1 , C-2 , D-3

** **

**Q10. Which of the following expressions accesses the (i,j)th entry of an (m x n) matrix stored ****in column major form?**

a) n x (i -1) + j

b) m x (j -1) + i

c) m x (n-j) + j

d) n x (m-i) + j

** **

**Q11. Sparse matrices have**

a) many zero entries

b) many non-zero entries

c) higher dimension

d) none of the above

** **

**Q12. The minimum number of edges in a connected cyclic graph on n vertices is**

a) n-1

b) n

c) n+1

d) none of the above

** **

**Q13. The private data members of a class are accessible ?**

a) Directly to objects of that class

b) To any function defined outside a class

c) Only to the member functions

d) Only using keyword static

** **

**Q14. In C++ Functions can returns ?**

a) arrays

b) reference

c) objects

d) all of above

** **

**Q15. What among following is a generic class ?**

a) Function Template

b) Class Template

c) Inherited Template

d) None of above

** **

**Q16. A virtual base class ?**

a) is qualified as virtual in base class definition

b) do not qualified as virtual in base class definition

c) allows to inherit more than one copy of the base class members

d) strict the path of inheritance

** **

**Q17. A class having no public constructors is**

a) A public protected class

b) A public class

c) A protected class

d) A private class

** **

**Q18. What is default scope for a structure ?**

a) Private

b) Protected

c) Public

d) None of above

** **

**Q19. The objects can directly access ?**

a) Public members

b) Private members

c) Both of above

d) None of above

** **

**Q20. The advantage of declaring a virtual function as pure is ?**

a) programs runs faster

b) early binding can be achieved

c) you force any derived class to define its own implementation

d) you can avoid making the class an abstract class

** **

**Part 19: List for questions and answers of C ++ Language**

Q1. Answer: c

Q2. Answer: a

Q3. Answer: b

Q4. Answer: c

Q5. Answer: d

Q6. Answer: a

Q7. Answer: b

Q8. Answer: d

Q9. Answer: b

Q10. Answer: b

Q11. Answer: a

Q12. Answer: b

Q13. Answer: c

Q14. Answer: d

Q15. Answer: b

Q16. Answer: a

Q17. Answer: d

Q18. Answer: c

Q19. Answer: a

Q20. Answer: c