C++ Class 11 Viva Voce & Answers 2021 - 22 CBSE

 C++ Class 11 Viva Voce and Answers 2021-22 CBSE Practical

1. What is the difference between object-oriented programming and procedural programming ?
Answer:
In object-oriented programming we stress on data while in procedural programming we stress on procedure.

2. Can a variable name start with an underscore ?
Answer:
Yes.

3. Is CHAR a keyword ?
Answer:
No.

4. What is the range of int variable ?
Answer:
-32768 to 32767

5. What is enum ?
Answer:
This data type is used to initialize integer constant.

6. How many fundamental data types are supported by C++ ?
Answer:
Five : int, float, char, double and void.

7. Name two derived data types.
Answer:
struct and class.

8. Which escape sequence is used for new line ?
Answer:
\n.

9. Name two logical operators.
Answer
&& , || 

10. What is the another name for conditional operator ?
Answer
Ternary operator

11. What is the output of the following :
      int a = 5;
      int b = ++a;
      int c = b++;
      cout<<a<<b<<c<<endl;
Answer:
6 7 6

12. Name the header file for setw().
Answer:
<iomanip.h>

13. Name two conditional statements.
Answer:
if and switch ..case.

14. How many times a do..while loop execute if the condition is false ?
Answer:
At least once. The do..while loop is also known as the exit control loop.

15. Which loop is known as entry control loop ?
Answer:
The while loop is known as the entry control loop.

16. What is the difference between exit() and break ?
Answer:
A break will terminate the loop while exit() will terminate the program.

17. What is the difference between gets() and cin ?
Answer:
The gets ( ) function can read the space while cin will not read the space character.

18. What is the output of the following :
      int i = 10;
      cout<<++i<<i<<i++;
Answer:
12 11 10

19. A string is terminated by ______.
Answer:
NULL (\0).

20. Is it a valid statement :
      char string [] = "INDIA";
Answer:
Yes.

21. Name two functions of string.h.
Answer:
strcpy( ), strcmp( ).

22. What is the difference between strcmp() and strcmpi() ?
Answer:
The strcmp() is a case sensitive while strcmpi( ) is not case sensitive.

23. What is the difference between 'b' and "b" ?
Answer:
Character enclosed in single quotes is called character constants. It occupy one byte. Character enclosed in double quotes is called string constants. It occupy at least two bytes.

24. What is the difference between local and global variable ?
Answer:
The scope of the local variable is restricted to a block while the global variable is accessible in the whole program.

25. What is the difference between formal and actual parameter ?
Answer:
The parameter associated with the function name in the function prototype is called formal parameter. The parameters associated with the function name during the function call are called actual parameters.

26. A function can return how many values ?
Answer:
Only one.

27. What is the default return type of  a function ?
Answer:
int.

28. By default an array is passed by value or refrence.
Answer:
An array is always passed by refrence.

29. What is the difference between structure and a class ?
Answer:
All the data members of a structure are public by default while all the data members of a class are public by default.

30. What is class ?
Answer:
A class is an abstract data type which combines data and its associated function into a single unit.

31. What is an object ?
Answer:
An object is the instance of a class.

32. What is the difference between abstract class and concreate class ?
Answer:
An abstract class, or abstract base class (ABC), is one that is designed only as a parent class and from which child classes may be derived, and which is not itself suitable for instantiation.
A concrete class, however, is a class for which entities (instances) may be created. This contrasts with abstract classes which can not be instantiated because it defeats its purpose of being an 'abstract'.

33. What is the difference between constructor and destructor ?
Answer:
A constructor is used to allocate memory to the object while a destructor is used to release memory occupied by the constructor.

34. How many constructors a class can have ?
Answer:
Any number of constructors.

35. How many destructors a class can have ?
Answer:
Only one.

36. Constructor overloading is possible but destructor overloading is not possible. Why ?
Answer:
Because a constructor can accept parameters while a destructor does not accept parameters.

37. What is base and derived class ?
Answer:
Base class: A class that provides properties to other class which can be inherited and reused by it is known as base class.
Derived class: Class that inherits properties from the base class is known as derived class.

38. What is the order of evaluation of a constructor in an inheritance ?
Answer: 
In inheritance the constructor of base class is evaluated first than the constructor of derived class.

39. What is the order of evalution of destructor in inheritance ?
Answer:
In inheritance the destructor of derived class is evaluated first than the destructor of base class.

40. What is the difference between private and protected visibility mode ?
Answer:
The private members are not accessible in the derived class while the protected members are accessible in the derived class.

41. What is containership ?
Answer:
C++ allows programmer to declare one class as the member of another class. This type of classes are known as nested classes. This relationship is also known as containership.

42. What is the difference between ifstream and ofstream ?
Answer:
The ifstream is used to read the contents from the file while ofstream is used to write in the file.

43. What is the difference between ios::out and ios::app ?
Answer:
The ios::out is known as the overwriting mode in which whenever we add new content the previous contents get erased while ios::app is known as the append mode in which the content starting adding at the end of file.

44. What is the difference between tellg() and tellp() ?
Answer:
The tellg() tells the position of get pointer while tellp() tells the position of put() pointer.

45. What is pointer ?
Answer:
A pointer is a variable which store the address of another variable.

46. Distinguish between: int*ptr = new int(5); & int*ptr = new int[5];
Answer:
int*ptr = new int(5);    //creates an integer block which is pointed by "ptr" and intialize it to 5.

int*ptr = new int[5];   // create an integer array of length 5 while ptr 1 points to the 0th location.

47. Differentiate between stack and queue.
Answer:
A stack is LIFO structure in which the element added last will be deleted first. A queue is FIFO structure in which the element added first will be deleted first.

Viva Voce based on SQL

1. What is the full form of SQL ?
Answer:
Structured Query Language.

2. What are different categories of SQL ?
Answer:
The different categories of SQL are :
DDL - Data Definition Language
DML - Data Manipulation Language
TCL - Transaction Control Language

3. Name two DDL command.
Answer:
Create table and Alter table.

4. Name two DML command.
Answer:
Update and Insert.

5. What is the difference between Update and Alter ?
Answer:
The update command is used to change the record of a table while alter command is used to change the structure of a table.

6. What is the difference between Primary key and Unique constraint ?
Answer:
A table can have only one primary key but any number of unique clauses.

7. Name few group functions.
Answer:
Avg( ), Sum( ), Max( ), Min( ).

8. What is the difference between order by and group by clause ?
Answer:
The order by clause arrange the database in ascending or descending order while the group by clause arrange the data in group and give one result by group.

9. Can we use where clause with group by ?
Answer:
No.

10. What is join ?
Answer:
Combining two or more table according to the common field is known as join.

11. What is degree of table ?
Answer:
The numbers of column in a table is called its degree.

12. What is cardinality of a table ?
Answer:
The number of rows in a table is called cardinality.

13. What is primary key ?
Answer:
A primary key is the field of table which uniquely identify a record.

14. What is view ?
Answer:
A view is a virtual table that does not exist in its own right, but is instead derived from one or more base table(s).

15. What is foreign key ?
Answer:
A foreign key is a column in a table where that column is a primary key of another table, which means that any data in a foreign key column must have corresponding data in the other table where that column is the primary key. A foreign key refers to a primary key or unique key in another table. In BMS-speak, this correspondance is known as referential integrity.

16. What is candidate key ?
Answer:
There may be two or more attributes or combinations of attributes that uniquely identify an instance of an entity set. These attributes or combinations of attributes are called candidate keys.
Previous Post Next Post