2nd PUC Computer Science Question Bank Chapter 5 Review of C++ Covered in First PUC

Students can Download 2nd PUC Computer Science Chapter 5 Review of C++ Covered in First PUC Questions and Answers, Notes Pdf, 2nd PUC Computer Science Question Bank with Answers helps you to revise the complete Karnataka State Board Syllabus and to clear all their doubts, score well in final exams.

Karnataka 2nd PUC Computer Science Question Bank Chapter 5 Review of C++ Covered in First PUC

2nd PUC Computer Science Review of C++ Covered in First PUC One Mark Questions and Answers

Question 1.
What is modularity?
Answer:
Modularity is a concept where given problem is divided into sub-problems and the sub-problems are further divided.

2nd PUC Computer Science Question Bank Chapter 5 Review of C++ Covered in First PUC

Question 2.
What is Abstraction?
Answer:
Abstraction is an act which represents the essential features of an entity without including explanations or any background details about it.

Question 3.
What is Data encapsulation?
Answer:
The binding of data and functions into a single unit called as the class is known as data encapsulation.

Question 4.
Define inheritance.
Answer:
Inheritance is the process by which objects of one class acquire the properties of the object of another class.

Question 5.
What is polymorphism?
Answer:
Polymorphism is the ability for a message to be processed in more than one form.

Question 6.
What is operator overloading?
Answer:
The process it making an operator to exhibit different behaviors in different instances is known as operator overloading.

Question 7.
What is an Array?
Answer:
An array is collection of objects and all the objects have the same name.

2nd PUC Computer Science Question Bank Chapter 5 Review of C++ Covered in First PUC

Question 8.
What is function?
Answer:
If the programs are complex and lengthy, they can be modularized into subprograms. The subprograms are called as functions.

Question 9.
What is a variable?
Answer:
A variable is an identifier whose value is allowed to change during the execution of the program.

Question 10.
List different selection statements.
Answer:
Different selection statements are:

  1. if – statement
  2. if – else statement
  3. nested statement
  4. switch statement

2nd PUC Computer Science Review of C++ Covered in First PUC Three Marks Questions and Answers

Question 1.
Explain Tokens in C++.
Answer:
A Token is a smallest individual unit in a program or a lexical unit. The most fundamental elements of a C++ program are “tokens”. These elements help us to construct statements, definitions, declarations and soon, which in turn helps us to construct tokens. Identifiers, keywords, variables, constant, punctuators, operators.

Question 2.
What are Identifiers? Give examples.
Answer:
An identifier is a name given to the programming elements such as variables, arrays, functions etc. It can contain letter, digits and undersore. C++ is case sensitive and henceforth it treats uppercase & lowercase characters differently.
ex: Student, – amount, marks 1, total – score etc.
STUDENT, – AMOUNT, MARKS1; Total- Score etc

Question 3.
What are keywords? List some keywords.
Answer:
Keywords is a predefined word that gives special meaning to the compiler. They are reserved words which can be used for their intended purpose and should not be used as normal identifier. List of keywords are and, asm, auto, bool, break, case, catch, char.

Question 4.
List the characteristics of OOPs.
Answer:
The characteristics of OOPs are:

  1. Abstraction
  2. Data Encapsulation
  3. Inheritance
  4. Polymorphism
  5. Dynamic Binding;
  6. Message passing

2nd PUC Computer Science Question Bank Chapter 5 Review of C++ Covered in First PUC

Question 5.
Explain different types of Arrays in C++?
Answer:
There are three types of arrays:
1. One – dimentional array:
It is an array in which each element is accessed by using only one subscript. The one subscript represent the position of the element in the array.

2. Two – dimentional array: It is an array in which each element is accessed using 2- subscripts. The subscripts represents the position of element in the array.

3. Multi- dimentional Array
A multi – dimentional array is an array of n – dimentions. In other words, an array of array of called a Multi – dimentional array. A one – dimentional array of one – dimentional arrays is called a 2 – dimentional array; a 1 – dimentional array to 2 – dimentional arrays is called a 3 – dimentional array and soon.

2nd PUC Computer Science Review of C++ Covered in First PUC Five Marks Questions and Answers

Question 1.
Explain different C++ operators.
Answer:
There are two type of operators in C++
1. Unary operators:
Unary operators have only one operand. ex: !, &, ~, *, ++, –, +, -.

2. Binary operators:
The Binary operators are those operators that operate on two operands. These operators can be arithmatic operators.
(a) Arithmatic operators:
The arithmatic operators are : +, -, *, /, %. These operators are used in arithmatic expressions.

(b) Relational operators:
The relational operators are : ==, !, =>, <, >=, <=. There operators are used in relational operations.

(c) Logical operations:
The logical operators supported by C++ are:
&& → Logical AND operation
| | → Logical OR operation
! → Logical NOT operation.
Logical operators are used in logical expressions such expressions always gives ‘O’ (False) or 1 (True).

(d) Bitwise operators:
Bitwise operators works on bits. The Bitwise operators are : &, |, ∧, ~, <<, >>.

(e) Shorthand operators:
We combine the assigment operators with arithmatic operators and bitwise operators. Such operators are called as shorthand operators.
The short hand operators are:
+ =, _+, *=, /=, %=, &=, 1=, ∧=.

(f) Assignment operators:
It is an operator used to assign a value to a variable. The syntax is variable = value or expression:
Ex: n = 10; sum = n + 35;

3. Special operators:
Some special operators are there in C++. They are size of () comma (,) dot(.) pointer (*)

4. Ternary operators:
The ternary operators are these operators that operate on three or more operands. Ternary operator is also called as conditional operator. “?” is the ternary operator. This operator can be used as an alternative to if – else statement.

2nd PUC Computer Science Question Bank Chapter 5 Review of C++ Covered in First PUC

Question 2.
Explain structure of C++ program.
Answer:
The structure of C++ program contains:

  1. Include files
  2. Class declarations
  3. Member function declaration
  4. Main () function.

1. Include files:
This section is used to include all the propocessor directives that are necessary for the program being written.

2. Class declaration:
A class is a blue print for the objects. It describes the data and functions that the object is going to use.

3. Member function declarations:
This section defines or declares the user defined functions that other functions, or the main () function may use.

4. Main ( ) function declarations:
This is also a function that integrates all the other functions of the program. It contains the body of the function. The body should be enclosed with in curled braces{}.
The body contains two parts: Local declarations & executable statements. The local declaration refer to the decleration of all those variables that are used within the main () function. The executable statements are the statements that perform the required operations to solve the problem.

Question 3.
Explain different types of functions with examples.
Answer:
There are 5 types of functions.
1. Functions with no arguments and no return values.
In this method, the function simply performs an independent task. This function does not receive or send any arguments.
Ex: void naturail ()
{
for (int i = 1; i<= 10; i++)
cout << set w (4) << i++;
}

2. Functions with arguments and with no return values.
In this method, the function receives some arguments and does not return any value.
Ex:
void average (intx, inty, intz)
{
float sum, avg;
sum = a + b + c;
avg = sum/3.0;
cout <<” average = “avg << end1;
}

3. Functions with no arguments and with return values.
In this method, the function receive no arguments but return a value.
Ex:
int greatest ()
{
if (a b c)
return (a);
return (b);
}

4. Function with arguments and with return values.
In this method, the function recevies some arguments and returns a value.
ex:
float interest (float p, float t, float r)
{
si = (p * t * r) / 100;
return (si);
}

2nd PUC Computer Science Question Bank Chapter 5 Review of C++ Covered in First PUC

5. Recursive functions:
Recursive function is a function that calls itself. The process of calling a function by itself is called as recursion. Recursive functions must have one or more terminating conditions to terminate recursion. Otherwise, recursion will become infinite.