0% found this document useful (0 votes)
3 views4 pages

CS301_191

This document outlines the structure and content of the end semester examination for the IT Workshop course at Narula Institute of Technology. It includes multiple choice questions, short answer questions, and long answer questions related to C++, MATLAB, and object-oriented programming concepts. The exam is designed to assess students' understanding of various programming principles and their ability to apply them in practical scenarios.

Uploaded by

profile.ankitdas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

CS301_191

This document outlines the structure and content of the end semester examination for the IT Workshop course at Narula Institute of Technology. It includes multiple choice questions, short answer questions, and long answer questions related to C++, MATLAB, and object-oriented programming concepts. The exam is designed to assess students' understanding of various programming principles and their ability to apply them in practical scenarios.

Uploaded by

profile.ankitdas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

B.

Tech/CSE/CS301/Odd/R21/R / 1

Roll Number

Narula Institute of Technology


An Autonomous Institute under MAKAUT
2023
END SEMESTER EXAMINATION - ODD 2023
CS301 - IT WORKSHOP (SCILAB/MATLAB/C++)
TIME ALLOTTED: 3Hours FULL MARKS: 70

Instructions to the candidate:


Figures to the right indicate full marks.
Draw neat sketches and diagram wherever is necessary.
Candidates are required to give their answers in their own words as far as practicable

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

3. An abstract class is designed to act as a (1) CO2 BL1


a) Base class
b) Friend class
c) Derived class
d) Sub class

4. Define template. (1) CO4 BL1


a) A template is a formula for creating a generic class
b) A template is used to manipulate the class
c) A template is used for creating the attributes
d) none of the mentioned

5. Which of the following can’t be overloaded? (1) CO3 BL1


a) + operator

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

7. Predict the output of following C++ programs. (1) CO3 BL3


#include <iostream>

using namespace std;

int fun(int a, int b = 1, int c =2)

return (a + b + c);

int main()

cout << fun(12,3);

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

18. Answer all: (15)


a) Develop a program to create a class Employee that contains the (10) CO4 BL6
details about an employee (such as,empName, empId, dept etc.)
and another class Project that contains the details about a project
(like, projectName, timeDuration, etc.). Display all the details of an
employee along with the details of the project assigned to him/ her.
Implement the program by applying inheritance
b) What is C++ access modifier? Differentiate between static method (5) CO3 BL1
and static variable.
19. Answer all: (15)
a) Write a C++ Program to display the reverse of a number using the (7) CO3 BL3
Friend function.
b) Create a program in CPP to copy a text file to another file. (8) CO4 BL3
20. Answer all: (15)
a) Develop a program in CPP that will overload the < (less than) (10) CO3 BL3
operator to check whether one object of a class A is lesser than
another object of class B.
b) Evaluate the following in MATLAB and write the output: (5) CO1 BL5
a) => A= [10,20,30]

=> B = [ 5,10,15]

=> A. *B

b) => round ([1.2 1.5 1.9 -1.2])

21. Answer all: (15)

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy