Programming in Modern C++ Week 8 Assignment Answers
Are you looking for the NPTEL Programming in Modern C++ Week 8 Assignment Answers? You’ve come to the right place! This resource provides comprehensive solutions to all the questions from the Week 8 assignment, helping you navigate through the complexities of modern C++ programming.
Table of Contents
Programming in Modern C++ Week 8 Assignment Answers (Jan-Apr 2025)
Course Link: Click Here
1) Consider the following program.
What will be the outputs in consecutive two runs if statement—I is replaced by (i) testlt(3.14); and (ii) testlt(0); respectively?
a) int and (ii) string
b) double and (ii) string
c) float and (ii) anything else
d) double and (ii) anything else
2) Consider the following code segment.
What will be the output?
a) internal exception
b) SQL exception
c) DB exception
d) default
3) Consider the following code segment.
What will be the output?
a) internal error
b) sql error
c) db error
d) default
4) Consider the following code segment.
What will be the output/error?
a) default
b) int
c) double
d) Compiler error, handler must be the last handler for its try block
Programming in Modern C++ Week 8 Assignment Answers
5) Consider the following code segment.
Identify the appropriate option to fill in the blanks at LINE—I and LINE—2 such that the output becomes 22.44, program.
a) LINE-I: class Modifier LINE-2: class Modifier
b) LINE-I: template LINE-2: template
c) LINE-I: class Modifier LINE-2: class Modifier
d) LINE-I: class Modifier LINE-2: template
6) Consider the following code segment.
What will be the output/error?
a) 3
b) hello hello hello
c) Compiler error at LINE—I: non-type argument is not allowed
d) Compiler error at LINE-2: non-type argument must be constant
Programming in Modern C++ Week 8 Assignment Answers
7) Consider the following function template.
From among the following options, which generate(s) compiler error?
a) print(10, ‘a’);
b) print(10, 30);
c) print(10.34, 30);
d) print((int)’a’30)
8) Consider the following class definition in C++.
What is the appropriate function pointer declaration that can point to the function sum belonging to the class Computation as fpm = &Computation::sum;
?
a) typedef int (Computation: : * fpm) (int, int);
b) int Computation: : fpm(int, int);
c)int (Computation: : fpm) (int, int);
d)int (Computation: : *fpm) (int, int);
9) Consider the following code segment.
Identify the appropriate option to fill in the blank at LINE—I such that the output becomes d = 11
.
a) int operator(int d1, int d2)
b) int operator() (int d1, int d2)
c) void operator() (int d1, int d2)
d) int operator(int d1, int d2) ( )
Programming in Modern C++ Week 8 Assignment Answers
For answers to others Nptel courses, please refer to this link: NPTEL Assignment