Programming in Modern C++ | NPTEL | Week 8 Assignment Solutions

This set of MCQ(multiple choice questions) focuses on the Programming in Modern C++ Week 8 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 8 Solutions” contains 09 questions.

Now, start attempting the quiz.

Programming in Modern C++ Week 8 Solutions

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

a) all
b) BEx
c) Error at LINE-1
d) Error at LINE-2

Answer: d) Error at LINE-2

Programming in Modern C++ Week 8 Solutions

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

a) CEx int
b) BEx all
c) BEx BEx all
d) AEx CEx int

Answer: b) BEx all

Q3. Consider the following code segment.
What will be the output?

a) BEx AEx CEx
b) BEx AEx AEx
c) AEx AEx AEx
d) BEx BEx BEx

Answer: a) BEx AEx CEx

Programming in Modern C++ Week 8 Solutions

Q4. Consider the code segment given below.
What will be hte outputs in consecutive two runs if statement-1 is replaced by (i) evalEx(8.5); and (ii) evalEx(0); respectively?

a) (i) int and (ii) cstring
b) (i) double and (ii) cstring
c) (i) float and (ii) unknown
d) (i) double and (ii) unknown

Answer: a) (i) int and (ii) cstring

Q5. Consider the code segment given below.
Fill in the blank at LINE-1 such that the ouput of the program is:
X -> 4.5
A -> B
65 -> B

a) template<typename T1, typename T2>
b) template<typename T1 = int, typename T2 = char>
c) template<typename T1 = char, typename T2 = char>
d) template<typename T1 = int, typename T2 = int>

Answer: b)

Programming in Modern C++ Week 8 Solutions

Q6. Consider the code sgement given below.
Which of the following statement/s used to fill in the blank at LINE-1 that results in compiler error?

a) add(10, 20)
b) add(10, 20.5)
c) add(10.5, 20.5)
d) add(10.5f, 20.5)

Answer: b), d)

Q7. Consider the code sgement below.
What will be the output?

a) 18 30 35
b) 18 30 35 22
c) 18 30 35 22 <garbage-value>
d) Compiler error at LINE-1

Answer: d) Compiler error at LINE-1

Programming in Modern C++ Week 8 Solutions

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

a) cat deer rabbit sheep
b) sheep rabbit deer cat
c) cat deer sheep rabbit
d) rabbit sheep deer cat

Answer: c) cat deer sheep rabbit

Programming in Modern C++ Week 8 Solutions

Q9. Consider the following class definition in C++ 11.
Identify the appropriate function pointer declaration that can point to the function alert belongs to the class Notification as fp = &Notification :: alert;

a) typedef void (Notification :: &fp) (const char *);
b) void *Notification :: fp (const char *);
c) void (*Notification :: fp) (const char *);
d) void (Notification :: fp) (const char *);

Answer: d)

Programming in Modern C++ Week 8 Solutions

Q1.

Answer: a)

Programming in Modern C++ Week 8 Solutions

Q2.

Answer: d)

Q3.

Answer: d)

Q4.

Answer: b)

Q5.

Answer: a), c)

Programming in Modern C++ NPTEL Week 8 Assignment Solutions

Q6.

Answer: b)

Q7.

Answer: a)

Programming in Modern C++ NPTEL Week 8 Assignment Solutions

Q8.

Answer: c)

Programming in Modern C++ NPTEL Week 8 Assignment Solutions

Q9.

Answer: b)

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

>> Next- Programming in Modern C++ Week 9 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.