II PUC - Viva Q & A

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

BANGALORE SOUTH PRACTICAL EXAMINATION, JAN -FEB ‘2025

VIVA QUESTIONS
(TO BE ASKED BASED ON THE PROGRAMS)
PART – A (C++)
1. Write a program to find the frequency of presence of an element in an array.
2. Write a program to create a class with data member principal, time and rate. Create member
functions to accept data values to compute simple interest and to display the result.
3. Write a program to create a class with data members a, b, c and member functions to input
data, compute the discriminant based on the following conditions and print the roots.
- If discriminant=0, print the roots that are equal
- If the discriminant is>0, print the real roots
- If the discriminant is<0, print that the roots are imaginary.

VIVA QUESTION AND ANSWERS


i. Which operator used to access member functions of a class?
Ans : Dot Operator ( . )
ii. Which operator used to define the member functions outside the class?
Ans : Scope Resolution Operator (::)
iii. Mention the default access specifiers of a class
Ans : private
iv. What is a class?
Ans : A class is a group of objects having similar characteristics
OR
A class is a user defined datatype consisting of data members and member
functions.
v. What is an object?
Ans : An object is an instance of a class which can access data members and member
functions of a class.
vi. Mention the different access specifiers in C++
Ans : private , public and protected
vii. Which characteristic of OOP is implemented by defining a class?
Ans : Data Encapsulation.

4. Write a program to insert an element into an array at a given position.


5. Write a program to delete an element from an array from a given position.
6. Write a program to sort the elements of an array in an ascending order using insertion sort.
7. Write a program to search an element in an array using Binary search method.

VIVA QUESTION AND ANSWERS


i. What is an array?
Ans : An array is a collection of elements of same type with a common name.
ii. What is insertion operation with respect to data structure? (Exclusively asked for
inserting an element into an array program )
Ans : It is a process of inserting / adding a new element into an existing array
iii. What is deletion operation with respect to data structure? (Exclusively asked for
deletion an element from an array program )
Ans : It is a process of deleting / removing an element from an existing array.
iv. What is searching? (Exclusively asked for Binary search program )
Ans : It is a process of finding an element and its location in an array.
v. What is the condition to apply binary search technique to search an element in an
array (Exclusively asked for Binary search program )
Ans : Elements should be in the sorted order (Ascending or Descending order)
vi. What is sorting? (Exclusively asked for Sorting program)
Ans : It is a process of arranging the elements in an ascending or descending order.
vii. Give an example for the primitive data structure
Ans : int , char , float , double
viii. Give an example for a linear data structure
Ans : array , stack , queue
ix. Give an example for non-linear data structure
Ans : Graph and Tree

8. Program to find the area of a square/rectangle/triangle using function overloading.

VIVA QUESTION AND ANSWERS


i. What is function overloading?
Ans : It is a process of having two or more functions with the same name but differs
in the argument list (Number of arguments and type of arguments)
ii. How does the C++ compiler identifies the particular function to be executed in a set of
overloaded functions.
Ans : It identifies based on number of arguments and/or type of arguments.
iii. Which characteristic of OOP is implemented using Function overloading?
Ans : Polymorphism
9. Program to find the cube of a number using inline function.

VIVA QUESTION AND ANSWERS


i. What is an inline function?
Ans : It is a short function which replaces the function call with the body of the
function.
ii. Give an advantage of an inline function.
Ans : Speed of execution of program increases (Or any relevant advantage)
iii. Mention any one disadvantage of an inline function
Ans : The size of executable file increases which requires more memory.
(Or any relevant disadvantage)

10. Write a program to find the sum of the series 1+x+x2+...+xn using constructor.

VIVA QUESTION AND ANSWERS


i. What is a constructor?
Ans : It is a special member function which has the same name as that of a class used
to initialize objects.
ii. When does a constructor is invoked?
Ans : It is invoked automatically when an object is created
iii. Mention the types of constructor.
Ans : Default Constructor, Parameterized constructor and Copy Constructor
iv. Which section of a class a constructor can be defined.
Ans : public Section

11. Create a base class containing the data members roll number and name. Also create a member
function to read and display the data using the concept of single level inheritance. Create a
derived class that contains marks of two subjects and total marks as the data members.

VIVA QUESTION AND ANSWERS


i. What is inheritance?
Ans : It is a process of one class acquiring the properties of another class
ii. What is a base class?
Ans : It is a class from which other classes are derived.
iii. What is derived class?
Ans : It is a class which is derived from the base class.
iv. Mention the operator used to create a derived class in C++
Ans : colon (:)

12. Create a class containing the following data members register No., name and fees. Also create
a member function to read and display the data using the concept of pointers to objects.

VIVA QUESTION AND ANSWERS


i. What is a pointer?
Ans : It is a variable which holds the address of another variable.
ii. Mention the address operator in C++
Ans : &
iii. Which operator is used to allocate memory dynamically?
Ans : new operator
iv. Which operator is used to deallocate memory dynamically?
Ans : delete operator

PART – B (HTML and SQL)


(HTML)

1. Write a HTML program to create a study time-table.


2. Create an HTML program with table and form.

VIVA QUESTION AND ANSWERS


i. Mention any one web browser.
Ans : Google chrome , Internet explorer , Microsoft edge.
ii. Mention the text formation tags in HTML
Ans : <B> - Bold , <I> - Italics , <U> - Underline
iii. What is the purpose of TR tag in HTML
Ans : It creates a table row
iv. What is DHTML
Ans : It is a web content which changes each time it is viewed.
v. Differentiate between check box and radio button (Exclusively asked for
Application form creation program using HTML)
Ans : Radio button is used to select only one item from a list of items.
Check box is used to select multiple items from a list of items.

vi. How do you change the background colour of a webpage


Ans : Using BGCOLOR
vii. Mention the tag used to scroll a text from one place to another in HTML
Ans : MARQUEE Tag
viii. Mention the tag used to link from one webpage to another.
Ans : ANCHOR ( <A> ) Tag

(SQL)

1. SQL program to generate Electricity Bill for 10 Consumers


2. SQL program to create student database and compute result.

VIVA QUESTION AND ANSWERS


i. Which command is used to add new columns to the existing table
Ans : Alter Command
ii. Which command is used to count the number of records in a table
Ans : Using Count() group function
iii. Differentiate between drop and delete command in SQL
Ans : drop command is used to delete entire structure of the table
delete command is used to delete the records of the table.
iv. Which clause in SQL is used to sort the records based on one or more columns
Ans : Order By clause
v. Which command is used to modify the records of the table
Ans : Update Command
vi. Mention the DDL commands in SQL
Ans : Create , Alter and Drop commands
vii. Mention the DML commands in SQL
Ans : Insert , update and delete commands
viii. Which command is used to retrieve the records of the table.
Ans : Select Command

PLEASE NOTE : 1. Definition based questions – Any valid / relevant definitions can be
considered.

2. Example based questions – Any valid / relevant example can be


considered.

You might also like