CS301_191
CS301_191
Tech/CSE/CS301/Odd/R21/R / 1
Roll Number
Group A
(Multiple Choice Type Questions)
Answer any ten from the following, choosing the correct alternative of each question: 10×1=10
1. What is a Constructor? (1) CO1 BL1
a) Constructor is a member function of the class having the same name as the class.
A constructor is a special type of member function of a class which initializes objects
b) of a class.
A constructor is special member function of the class because it does not have any
c) return type.
d) All of these
2. The C++ code which causes abnormal termination/behaviour of a (1) CO1 BL1
program should be written under _________ block.
a) catch
b) class
c) try
d) throw
12/22/2023 9:29:36 AM
B.Tech/CSE/CS301/Odd/R21/R / 1
b) == operator
c) :: operator
d) ++ operator
6. How can we restrict dynamic allocation of objects of a class using (1) CO5 BL1
new?
a) By overloading new operator
b) By making an empty private new operator
c) By making an empty private new and new[] operator
d) By overloading new and new[] operator
return (a + b + c);
int main()
return 0;
a) 12
b) 17
c) 15
d) Syntax error
8. What is the difference between protected and private access (1) CO3 BL1
specifiers in inheritance?
a) Private member is not inheritable and not accessible in derived class.
b) Protected member is inheritable and also accessible in derived class.
c) Both are inheritable but private is accessible in the derived class.
d) Both are inheritable but protected is not accessible in the derived class.
9. Which of the following software is used for numerical computing? (1) CO1 BL1
a) MATLAB
b) Simulink
c) LabVIEW
d) Pspice
10. What is the correct way to declare a pointer in C++? (1) CO3 BL2
12/22/2023 9:29:36 AM
B.Tech/CSE/CS301/Odd/R21/R / 1
a) int ptr;
b) int *ptr
c) ptr int
d) pointer int
11. How to clear the command window in matlab? (1) CO5 BL1
a) clear
b) clc
c) close all
d) clear all
12. What will be the output of the following C++ code snippet? (1) CO1 BL3
#include <stdio.h>
#include<iostream>
using namespace std;
int main ()
{
int array[] = {0, 2, 4, 6, 7, 5, 3};
int n, result = 0;
for (n = 0; n < 8; n++)
{
result += array[n];
}
cout << result;
return 0;
}
a) 25
b) 27
c) 26
d) 21
Group B
(Short Answer Type Questions)
(Answer any three of the following) 3x5=15
13a. What is Object Oriented Programming? (2) CO1 BL1
13b. What is class and object? (3) CO1 BL1
14. Explain Virtual base class with suitable example. (5) CO2 BL2
15. Answer all: (5)
a) What do you mean by copy constructor? Give an example of it. (2) CO3 BL2
b) Illustrate with an example, how the setw manipulator works. (3) CO3 BL4
16. Write a program to open a file named "myfile.txt" and write your (5) CO3 BL4
name, roll, and department in your file.
17. Write a C++ program demonstrating use of the pure virtual function (5) CO4 BL3
with the use of base and derived classes.
Group C
(Long Answer Type Questions)
(Answer any three of the following) 3x15=45
12/22/2023 9:29:36 AM
B.Tech/CSE/CS301/Odd/R21/R / 1
=> B = [ 5,10,15]
=> A. *B
a) What is the difference between exception and error? Write down the (7) CO4 BL1
exception handling mechanism in c++ with proper example.
b) What is template? Describe all the types of the templates with an (8) CO4 BL2
example.
22. Write short note on any three (15)
a) Abstract class (5) CO1 BL2
b) This pointer (5) CO1 BL2
c) Polymorphism (5) CO1 BL2
d) Function overloading vs. function overriding (5) CO1 BL2
e) Copy constructor (5) CO1 BL2
12/22/2023 9:29:36 AM