Programming in Modern C++ | NPTEL 2023 | Week 6 Assignment Solutions

This set of MCQ(multiple choice questions) focuses on the Programming in Modern C++ Week 6 Solutions.

Programming in C++ is so fundamental that all companies dealing with systems as well as application development (including web, IoT, embedded systems) have a need for the same. These include – Microsoft, Samsung, Xerox, Yahoo, Oracle, Google, IBM, TCS, Infosys, Amazon, Flipkart, etc. This course would help industry developers to be up-to-date with the advances in C++ so that they can remain at the state-of-the-art.

Course layout (Answers link)

Answers COMING SOON! Kindly Wait!

Week 0: Assignment answers
Week 1: Programming in C++ is Fun
Week 2: C++ as Better C.
Week 3: OOP in C++.
Week 4: OOP in C++. 
Week 5: Inheritance.
Week 6: Polymorphism. 
Week 7: Type Casting.
Week 8: Exceptions and Templates.
Week 9: Streams and STL
Week 10: Modern C++
Week 11: Lambda and Concurrency.
Week 12: Move, Rvalue and STL Containers.

NOTE: You can check your answer immediately by clicking show answer button. This set ofProgramming in Modern C++ Week 6 Solutions” contains 09 questions.

Now, start attempting the quiz.

Programming in Modern C++ Week 6 Solutions

Q1. Consider the following program.
What will be the output?

a) C1C4
b) C2C4
c) C1C3
d) C2C3

Answer: a) C1C4

Programming in Modern C++ Week 6 Solutions

Q2. Consider the code segment given below.
What will be the output?

a) 135642
b) 1352
c) 13542
d) 13562

Answer: b) 1352

Q3. Consider the code segment given below.
What will be the output?

a) 0 8 16
b) 8 16 24
c) 4 12 20
d) 8 16 16

Answer: b) 8 16 24

Q4. Consider the code segment given below.
What will be the output?

a) 0 8 16
b) 8 16 24
c) 4 12 20
d) 8 16 16

Answer: b) 8 16 24

Q5. Consider the code segment.
What will be the output?

a) A::f() B::g() C::h()
b) C::f() C::g() B::h()
c) C::f() B::g() B::h()
d) C::f() C::g() C::h()

Answer: c) C::f() B::g() B::h()

Programming in Modern C++ Week 6 Solutions

Q6. Consider the code segment given below.
Fill in the blank at LINE-1 so that the program will print A::f().

a) t->f()
b) classA::t->f()
c) classA::f()
d) t->classA::f()

Answer: d) t->classA::f()

Q7. Consider the code segment below.
The given program will not be compiled. Identify the correct reasons.

a) Line-1: Pure virtual function in Test cannot have a body
b) Line-2: Cannot instantiate abstract class
c) Line-3: Invalid new expression for abstract class type
d) Line-4: Cannot de-reference a null pointer

Answer: b), c)

Programming in Modern C++ Week 6 Solutions

Q8. Consider the code segment given below.
Which line/s will give you error?

a) Line-1
b) Line-2
c) Line-3
d) Line-4

Answer: a), d)

Programming in Modern C++ Week 6 Solutions

Q9. Consider the code segment given below.
Identify all abstract classes.

a) Flower, FlowerWColor, FlowerWOColor
b) Flower, FlowerWOColor, Rose
c) Flower, FlowerWColor, FlowerWOColor, Sunflower
d) Flower

Answer: b)

Previous – Programming in Modern C++ Week 6 Solutions

Q1.

Answer: a), c)

Q2.

Answer: d)

Q3.

Answer: c), d)

Q4.

Answer: b)

Q5.

Answer: b)

Programming in Modern C++ Week 6 Solutions

Q6.

Answer: c)

Programming in Modern C++ Week 6 Solutions

Q7.

Answer: c)

Q8.

Answer: b)

Programming in Modern C++ Week 6 Solutions

Q9.

Answer: d)

Programming in Modern C++ Week 6 Solutions

<< Prev- Programming in Modern C++ Week 5 Assignment Solutions

>> Next- Programming in Modern C++ Week 7 Assignment Solutions


DISCLAIMER: Use these answers only for the reference purpose. Quizermania doesn't claim these answers to be 100% correct. So, make sure you submit your assignments on the basis of your knowledge.

For discussion about any question, join the below comment section. And get the solution of your query. Also, try to share your thoughts about the topics covered in this particular quiz.