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

CSE202 Viva questions

The document provides a list of important viva questions related to CSE202, covering topics such as the differences between programming paradigms, object-oriented programming principles, constructors and destructors, inheritance types, polymorphism, and memory management. It also includes questions about pointers, arrays, and standard template library (STL) components. This is a concise guide for students preparing for their viva examination.

Uploaded by

Vinay 0808
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)
11 views4 pages

CSE202 Viva questions

The document provides a list of important viva questions related to CSE202, covering topics such as the differences between programming paradigms, object-oriented programming principles, constructors and destructors, inheritance types, polymorphism, and memory management. It also includes questions about pointers, arrays, and standard template library (STL) components. This is a concise guide for students preparing for their viva examination.

Uploaded by

Vinay 0808
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/ 4

CSE202 Viva questions

Disclaimer: This is not a complete list, just a few important viva questions.
1. Difference between POP and OOP
Procedure oriented programming emphasizes mainly on functions, OOP
emphasizes on objects
2. Pillars of object oriented programming
Abstraction, Encapsulation, Polymorphism, Inheritance
3. Difference between structure and classes
Classes allow data hiding through access specifiers, but structure
doesn’t. By default, members of structure are accessible everywhere but
in class, every member is private by default.
4. Difference between class and object.
Class is a definition but object collection of real data. Memory is
allocated at creation of object, not class.
5. What is the datatype of object?
Object is the variable of its class type. So classname is the datatype of its
object.
6. What is cin and cout?
Cin is object of istream class and cout is object of ostream class.
7. Access specifiers – public, private, protected
8. What is scope resolution operator?
Operator used to associate classname with a member function or static
variable when they are defined outside the class.
returntype Classname:: memberfunction()
9. What is friend function?
Any function which is not member of class but has access to private
members. Friend keyword is used in declaration of function
10.Strings and their inbuilt functions..
11.What is constructor? Why it is special?
Special function having same name as class, called automatically when
object is created.
12.Can constructors be overloaded?
Yes, because they are functions.
13.Types of constructor –
Default, Parametrized, Constructor with default parameters, Copy,
Dynamic (having new operator in constructor)
14.What is destructor? When it is called?
Same name as of class with a ~(tilde) sign, called automatically when
object goes out of scope or when program ends.
15.What are manipulators?
Functions or objects to modify i/o stream like formatting while displaying
output. Eg. endl, setw, setprecision
Iomanip.h header file is used with manipulators.
16.Which header file is used for file handling?
- ifstream.h for only reading, ofstream.h for only writing, fstream.h for
both r/w.
17.File pointers
get (for reading) and put (for writing) pointers, associated functions are
seekg(), seekp(), tellg(), tellp()
18.File modes –
read, write, trunc, append..
19.Types of inheritance
Single, multiple, multilevel, hierarchical, hybrid
20.Modes of inheritance
Public, private, protected mode
21.What is the ambiguity in inheritance?
In hybrid inheritance, when multiple copies of base class members are
received to child class though all parent classes.
22.Where is virtual class used?/ How to remove ambiguity in inheritance?
Virtual classes are used to remove ambiguity in hybrid inheritance.
23.Types of polymorphism
Compile-time (early-binding): implemented through function
overloading and operator overloading
Runtime (Late-binding): Achieved through virtual functions
24.What is operator overloading?
In-built operators are given extra meaning when they are used with
objects.
25.Difference between function overloading and function overriding.
Function overloading is concept of compile time polymorphism, where
multiple functions have same name but different arguments. (Arguments
can be different in form of data types, number, sequence)
Function overriding is a concept of polymorphism in Inheritance where
function in base class has exactly same function signature as derived
class, only definition of function changes.
26.What are virtual functions?
In order to achieve runtime polymorphism, virtual keyword is applied to
base class overridden function.
27.What is dynamic memory allocation?
Memory allocated at runtime using new keyword.
28.Difference between new and malloc
New is keyword, malloc() is function. New doesn’t reallocate memory,
realloc() is used to reallocate memory.
29.What is exception handling?
Exceptions are runtime errors or situations which arise unexpected
results. Handled with try, catch and throw statement.
30.What is template class?
A generalized class which can be used for members with any data type
31.What are the contents of STL?
- Containers, Algorithms, Iterators
32.Difference between array and vector
Array has fixed size, vector is dynamic. For vector, object is created, array
is created using- datatype arrayname[size]

Basics:
1. What is pointer?
A variable that holds the memory address of some other entity.
2. Types of pointers
Null, generic, wild, dangling
3. Difference between call by value, call by reference, call by address
4. Arrays, meaning of array name.
Array name itself is a pointer to the base address of array
5. What is memory leak?
6. What are references in C++?
A way to create an alias of a variable.
For eg int a = 5;
int &b = a; here b becomes alias of a.
7. Meanings of functions like
get() – read single character from input file stream
put() – write single character to an output file stream
getch() – read single character from keyboard
getche() – read single character from keyboard with echo
gets() - read whole line or string until new character from keyboard
puts() - read whole line or string until new character to screen

You might also like