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

You can Download Chapter 5 Review of C++ Covered in First PUC Questions and Answers, Notes, 2nd PUC Computer Science Question Bank with Answers Karnataka State Board Solutions help you to revise complete Syllabus and score more marks in your examinations.

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 does OOP mean?
Answer:
OOP means Object-Oriented Programming.

Question 2.
What is object-oriented programming?
Answer:
Object-oriented programming (OOP) is a programming language model organized around “objects” rather than “actions” and data rather than logic of the program.

Question 3.
Define object.
Answer:
An object is a combination of code and data that can be treated as a unit. An object can be considered any real-time entity (existing thing) that can perform a set of related activities.

KSEEB Solutions

Question 4.
Define class.
Answer:
A class is simply a representation of a type of object. It is the blueprint/ plan/ template that describe the details of an object.

Question 5.
Which programming approach the OOP follows?
Answer:
The OOP follows Bottom-up approach of programming.

Question 6.
What is the meaning of abstraction in OOP?
Answer:
Abstraction in OOP is “A model of a complex system that includes only the details essential to the perspective of the viewer of the system.”

Question 7.
Define encapsulation.
Answer:
It is the method of combining the data, attributes, and methods in the same entity is called encapsulation.

Question 8.
What is polymorphism?
Answer:
Polymorphism is a Greek word that means Many Shapes. In OOP Polymorphism means the ability to take on many forms. The term is applied both to objects and to operations.

KSEEB Solutions

Question 9.
What is dynamic binding?
Answer:
Dynamic binding means link exist between procedure call and code to be execute at run time when that procedure is call.

Question 10.
What is message passing?
Answer:
Message passing is a method by which an object sends data to another object or requests other object to invoke a method. This is also known as interfacing.

Question 11.
Describe tokens
Answer:
The smallest individual units in a program are known as tokens.

Question 12.
Mention few tokens.
Answer:
The few tokens are Keywords, identifiers, constants, strings, and operators.

Question 13.
What is a keyword?
Answer:
All keywords (reserved words) are basically the sequences of characters that have one or more fixed meanings.

Question 14.
What are identifiers?
Answer:
Identifiers are names given to the program elements such as variables, arrays, and functions.

Question 15.
What are constants?
Answer:
The quantity, which does not change during the execution of a program, is known as a constant.

Question 16.
Define character set.
Answer:
It is a set of symbols that a programming language identifies and used in writing data and instructions in a programming language.

KSEEB Solutions

Question 17.
What is integer constant?
Answer:
Integer constants are the whole number without any fractional part.

Question 18.
What are floating-point constants?
Answer:
Floating-point constants are numeric values that contain decimal point and can contain exponents.

Question 19.
Define octal constant.
Answer:
It consists of a sequence of digits starting with 0 (zero).

Question 20.
Define hexadecimal constants.
Answer:
It consists of a sequence of digits from 0 to 9 and A, B,C, D, E, F alphabet symbols that represent decimal numbers 10,11,12,13,14, and 15 respectively preceded by ox or OX.

Question 21.
What are character constants?
Answer:
A character constant in C++ must contain one or more characters and must be enclosed in single quotation marks.

Question 22.
What is an operator?
Answer:
An operator is a symbol that performs specific operation and gives a value as the result.

Question 23.
What are arithmetic operators?
Answer:
The symbols that perform addition, subtraction, multiplication, modulus, and division are called arithmetic operators.

Question 24.
Give the difference between / and % arithmetic operators.
Answer:
The arithmetic operator / perform division and gives out the quotient as a result. The arithmetic operator % performs division and gives out the reminder as a result.

KSEEB Solutions

Question 25.
What is an operand?
Answer:
The operand is a data item on which the operator perform some activity.

Question 26.
What are unary operators?
Answer:
An operator that takes only one operand to perform some operation is called a unary operator.

Question 27.
What are binary operators?
Answer:
The operators which takes two operands to perform some operation is called a binary operator.

Question 28.
What are relational operators?
Answer:
The operators which perform operation of relation between two operands called relational operators.

Question 29.
What are logical operators?
Answer:
The operators which perform combine or negate the expressions that contains relational operators are called logical operators.

Question 30.
What is the function of bitwise operator?
Answer:
Bit manipulation operators manipulate individual bits within a variable. Bitwise operators modify variables considering the bit patterns that represent the values they store.

Question 31.
What is meant by shorthands in C++?
Answer:
In C++ shorthands means writing the certain type of assignment statements in simplified manner.

Question 32.
What is a ternary operator?
Answer:
The operator that operates on three operands is called the ternary operator.

Question 33.
What is an expression?
Answer:
An expression is a combination of constants, variables, operators, functions calls which produces a particular value to be used in any other context.

Question 34.
What is a statement?
Answer:
Statement is an instruction to the computer telling it what to do for instance assigning an expression value to a variable because it produces an instructions tells the computer to assign a value to something.

Question 35.
What is the use of iostream.h in C++?
Answer:
Iostream stands for input/output stream. It is a header file which we include in our programs to perform basic input-output operations.

KSEEB Solutions

Question 36.
Mention any two ctype.h functions.
Answer:
Toupper() and tolower() are the two example for ctype.h functions.

Question 37.
Mention any two string.h functions.
Answer:
Strupr() and strlwr().

Question 38.
Mention any two functions of stdio.h
Answer:
Printf() and scanf() are the two functions of stdio.h.

Question 39.
Mention any two functions of stdlib.h
Answer:
Atoi() and itoa() are the two functions for stdlib.h

Question 40.
What is a preprocessor directive?
Answer:
Preprocessor directive is a command that is considered for execution before the processor executes the program.

Question 41.
What is meant by data types?
Answer:
The set of values along with the operations that can be performed on these values are called as data types.

Question 42.
Give the classification of data types.
Answer:
Data types are classified into built-in or basic data types and user-defined or derived data types.

Question 43.
Name the built-in data types of C++.
Answer:
The built-in or basic data types supported by C++ are integer, floating-point, and character.

Question 44.
How is derived data type created?
Answer:
The derived data type is created by using basic data types.

Question 45.
What is a linear data structure?
Answer:
The data elements are arranged in a sequential manner is called a linear data structure.

Question 46.
What is the non-linear data structure?
Answer:
The data elements that are arranged non-sequentially is called non-linear data structure.

Question 47.
Define modifiers.
Answer:
The modifiers change the meanings of the predefined built-in data types and expand them to a much larger set.

Question 48.
Write the different modifiers.
Answer:
The different modifiers are long, short, signed and unsigned.

Question 49.
What is a stream?
Answer:
A stream is an object where a program can either insert or extract characters to/from it.

KSEEB Solutions

Question 50.
Give the classification of stream.
Answer:

  • input streams
  • output streams

Question 51.
What is input stream?
Answer:
Input stream is a sequence of characters from input device like keyboard to the program of a computer.

Question 52.
What is output stream?
Answer:
Output stream is a sequence of characters from the program to output device like monitor, printer.

Question 53.
What is meant by stream extraction?
Answer:
cin is used in conjunction with >> operator, known as extraction or get from operator.

Question 54.
What is meant by stream insertion?
Answer:
cout is used in conjunction with << operator, known as insertion or put to operator.

Question 55.
Give the syntax of cin statement.
Answer:
Syntax: cin >> variable.

Question 56.
Give the syntax of cout statement.
Answer:
Syntax : cout << expression or manipulator

Question 57.
What is cascading in I/O operations?
Answer:
The cascading is a way to extract/insert multiple values from/into more than one variable using one cin/cout statement.

Question 58.
What are manipulators?
Answer:
A manipulator is a C++ is used to control the formatting of output and/or input values.

Question 59.
Give an example for manipulator.
Answer:
endl is a manipulator.

Question 60.
What is a statement?
Answer:
Statements are the instructions given to the computer to perform any kind of action. Action may be in the form of data movement, decision making, etc.

Question 61.
What are control statements?
Answer:
Control Statements are elements in the program that control the flow of program execution.

Question 62.
Write the classification of control statements.
Answer:
The control statements are classified as

  1. Selection statement
  2. Iterative statement
  3. Jump statement

Question 63.
What is meant by the compound statement?
Answer:
A compound statement is a grouping of statements enclosed between the pair of braces ({ }) in which each individual statement ends with a semi-colon.

KSEEB Solutions

Question 64.
What are selection statements?
Answer:
The selection statements are used to execute certain block of statements the evaluating the condition.

Question 65.
What is a block?
Answer:
The group of statements separated by a semicolon and is marked with {} is called block.

Question 66.
What is the purpose of if statement?
Answer:
The if statement is used to decide on whether a statement or a block should be executed or not.

Question 67.
Define the term looping.
Answer:
The looping means execution of a statement or block of statements again and again until the condition is true.

Question 68.
Why is while loop is called a pre-tested looping statement?
Answer:
The while loop evaluates the condition in the beginning itself to select statement for execution repeatedly. Therefore it is called pre-tested looping statement.

Question 69.
What is post-tested looping statement?
Answer:
The loop evaluates the condition in the end of the looping structure and select a statement for execution repeatedly. Therefore it is called post-tested looping statement.

Question 70.
Name the post-tested looping statement.
Answer:
The do-while statement is called a post-tested looping statement.

Question 71.
Which structure is called a fixed-execution looping statement?
Answer:
The ‘for’ looping statement is called a fixed-execution looping statement.

Question 72.
When is ‘for’ used?
Answer:
If a programmer knows the exact number of repetition to be carried among the set of statements then ‘for’ conditional statement is used in a program.

Question 73.
What is the nesting of the loop?
Answer:
If the loop appears inside the body of another loop is called a nested loop.

Question 74.
What is an Array?
Answer:
Array is a group of similar elements that share a common name.

Question 75.
What is the use of arrays?
Answer:
Use of arrays reduces the creation and use of more number of individual variables in a program. It also helps to reduce the program length.

Question 76.
Mention the different types of arrays.
Answer:
There are three types of arrays

  1. One dimensional array
  2. Two-dimensional array
  3. Multidimensional array

KSEEB Solutions

Question 77.
What is Index or subscript of an Array?
Answer:
Subscript is used to identify/locate the position of array elements.

Question 78.
What is zero-based indexing?
Answer:
If ‘i’ is the element, then its index number would be i-1 is called zero-based indexing.

Question 79.
What is the subscript of the first element of an array?
Answer:
The first element i = 1, then subscript is 0 because of i-1 i.e., 1-1.

Question 80.
Mention any one feature of subscript or index of an array.
Answer:
Subscript or index of an array is always a positive whole number.

Question 81.
Define a one-dimensional array.
Answer:
One dimensional array is a collection of similar elements that share a common name and is structured in one dimension.

Question 82.
Give the declaration syntax of a one-dimensional array.
Answer:
datatype arryname [size];

Question 83.
What is meant by initialization of an array?
Answer:
Initialization means assigning values to declared variables or arrays. To initialize an array, each and every element of the array has to be referred and then value is assigned to it.

Question 84.
Give an example showing initialization of one-dimensional array.
Answer:
int marks[6] = {91,96,90, 94,99,93};

Question 85.
Define a two-dimensional array.
Answer:
Two-dimensional array is a collection of elements of similar type that share a common name, structured in two dimensions. Each element is accessed by two index values.

Question 86.
Write the declaration syntax of two-dimensional array.
Answer:
Syntax:
<data-type> <array-name> [<size1>] [<size2>];

Question 87.
Give an example of, How a two-dimensional array is declared?
Answer:
int marks[5][5];

Question 88.
Give one example showing initialization of two-dimensional array.
Answer:
Example of array initialization with declaration:
int matrix [3] [3] = {91, 96, 90, 94,99,95,87,92,98};

Question 89.
Declare an array to store the 6 subject marks of 500 students.
Answer:
Int marks [500] [6];

Question 90.
How an element in the two-dimensional array is accessed?
Answer:
An element in the two-dimensional array is accesses using two index/subscript numbers. The first number indicates the row index and the second number indicates the column index.

Question 91.
Define multidimensional array.
Answer:
A collection of similar elements structured in N dimensions where N>=1. Each element is accessed by N indices.

Question 92.
Define function.
Answer:
A FUNCTION is a self-contained block of statements that perform a specific task with a name given to it.

Question 93.
How are functions classified?
Answer:
The functions classified as

  1. Library function/pre-defined functions
  2. User-defined functions

Question 94.
What is a Predefined Functions in C++?
Answer:
Predefined functions are functions that are built into C++ Language to perform some standard operations that are stand-alone and used for general purposes.

KSEEB Solutions

Question 95.
What is the header file?
Answer:
A header file is a file containing all the library function definitions that can be used in a program.

Question 96.
List any two basic types of standard library functions.
Answer:

  1. I/O Functions.
  2. Mathematical Functions – math.h

Question 97.
Write the names of any two C++ header files.
Answer:
The two header files are

  • iostream.h
  • iomanip.h

Question 98.
List the names of any two functions of iostream.h header file.
Answer:
The two functions of iostream.h files are

  • cin
  • cout

Question 99.
List the names of any two functions of iomanip.h header file.
Answer:
The two functions of iomanip.h files are

  1. endl
  2. setw

Question 100.
What is the main function of iostream.h header file?
Answer:
The iostream.h header file contains C++ streams and i/o routines functions. It is a header file which we include in our programs to perform basic input output operations. We use cin in program to get input from the keyboard. To use cin and cout, we must add iosream.h header file.

Question 101.
What is the main function of iomanip.h header file?
Answer:
The iomanip.h header file contains various function and macros for i/o manipulations for creating parameterized manipulations.

Question 102.
Define string.
Answer:
The term string is defined as a character array terminated with a null character [‘\0’].

Question 103.
What is null in string?
Answer:
The null in a string is control character ‘\0’ that indicate the end of the string.

Question 104.
How is string declared?
Answer:
The declaration of string is
char arrayname[ size];

Question 105.
Give one example of string initialization.
Answer:
char name[50]=”bharath”;

Question 106.
Name the function used for string input.
Answer:
The function getline() is used to read a string.

KSEEB Solutions

Question 107.
How is input is terminated in getline()?
Answer:
The input gets terminated when a newline character is entered or when entered character length is equal to the size of character array.

Question 108.
Name function used for string output.
Answer:
The function write() is used for string output.

Question 109.
What is a null string?
Answer:
The length of the string 0 is called a null string.

Question 110.
What is a user-defined function?
Answer:
A user-defined FUNCTION is a self-contained block of statements that perform a specific task with a name given to it defined by the user in a program.

Question 111.
Mention any one advantage of user-defined function.
Answer:
Code Reusability:
writing the same sequence of code at two or more locations in the program can be avoided with the use of functions and Universal use feature reduces rewriting of codes again and again.

Question 112.
What is meant function definition?
Answer:
A function definition provides the actual body of the function with a name that you call it by, a list of zero or more arguments and it may give back a return value, of a particular type.

Question 113.
What is function declaration?
Answer:
A function declaration tells the compiler about a function’s name, return type, and parameters.

Question 114.
What is meant by calling a function?
Answer:
To use a function, the user will have to call or invoke that function. It helps to execute the function and perform the process of a function.

Question 115.
What is called function?
Answer:
A called function is a function which is called from the calling function.

Question 116.
How is a function invoked?
Answer:
Function can be invoked by a giving a call to the function.

Question 117.
Give the purpose of return statement.
Answer:
It is used to return the value from the called function to the calling function.

Question 118.
What is a function prototype?
Answer:
The declaration of a function before it is used or called is known as function proto type.

Question 119.
Give the default return type of main() function.
Answer:
The default return type of main() function is int data type.

Question 120.
What is function parameter?
Answer:
Sometimes the calling function supplies some values to the called function. These are known as parameters.

Question 121.
What is the significance of void in function return type?
Answer:
A function that does not return a value is declared and defined as void.

KSEEB Solutions

Question 122.
Why are arguments used in functions?
Answer:
The arguments are the mechanism that carries values from calling function to called function.

Question 123.
What are the actual arguments?
Answer:
The data that is passed by the calling function as arguments/parameters is known as actual arguments, i.e., the arguments which are present at the time of function call.

Question 124.
What are formal arguments?
Answer:
Formal parameters or dummy parameters are the names of the argument/parameter in the function header of the called function.

Question 125.
What is global variable?
Answer:
A variable that is declared outside any function is known as a global variable.

Question 126.
What is the scope of global variable? .
Answer:
The scope of global variable is extended till the end of the program.

Question 127.
What are local variables?
Answer:
The variables declared within function block are called local variables.

Question 128.
What is the use of return statement in a function?
Answer:
The return statement sends both control and value back to the calling function.

Question 129.
Mention the limitation of return statement.
Answer:
The return statement return value is limited to a single value.

KSEEB Solutions

Question 130.
Write the syntax of function prototype.
Answer:
Returntypespecifier function name( datatype argument1, datatype argument2, ..);

Question 131.
Define structure.
Answer:
A structure is a collection of variable which can be same or different types.

Question 132.
What is the use of structures?
Answer:
Struct ures can be used to handle a group of logically related data items like register number, student name, subject marks, etc., under a single name.

Question 133.
What is the purpose of a struct keyword?
Answer:
It is the reserved or keyword used in structure definition.

Question 134.
What is structure tag?
Answer:
Structure tag is a name given by the programmer and used to identify the structure in future re-definitions.

Question 135.
What is the structure template?
Answer:
The list of all structure members is called a template.

Question 136.
What purpose does structure definition serve?
Answer:
The structure definition acts as a blueprint for the creation of variables.

KSEEB Solutions

Question 137.
How is a member of a structure accessed?
Answer:
The member of structure is accessed using dot (.) operator.

Question 138.
Write the declaration syntax for a structure variable.
Answer:
The general syntax for declaration of structure variable is Structurename variable;

error: Content is protected !!