[go: up one dir, main page]

0% found this document useful (0 votes)
26 views5 pages

C++ Qbank

Uploaded by

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

C++ Qbank

Uploaded by

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

SRI KRISHNA COLLEGE OF ENGINEERING AND TECHNOLOGY

An Autonomous Institution, Affiliated to Anna University,


Kuniamuthur, Coimbatore – 641 008.

23CS101 – PROBLEM SOLVING USING C++

QUESTION BANK

Part A

1. Define “this” keyword.


2. Explain the default and parameter constructor.
3. Explain about polymorphism. Discuss about function overload.
4. List out the operators that cannot be overloaded in C++.
5. Define method overriding.
6. Discuss about abstract function.
7. List the uses of Exception handling.
8. Discuss about File Pointer.
9. Explain Linked list STL with example.
10. Give the syntax on how to create a vector

11. Give short notes on class and object.


12.
Explain destructor? Give an example with output.
13.
Narrate the operator overloading.
14.
Explain the inheritance in C++.
15.
Define abstract class.
16.
Discuss about exception handling.
17.
Illustrate the use of iterator in vector with a suitable example.
18.
Describe the working functionality of set STL in C++.
19.
Explain the implementation of lambda function.
20.
Build the program using vectors that sort numbers in descending order.

Part – B

21. Briefly explain the shallow and deep copying. Explain with example.
22. Explain about Default, parameter constructor and destructor
23. Construct a C++ program,
Let's use equals() in our application to reduce redundancy. Same halls
cannot be booked on the same date for two different events. So get the
halls booked by two different persons and check whether it is same or not.
Use equals method to check all attributes of the hall are equal including
booking date.
Create Hall class with following private attributes
Include appropriate getters and setters
Create Default and Parameterized Constructor as Hall(String name, String
contactNumber, Double costPerDay, String ownerName) for the class.
Override equals method that compares all the fields of the class.
Create a driver class named Main to test the above class.
Input Format
Input consist of two sets of hall booking details
Output Format
Output prints whether the booked halls are same or not

Sample Input
Benny
9089078654
1000
Dayal
Samir
9789432346
2000
Sample Output
Dev
Halls are different
24. Give short notes on copy constructor with example.
25. Discuss about friend function with example
26. Build a C++ program, Create two classes A and B with x and y as their
private attributes.
Both classes have a public member function setdata(int) - Assign the
values to x and y. Declare a friend function in both the classes - void
min(int,int) - prints the minimum of x and y.
Create a driver class main and access the methods.
Input Format
The input consists of the values of x and y.
Output Format
The output prints a minimum of two numbers.
Sample Input
10 20
Sample Output
10
27. Discuss in detail about Inheritance. Give suitable example.
28. Write a C++ program to find the difference between two time periods using
structures.
Input Format
Input consists of two lines that give two time periods where each line has
hours, minutes, and seconds values separated by a space.
Output Format
Output is displayed as shown in sample test cases.
If constraints are violated, print -1.
Constraints
0<=hours<24
0<=minutes<60
0<=seconds<60
Sample Input
5 42 59
3 58 20
Sample Output
Difference: 5:42:59 - 3:58:20 = 1:44:39
29. Discuss about abstract class with example.
30. Give short notes on Exception Handling with example.
31. Build a C++ program,
Create a parent class as Employee with empId (int ) attribute and create a
child class as salary with attribute working_hours (int).
Calculate the total salary inside the child class.
Note: Total salary = working_hours*50.
Example
Input Output
2 Employee Id:2
500 No. of Hours Worked = 500
Total Salary = 25000
Explanation
Evaluate total salary by finding the product of hours worked by 50.
Sample Input
2 500
Sample Output
Employee Id:2
No. of Hours Worked = 500
Total Salary = 25000
32. Explain Various file I/O operations.
33. Elaborate on lambda functions. Explain the use of lambda function with
example.
34. Explain the following STL Concepts with the proper examples,
i)Vector ii)List
35. Give a short note on following oops concepts.
a) Encapsulation b) Access Modifier. c) Inheritance d) Abstraction
36. Discuss about the different types of access modifier.
37. Build the C++ program,
Construct Sunrise Basket founder has decided to organize a fun event at
your college. The event coordinator has announced a coding contest for
creating the application for the Contest. The Best application would be
used for the fair and the developer gets a cash prize. You are a well-
versed and aspiring Programmer in your college. Many programmers have
enrolled themselves for the contest and you are one of them. Every
contestant is provided with a Schema diagram of the Fair. Get yourself
acquainted with Schema and brace yourself for the challenge!!!.
As a part of this, the Application requires a user prompt to create a new
Item type. Hence create an ItemType class with the following attributes.
1. name (String)
2. deposit(double)
3. costPerDay(double)
Include appropriate Getters and Setters for the class and also include a
method "void display()" to display the output shown in the sample output. In
the main method get input from the user and display it.
Example
Input
Fan
5000
300
Output
Name : Fan
Deposit Amount : 5000
Cost per day : 300
Explanation
Read the item type from the user and display the item name, amount and
per day amount.
38. Discuss the use of constructor. Explain default and parameter constructor
with example.
39. Explain the abstract class and function with example.
40. Write a C++ program to find the difference between two time periods using
structures.
Input Format
Input consists of two lines that give two time periods where each line has
hours, minutes, and seconds values separated by a space.
Output Format
Output is displayed as shown in sample test cases.
If constraints are violated, print -1.
Constraints
0<=hours<24
0<=minutes<60
0<=seconds<60
41. Explain the multiple and multilevel Inheritance. Explain with example
42. Discuss about the virtual function in detail.
43. Give short notes on Exception Handling with example.
44. Discuss about polymorphism in C++.
45. Write a C++ program,
Construct two subclasses named Dog and Cat to override the method
Animal.
Input Format
No console input.
Output Format
Print the String from subclass named Dog and Cat in separate lines.
46. Discuss in detail lambda function. Explain the use of lambda function with
example.
47. Write a C++ program to concatenate two strings using lambda
expressions.
The lambda expression takes two strings as argument and returns the
concatenated string.
Input Format
The input consists of two strings.
Output Format
The output prints the concatenated string.
Sample Input
Hello
World
Sample Output
Hello World
48. Discuss about generic program in C++.
49. Construct a C++ program to sort the integer vector elements in descending
order using lambda expressions.
Sample Input
5
10 20 30 40 50
Sample Output
50 40 30 20 10

You might also like