TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++

Question 1.
What is character set?
Answer:
Character set is a set of characters which are allowed to write a C++ program. C++ accepts the following characters.

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 1

Question 2.
What are identifiers? List the classification of C++operators.
Answer:
C++ Operators are classified as:
(i) Arithmetic Operators
(ii) Relational Operators
(iii) Logical Operators

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 3.
What are constants? List the types of constants in C++.
Answer:
Literals are data items whose values do not change during the execution of a program.

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 2

Question 4.
What do you mean by Boolean literals?
Answer:
Boolean literals are used to represent one of the Boolean values(True or false). True has value 1 and false has value 0.

Question 5.
How the operators are classified on the basis of the number of operands.
Answer:

Operators  Operands

 Example

Unary operators  Require only one operands  x++
Binary operators  Require two operands  c = a + b
Ternary operators  Require three operands  max = (num 1 > num 2)? num1 : num2

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 6.
List the charactreristics of C++ operators.
Answer:
(i) Airthmetic Operators
(ii) Relational Operators
(iii) Logical Operators
(iv) Bitwise Operators
(v) Assignment Operators
(vi) Conditional Operator
(vii) Other Operators

Question 7.
What is get from operator?
Answer:
C++ provides the operator >> to get input. It extracts the value through the keyboard and assigns it to the variable on its right; hence, it is called as “Stream extraction” or “get from”

Question 8.
What is put to operator?
Answer:
C++ provides << operator to perform output operation. The operator « is called the “Stream insertion” or “put to” operator.

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 9.
What are the two fundamental elements?
Answer:
Every programming language has two fundamental elements, viz., data types and variables.

Question 10.
What is fundamental data type?
Answer:
C++ provides a predefined set of data types for handling the data items. Such data types are known as fundamental or built-in data types.

Question 11.
What is user-defined data type?
Answer:
Apart from the built-in data types, a programmer can also create his own data types called as User-defined data types.

Question 12.
Write the categories of C++.
Answer:
In C++, the data types are classified as three main categories. They are:
(i) Fundamental data types
(ii) User-defined data types and
(iii) Derived data types.

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 13.
Write the memory allocation for char data types.
Answer:

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 3

Question 14.
Write the memory allocation for floating point data types.
Answer:

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 4

Question 15.
What do you mean by number suffixes in C++?
Answer:
Suffix can be used to assign the same value as a different type. For example, To store 45 in an int, long, unsigned int and unsigned long int, suffix letter L or U (either case) is used with 45 i.e., 45L or 45U. This type of declaration instructs the compiler to store the given values as long and unsigned. ‘F’ can be used for floating point values.
Eg: 3.14F.

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 16.
Give the values associated with a symbolic variable.
Answer:
There are two values associated with a symbolic variable; they are R-value and L-value.
(i) R-value is data stored in a memory location.
(ii) L-value is the memory address in which the R-value is stored.

Question 17.
What do you mean by initialization?
Answer:
Assigning an initial value to a variable during its declaration is called as “Initialization”.
Eg:
int num =100;
float pi = 3.14;
double price = 231.45;

Question 18.
Name the members of iomanip header file.
Answer:
The members of iomanip header file are setw, setfill, setprecision and setf manipulators.

Question 19.
List down the commonly used manipulators.
Answer:
The commonly used manipulators are: endl, setw, setfill, setprecision and setf.

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 20.
What is the use of setfill ( )?
Answer:
setfill argument is used for filling the empty fields.
Syntax: setfill (character);
Eg: cout<< “\n H.R.A:” << setw(10) << setfill (0) << hra;

Question 21.
Name the types of conversion provided in C++.
Answer:
(i) Implicit type conversion
(ii) Explicit type conversion

Question 22.
What do you mean by type promotion?
Answer:
If the type of the operands differ, the compiler converts one of them to match with the other, using the rule that the “smaller” type is converted to the “wider” type, which is called as “Type Promotion”.

Question 23.
What is automatic conversion?
Answer:
An Implicit type conversion is performed by the compiler automatically. So, implicit conversion is also called as “Automatic conversion”.

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 24.
What is type casting?
Answer: C++ allows explicit conversion of variables or expressions from one data type to another specific data type by the programmer. It is called as “type casting”. Syntax: (type-name) expression;

Question 25.
List the benefits of C++.
Answer:
(i) C++ is a highly portable language and is often the language of choice for multi-device, multi-platform app development.
(ii) It is an object-oriented programming language and includes classes, inheritance, polymorphism, data abstraction and encapsulation.
(iii) It has a rich function library.
(iv) It allows exception handling, inheritance and function overloading which are not possible in C.
(v) It is a powerful, efficient and fast language. It finds a wide range of applications – from GUI applications to 3D graphics for games to real-time mathematical simulations.

Question 26.
Write down the rules for naming an identifier.
Answer:
(i) The first character of an identifier must be an alphabet or an underscore (_ ).
(ii) Only alphabets, digits and underscore are permitted. Other special characters are not allowed as part of an identifier.
(iii) C++ is case sensitive as it treats upper and lower-case characters differently.
(iv) Reserved words or keywords cannot be used as an identifier name.

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 27.
Write short notes on string literals.
Answer:
(i) Sequence of characters enclosed within double quotes are called as String literals.
(ii) By default, string literals are auto-matically added with a special character ‘\0’ (Null) at the end.
(iii) Therefore, the string “welcome” will actually be represented as “welcome\0” in memory and the size of this string is not 7 but 8 characters i.e., inclusive of the last character \0. Valid string Literals : “A”, “Welcome” “1234”. Invalid String Literals : ‘Welcome’, ‘1234’.

Question 28.
What do you mean by Bitwise one’s complirhent operator?
Answer:
The bitwise One’s compliment operator -(Tilde), inverts all the bits in a binary pattern, i.e., all 1 ’s become 0 and all 0’s become 1. This is an unary operator. Eg: If a =15;
Equivalent binary values of a is 0000 1111

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 5

Question 29.
Write down the other operands in C++.
Answer:

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 6

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 30.
What do you mean by cascading of I/O operators?
Answer: The multiple use of input aryl output operators such as >> and << in a single statement is known as cascading of I/O operators.
Cascading cout: int Num=20;
cout<<“A=”<<Num; Cascading cin: Eg: cout>>”Enter two numberr
cin>>a>>b;

Question 31.
What is use of using namespace?
Answer:
(i) The line using namespace std; tells the compiler to use standard namespace.
(ii) Namespace collects identifiers used for class, object and variables.
(iii) They provide a method of preventing name conflicts in large projects.

Question 32.
What is a variable? Write the syntax.
Answer:
The variables are the named memory locations to hold values of specific data types.
Syntax: ;

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 33.
Give short notes on data type modifiers in C++.
Answer:
(i) Modifiers are used to modify the storing capacity of a fundamental data type except void type.
(ii) Every fundamental data type has a fixed range of values to store data items in memory.
(iii) For example, int data type can store only two bytes of data.
(iv) Modifiers can be used to modify (expand or reduce) the memory allocation of any fundamental data type. They are also called as Qualifiers.
There are four modifiers used in C++. They are:
(i) signed (ii) unsigned (iii) long (iv) short
These four modifiers can be used with any fundamental data type.

Question 34.
Write the memory allocation for integer data types.
Answer:

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 7

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 8

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 35.
Show the difference between Turbo C++ and Dev C++ for allocation of memory for the data types.
Answer:

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 9

Question 36.
Write short notes on Junk or Garbage values.
Answer:
If you declare a variable without any initial value, the memory space allocated to that variable will be occupied with some unknown value. These unknown values are called as “Junk” or “Garbage” values.
#include
using namespace std;
int main( )
{
int num1, num2, sum;
cout<<num1<<end1;
cout<<num2<,end1;
cout< }
In the above program, some unknown values will be occupied in memory that is allocated for the variables num1 and num2; and the statement court<

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 37.
Explain dynamic initialization with example.
Answer:
A variable can be initialized during the execution of a program. It is known as “Dynamic initialization”.
Eg:
int num1, num2, sum;
sum = num1 + num2;
C++ program to illustrate dynamic initialization:
#include
using namespace std;
int main( )
{
int num1, num2;
cout<<“\n Enter number 1:” ; cin>> numl;
cout<<“\n’Enter number 2:” ; cin>> num2;
int sum = num1 + num2;
// Dynamic initialization cout<<“\n Average:” << sum /2;
}
Output:
Enter number 1: 78
Enter number 2: 65
Average: 71

Question 38.
What is the use of endl? Give example.
Answer:
endl – Inserts a new line and flushes the buffer (Flush means – clean)
‘\n’ – Inserts only a new line.
cout<<“\n The value of num =” «num;
cout<<“The value of num =” << num<<end;
Both these statements display the same output.

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 39.
Write short note on setprecision( ).
Answer:
setprecision( ) is used to display numbers with fractions in specific number of digits.
Syntax:
setprecision (number of digits);
Eg:
#include
#include
using namespace std;
int main( )
{
float hra = 1200.123;
cout< }
setprecision can also be used to set the number of decimal places to be displayed. To do this task, an ios flag is set within setf( ) manipulator. This may be used in two forms:
(i) fixed and
(ii) scientific.

Question 40.
What is an expression? Name the types of ’ expressions used in C++.
Answer:
(i) An expression is a combination of operators, constants and variables arranged as per the rules of C++.
(ii) It may also include function calls which return values. (Functions will be learnt in upcoming chapters).
In C++, there are seven types of expressions, and they are:
(i) Constant Expression
(ii) Integer Expression
(iii) Floating Expression
(iv) Relational Expression
(v) Logical Expression
(vi) Bitwise Expression
(vii) Pointer Expression

Question 41.
Write a note on Implicit type conversion. Give example.
Answer:
(i) An Implicit type conversion is performed by the compiler automatically.
(ii) So, implicit conversion is also called as ~ “Automatic conversion”.
Eg:
#include
using namespace std;
int main ( )
{
int a=6;
float b=3.14;
cout<<a+b;
}

In the above program, operand a is an int type and b is a float type. During the execution of the program, int is converted into a float, because a float is wider than int.

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 42.
How the explicit conversion takes place? Give example.
Syntax:
(type-name) expression;
Where type-name is a valid C++ data type to which the conversion is to be performed.
Eg:
#include
using namespace std;
int main( )
{
float varf=78.685;
cout<<(int) varf;
}
In the above program, variable varf is declared as a float with an initial value 78.685. The value of varf is explicitly converted to an int type in cout statement. Thus, the final output will be 78.

Question 43.
What happens when you convert
(i) double to float,
(ii) float to int,
(iii) long to short.
Answer:
(i) Double to float:
Loss of precision. If the original value is out of range for the target type, the result becomes undefined.

(ii) Float to int:
Loss of fractional part. If original value may be out of range for target type, the result becomes undefined.

(iii) Long to short:
Loss of data.

Question 44.
Explain the Escape sequences (or) non- graphical characters in C++.
Answer:
(i) C++ allows certain non-printable characters represented as character constants. Non-printable characters are also called as non-graphical characters.
(ii) Non-printable characters cannot be typed directly from a keyboard during the execution of a program in C++, Eg: backspace, tabs etc.,

Escape sequence  Non graphical character
\a  Audible or alert bell
\b  Backspace
\f  Form feed
\n  Newline or linefeed
\r  Carriage return
\t  Horizontal tab
\v  Vertical tab
\\  Backslash
\’  Single quote
\”   Double quote
\?  Question Mark
\On  Octal number
\xHn  Hexadecimal number
\0  Null

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 45.
Name the familiar C++ compilers with IDE.
Answer:
Dey C++
Geany
Code: :blocks
Code Lite
Net Beans
Digital Mars
Sky IDE
Eclipse

Question 46.
Write the syntax to declare more than one variable.
Answer:
More than one variable of the same type can be declared as a single statement using a comma separating the individual variables.
Syntax:
, , , ………., ;
Eg:int num1, num2, sum;

Question 47.
Identify the Identifiers it is valid or invalid, if invalid give reason.
Answer:

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 10

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 48.
Explain the types of constants in detail.
Answer:

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 2

Numeric Constants:
Numeric constants are further classified as
(i) Integer Constants (or) Fixed point constants.
(ii) Real constants (or) Floating point constants.

(i) Integer Constants (or) Fixed point constants:
Integers are whole numbers without any fractions. An integer constant must have at least one digit without a decimal point. In C++, there are three types of integer constants:
(a) Decimal,
(b) Octal,
(c) Hexadecimal.

(a) Decimal:
Any sequence of one or more digits (0 …. 9).

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 11

(b) Octal:
Any sequence of one or more octal values (0 …. 7) that begins with 0 is considered as an Octal constant.

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 12

(c) Hexadecimal:
Any sequence of one or more Hexadecimal values (0 …. 9, A …. F) that starts with Ox or OX is considered as an Hexadecimal constant.

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 13

The suffix L or l and U or u added with any constant forces that to be represented as a long or unsigned constant respectively.

(ii) Real Constants (or) Floating point constants:
It is a numeric constant having a fractional component. These constants may be written in fractional form or in exponent form. Fractional form of a real constant is a signed or unsigned sequence of digits including a decimal point between the digits. It must have at least one digit before and after a decimal point. It may have prefix with + or – sign. A real constant without any sign will be considered as positive.

Exponent form of real constants consists of two parts:
(1) Mantissa and
(2) Exponent.

The mantissa must be either an integer or a real constant. The mantissa followed by a letter E or e and the exponent. The exponent should also be an integer.
For example, 58000000.00 may be written as 0.58 × 108 or 0.58E8.

Mantissa (Before E)

 Exponent (After E)

0.58

 8

Eg:
5.864 E1 → 5.864 × 101 → 58.64
5864 E-2 → 5864 × 10-2 → 58.64
0.5864 E2 → 0.5864 × 102 → 58.64

Boolean Literals:
Boolean literals are used to represent one of the Boolean values(TrUe or false). Internally true has value 1 and false has value 0.

Character constant:
A character constant is any valid single character enclosed within single quote. A character constant in C++ must contain one character and must be enclosed within a single quote.
Valid character constants : ‘A’,‘2′, $’
Invalid character constants : “A”
The value of a single character constant has an equivalent ASCII value.
Eg: the value of ‘A’ is 65.
String Literals:
Sequence of characters enclosed within double quotes are called as String literals. By default, string literals are automatically added with a special character ‘\0’ (Null) at the end. Therefore, the string “welcome” will actually be represented as “welcome\0” in memory and the size of this string is not 7 but 8 characters i.e., inclusive of the last character \0.
Valid String Literals: “A”, “Welcome” “1234”.
Invalid String Literals: ‘Welcome’, ‘1234’.

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 49.
List down the order of precedence in C++.
Answer:
Operators are executed in the order of precedence. The operands and the operators are grouped in a specific logical way for evaluation. This logical grouping is called as an Association.

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 14

Question 50.
What are punctuators? List down the punctuators use in C++.
Answer:
Punctuators are symbols, which are used as delimiters, while constructing a C++ program. They are also called as “Separators”. The following punctuators are used in C++;

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 15

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 16

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 51.
Explain the basic elements of C++.
Answer:
1. // C++ program to print a string
(i) It is a comment statement.
(ii) Any statement that begins with // are considered as comments.
(iii) Compiler simply ignores the comment statement.
(iv) If we need to write multiple lines of comments, we can use /* */.

2. # include
(i) All C++ programs begin with include statements starting with a # (hash / pound).
(ii) The symbol # is a directive for the preprocessor i.e., these statements are processed before . the compilation process begins.
(iii) #include statement tells the compiler’s preprocessor to include the header file “iostream” in the program.
(iv) iostream header file contains the definition of its member objects cin and cout.
(v) If iostream is not included in program, an error message will occur on cin and cout.

3. using namespace std;
(i) The line using namespace std; tells the compiler to use standard namespace.
(ii) Namespace collects identifiers used for class, object and variables.
(iii) They provide a method of preventing name conflicts in large projects.
(iv) It is a new concept introduced by the ANSI C++ standards committee.

4. int main ( )
(i) C++ program is a collection of functions and every program must have a main function.
(ii) The main( ) function is the starting point where all C++ programs begin their execution.
(iii) The executable statements should be inside the main( ) function.TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 17

The statements between the turly braces (Line number 5 to 8) are executable statements.

Question 52.
Explain the important steps for creating and executing a C++ program.
Answer:
The following four steps are followed for creating and executing a C++ program.
(i) Creating Source code: Creating includes typing and editing the valid C++ code as per the rules followed by the C++ Compiler.
(ii) Saving source code with extension .cpp: After typing, the source code should be saved with the extension .cpp
(iii) Compilation: This is an important step in constructing a program. In compilation, compiler links the library files with the source code and verifies each and every line of code.
(iv) Execution: This is the final step of construction of a C++ Program. In this stage, the object file becomes an executable file with extension .exe.

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 18

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 53.
Explain the various formatting options available ¡n C++.
Answer:
The commonly used manipulators are endl, setw, setfill, setprecision and setf.
(i) endl – Inserts a new line and flushes the buffer (Flush means – clean)
(ii) ‘\n’ – Inserts only a new line.
(iii) setw ( ): setw manipulator sets the width of the field assigned for the output. The field width determines the minimum number of characters to be written in output.
Syntax:
setw(number of characters)
(iv) setfill ( ):This manipulator is usually used after setw. If the presented value does not entirely fil! the given width, then the specified character in the setfihl argument is used for filling the empty fields.
Syntax:
setfill (character);
Eg:
cout<<”\n H.R..A :“<<setw(10)
< (v) setprecision ( ):This is used to display numbers with fractions in specific number of digits.
Syntax: setprecision (number of digits);

Question 54.
Explain the different types of expression used in C++ with example.
Answer:

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 19

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 20

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 55.
Explain the types of conversion in detail.
Answer:
The process of converting one fundamental type into another is called as “Type Conversion”. C++ provides two types of conversions.
(i) Implicit type conversion
(ii) Explicit type conversion.

(i) Implicit type conversion:
This conversion is performed by the compiler automatically. So, implicit conversion is also called as “Automatic conversion”.
If the type of the operands differ, the compiler converts “smaller” type to “wider” type which is called “type promotion”.
Eg:
#include
using namespace std;
int main( )
{
int a=6;
float b=3.14;
cout<< a+b;
}
In the above program, operand a is an int type and b is a float type. During the execution of the program, int is converted into a float, because a float is wider than int.

(ii) Explicit type conversion:
It is used to convert from one data type to another specific data type by the programmer. It is called as “type casting”.
Syntax:
(type-name) expression;
Where type-name is a valid C++ data type to which the conversion is to be performed.
Eg:
#include
using namespace std;
int main( )
{
float varf=78.685;
cout<<(int) varf;
In the above program, variable varf is declared as a float with an initial value 78.685. The value of varf is explicitly converted to an mt type in cout statement. Thus, the final output will be 78.

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 56.
Write C++ programs to interchange the values of two variables.
(i) Using with third variable
(ii) Using without third variable
Answer:
(i) Using with third variable.
#include
using namespace std;
int main ( )
int a,b,temp;
cout<<“\n Enter 1st number:”; cin>>a;
cout<<“\n Enter 2nd number:”; cin>>b;
cout<<“Before swapping: First number: “<<a<<“Second number :”<<b;
temp a;
a = b;
b = temp;
cout<<“\n After swapping:
First number: “<<a<<“Second number: “<<b;
return 0;
}
Output:
Enter 1st number : 20
Enter 2nd number: 50
Before swapping:
First number : 20
second number: 50
After swapping:
First number : 50
second number: 20

(ii) Using without third variable:
#inciude
using namespace std;
int, main ( )
{
int a,b;
cout<<“\n Enter two numbers:”; cin>>a>>b; .
a = a+b; .
b = a-b;
a = a-b;
cout<<“\n After swapping numbers
are:”;
cout<<a<<” “<<b;
return 0;
}
Output:
Enter 1st number : 90
Enter. 2nd number: 100
Before swapping: First number: 90
second number: 100
After, swapping: First number:100
second number: 90

Question 57.
Write C++ program to do the following:
(i) To find the perimeter and area of a quadrant.
(ii) To find the area of triangle.
(iii) To convert the temperature from Celsius to Fahrenheit.
Answer:
(i) Perimeter = 0.57πr + 2r
Area = πr2 ÷ 4
Program:
#include
using namespace std;
int main( )
{
float Peri, Area, r;
eout<<“Enter the value of r:”; cin>>r;
Peri = 0.5*3.14*r+2*r;
Area = 3.14*r*r/4;
cout<<“The perimeter of a , quadrant: “<<peri;
cout<<“\n The area of a quadrant: “<<area; return 0;
}
Output:
Enter the value of r: 7
The perimeter of a quadrant: 24.99
The area of a quadrant: 38.465

(ii) (area – sqrt(s*(s-a)*(s-b)*(s-c))
Where s= (a+b+c)/2
Program:
#include
#include
using namespace std;
int main( )
{
float a,b, c, s, area;
cout<<“Enter three sides of a triangle:”; cin>>a>>b>>c;
s=(a+b+c)/2
area = sqrt(s*((s-a)*(s-b)*(s-c));
cout<<“Area of triangle is:”<<area;
return 0;
}
Output:
Enter three sides of a triangle:5 8 10
Area of triangle is 19.81

(iii) Program:
#include
using namespace std;
int main( )
{
float f,c;
cout<<“Enter the temperature in celsius\n”; cin>>c;
f = (9.a/5.0)*c+32
cout<<c<<“centigrade is equal to”<<f<<“fahrenheit”;
return 0;
}
Output:
Enter the temperature in celsius 36 36 centigrade is equal to 96.8 Fahrenheit

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 58.
Write a C++ to find the total and percentage of marks you secured Irani 10th Standard Public Exam. Display all the marks one-by- one along with total and percentage. Apply formatting functions.
Answer:
#include
#include
using namespacestd;
int main( )
{
int m1, m2, m3, m4, m5, tot;
float per;
char name[30]; .
cout<<“\n Enter Name:”;
cin»name;
cout<<“\n Enter Tamil Mark:”; cin>>m1;
cout<<“\n Enter English Mark:”; cin>>m2;
cout<<“\n Enter Maths Mark:”; cin>>m3;
cout<<“\n Enter Science Mark:”; cin>>m4;
cout<<“\n Enter Social science Mark:”; cin>>m5;
Tot = m1 + m2 + m3 + m4 + m5;
Per = tot/5;
cout< setw(10)<< name<<endl:
cout< setw (10) <<ml«endl ;
cout«setw (25)<<“English:”
setw (10)<<m2<<endl;
cout< setw(10)<<m3< cout<<setw(25)<<“Science:”
setw(10)<<m4<<endl;
cout< setw (10)<<m5< cout«setw (25)<<“Total: ”
setw (10) <<tot<<endl;
cout< setw(10)<<per<<endl;
}
Output:
Enter Name : Kavitha
Enter Tamil Mark : 90
Enter English Mark : 86
Enter Maths Mark : 100
Enter Science Mark : 91
Enter Social science Mark: 87
Name : Kavitha
Tamil : 90
English : 86
Maths : 100
Science : 91
Social science : 87
Total : 454
Percentage : 90.8

Question 59.
What is meant by literals? How many types of integer literals available in C++?
Answer:
Literals are data items whose values do not change during the execution of a program.
There are three types of integer literals available in C++.
(i) Decimal
(ii) Octal
(iii) Hexadecimal.

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 60.
What kind of constants are following?
(i) 26
(ii) 015
(iii) OxF
(iv) 014.9
Answer:
(i) 26 = Integer constant
(ii) 015 = Octal constant
(iii) OxF = Hexadecimal constant
(iv) 014.9 = Decimal constant

Question 61.
What is character constant in C++?
Answer:
Any valid single character enclosed within single quotes is called a character constant. In C++, a character constant must contain one character and must be enclosed within a single quote.
Valid character constants: ‘A’, ‘2’, *$’
Invalid character constants : “A”

Question 62.
How are non-graphic characters represented in C++?
Answer:
The non-graphical characters are represented are using escape sequences. An escape sequence is represented by a backslash followed by one or two characters.
Eg: \a, \b, \f, \0, \On

Question 63.
Write the following real constants into exponent form:
(i) 32.179
(ii) 8.124
(iii) 0.00007
Answer:
(i) 32.179 = 0.32179 × 102 = 0.32179E2
(ii) 8.124 = 0.8124 × 101 = 0.8124E1
(iii) 0.00007 = 0.7 × 10-4 = 0.7E – 4

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 64.
Write the following real constants into fractional form:
(i) 0.23E4
(ii) 0.517E – 3
(iii) 0.5E – 5
Answer:
(i) 0.23E4 = 0.23 × 104 = 2300.0
(ii) 0.517E – 3 = 0.517 × 10-3 = 0.000517
(iii) 0.5E – 5 = 0.5 × 10-5 = 0.000005

Question 65.
What is the significance of null (\0) character in a string?
Answer:
By default, string literals are automatically added with a special character ‘\0’ (Null) at the end.

Question 66.
What is use of operators?
Answer:
The symbols which are used to do mathematical or logical operations are called as “Operators”; The data items or values that the operators act upon are called as “Operands”.

Question 67.
What are binary operators? Give examples arithmetic binary operators.
Answer:
Operators that required two operands are called binary operators.
Arithmetic operators perform simple arithmetic operations like addition, subtraction, multiplication, division etc.,

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 21

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 68.
What does the modulus operator % do?
Answer:
Modulus operator is used to find the remainder of a division.
Eg: 10%3 = 1 (remainder of the division)

Question 69.
What will be the result of 8.5 % 2?
Answer:
0.

Question 70.
Assume that R starts with value 35. What will be the value of S from the following expression? S – (R- -)+(++R)
Answer:
R = 35
S = 35+36
S = 71

Question 71.
What will be the value of j = – k + 2k. if k is 20 initially ?
Answer:
k = 20, –k = k – 1 = 20 – 1 = 19
j = –k+2k, Now k = 19
= 19 + 2*19
= 19 + 38
= -57

Question 72.
What will be the value of p = p * ++j where j is 22 and p = 3 initially?
Answer:
p = p*++j
p = 3*23
p = 69

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 73.
Give that i = 8, j = 10, k = 8, What will be result of the following expressions?
(i) i < k
(ii) i < j
(iii) i > = k
(iv) i = = j
(v) j I = k
Answer:
(i) i < k = 0
(ii) i < j = 1
(iii) i >= k = 1
(iv) i = = j = 0
(v) j! = k = 1
[Hint ∵ 0 (false) 1 (true)]

Question 74.
What will be the order of evaluation for the following expressions?
(i) i + 3 >= j – 9
(ii) a +10 < p – 3 + 2q
Answer:
(i) Step 1: i + 3
Step 2: j – 9
Step 3: i + 3 >= j – 9

(ii) Step 1: 2q
Step 2: a+10
Step 3: p – 3
Step 4: a + 10 < p – 3 + 2q

Question 75.
Write an expression involving a logical operator to test, if marks are 75 and grade is ‘A’.
Answer:
((Mark >= 75) &&(grade = = ‘A’))

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 76.
What do you mean by fundamental data types?
Answer:
The predefined data types available with C++ are called the Fundamental (atomic) data types. There are five fundamental data types in C++: char, int, float, double and void.

Question 77.
The data type char is used to represent characters, then why is it often termed as an integer type?
Answer:
(i) All the characters are represented in memory by the associated as ASCII codes. So character data type is often said to be an integer type.
(ii) If a variable is declared as char, C++ allows storing either a character or an integer value.

Question 78.
What is the advantage of floating point numbers over integers?
Answer:
(i) They can represent values between the integers.
(ii) They can represent a much greater range of values.

Question 79.
The data type double is another floating point type. Then why is it treated as a distinct data type?
Answer:
The double data type is for double precision floating point numbers, (precision means significant numbers after decimal point). The double is also used for handling floating point numbers. But, this type occupies double the space than float type. This means, more fractions can be accommodated in double than in float type. The double is larger and slower than type float. The double is used in a similar way as that of float data type.

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 80.
What is the use of void data type?
Answer:
The literal meaning for void is ‘empty space’.
(i) In C++, the void data type specifies an empty set of values.
(ii) It is used as a return type for functions that do not return any value.

Question 81.
What is meant by type conversion?
Answer:
The process of converting one fundamental type into another is called as “Type Conversion”.

Question 82.
How implicit conversion different from explicit conversion?
Answer:
Implicit type conversion is a conversion performed by the compiler automatically, where as explicit conversion is done by programmer.

Question 83.
What is difference between endl and \n?
Answer:
endl – Inserts a new line and flushes the buffer.
\n – Inserts only a new line.

Question 84.
What is the use of references?
Answer:
A reference provides an alias for a previously defined variable. Declaration of a reference consists of base type and an & (ampersand) symbol; reference variable name is assigned value of a previously declared variable.
Syntax: <& reference_variable> =

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 85.
What is the use of setprecision ( ) ?
Answer:
It is used to display numbers with fractions in specific number of digits.
Syntax: setprecision (number of digits);

Question 86.
What is meant by a token? Name the token available in C++.
Answer:
The smallest individual unit in a program is known as a token or a lexical unit. The tokens are available in C++ are:
(i) Keywords
(ii) Literals
(iii) Punctuators
(iv) Identifiers
(v) Operators.

Question 87.
What are keywords? Can keywords be used as identifiers?
Answer:
Keywords are the reserved words which convey specific meaning to the C++ compiler. No, keywords cannot be used as identifiers.

Question 88.
The following constants are of which type?
(i) 39
(ii) 032
(iii) OXCAFE
(iv) 04.14
Answer:
(i) 39 = Integer
(ii) 032 = Octal
(iii) OXCAFE – Hexadecimal
(iv) 04.14 = Decimal

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 89.
Write the following real constants into the exponent form:
(i) 23.197
(ii) 7.214
(iii) 0.00005
(iv) 0.319
Answer:
(i) 23.197 = 0.23197 × 102 = 0.23197E2
(ii) 7.214 = 0.7214 × 101 = 0.7214E1
(iii) 0.00005 = 0.5 × 104 = 0.5E – 4
(iv) 0.319 – 0.0319 × 101 = 0.0319E1.

Question 90.
Assume n = 10; what will be result of n>>2;?
Answer:
The equivalent binary value of 10 is (00001010)2

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 22

n>>2 = (00000010)2 = (2)10

Question 6.
Match the following:

A

 B

(i) Modulus  (a) Tokens
(ii) Separators  (b) Remainder of a division
(iii) Stream extraction  (c) Punctuators
(iv) Lexical units  (d) get form

Answer:
(i) – (b)
(ii) – (c)
(iii) – (d)
(iv) – (a)

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 91.
Describe the differences between keywords and identifiers?
Answer:

Keywords

 Identifiers

Keywords are the reserved words which convey specific meaning to the C++ complier.  Identifiers are the user – defined names given to different parts,vof the C++ program.
They are essential elements to construct C++ program.  These are the fundamental building blocks of a program.
Eg: Auto, break, class etc.,  Eg: total- sales

Question 92.
Is C++ case sensitive? What is meant by the term “case sensitive”?
Answer:
Yes, C++ is a case sensitive. So all the keywords must be in lower case. It treats upper and lower case characters differently. Eg: int, break, auto etc.

Question 93.
Differentiate “=” and “== “.
Answer:

=

 ==

It is an assignment operator. It is an equal to operator.
It is used to assign the value of variable or expression which is on the left hand side of an assignment statement. It is used to compare value of both left and right operands.
Eg: A = 32 Eg: a = = b

Question 94.
Assume a = 10, b = 15; What will be the value of a^b?
Answer:
a = 10 binary equivalent = (00001010)2
b = 15 binary equivalent = (00001111)2

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 23

(a^b) = (00000101)2 = (5)10

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 95.
What is the difference between “Run time error” and “Syntax error”?
Answer:

Runtime Error

Syntax Error

A mntime error is that occurs during the execution of a program. It occurs because of some illegal operation that take place. Syntax error occurs when grammatical values of C++ are violated.
Eg: If a program tries to Open a file which does not exit, it results in a run time error Eg: cout<< “welcome to programming in C++”. As per grammatical rules of C++, every executable statement should terminate with a semicolon, but this statement does not end with a semicolon. So, C++ will throw an error.

Question 96.
What are the differences between “Logical error” and “Syntax error”?
Answer:

Logical error

Syntax error

A Program has not produced expected result even though the program is grammatically correct. Syntax errors occur when grammatical rules of C++ are violated.
It may be happened by wrong use of variable / operator / order of execution etc.,  Eg: If you type as follows, C++ will throw an error. cout<< “Welcome to Programming in C++”.
This means, program is grammatically correct, but it contains some logical error. So, Semantic error is also called as “Logic Error”. As per grammatical rules of C++, every executable statement should terminate with a semicolon. But, this statement does not end with a semicolon.

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 97.
Write about Binary Operators used in C++.
Answer:
(i) Arithmetic operators: Arithmetic operators perform simple arithmetic operations like addition, subtraction, multiplication, division etc.,

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 24

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 25

The above mentioned arithmetic operators are binary operators which requires minimum of two operands.

(ii) Relational Operators:
• Relational operators are used to determine the relationship between its operands.
• When the relational operators are applied on two operands, the result will be a Boolean value
i. e., 1 or 0 to represents True or False respectively. C++ provides six relational operators.
They are,

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 26

• In the above examples, the operand a is compared with b and depending on the relation, the result will be either 1 or 0. i.e., 1 for true, 0 for false.
• All six relational operators are binary operators.

(iii) Logical Operators:
• A logical operator is used to evaluate logical and relational expressions.
• The logical operators act upon the operands that are themselves called as logical expressions. C++ provides three logical operators.

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 27

(iv) Bitwise Operators:
Bitwise operators work on each bit of data and perform bit-by-bit operation. In C++, there are,.three kinds of bitwise operators, which are:
(a) Logical bitwise operators
(b) Bitwise shift operators
(c) One’s compliment operators

(a) Logical bitwise operators:

&  Bitwise AND  (Binary AND)
1  Bitwise OR  (Binary OR)
A  Bitwise Exclusive OR  (Binary XOR)

• Bitwise AND (&) will return 1 (True) if both the operands are having the value 1 (True); Otherwise, it will return 0 (False)
• Bitwise OR (|) will return 1 (True) if any one of the operands is having a value 1 (True); It returns 0 (False) if both the operands are having the value 0 (False)
• Bitwise XOR (^) will return 1 (True) if only one of the operand is having a value 1 (True).If both are True or both are False, it will return 0 (False).
Truth table for bitwise operators (AND, OR, XOR)

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 28

Eg:
If a = 65, b = 15
Equivalent binary values of 65 = 0100 0001; 15 = 0000 1111

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 29

(b) The Bitwise shift operators:
There ate two bitwise shift operators in C++, Shift left (<<) and Shift right (>>).
• Shift left (<<) – The value of the left operand is moved to left by the number of bits specified by the right operand. Right operand should be an unsigned integer. • Shift right (>>) – The value of the left operand is moved to right by the number of bits specified by the right operand. Right operand should be an unsigned integer.
Eg:
If a = 15; Equivalent binary value of a is 0000 1111

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 30

(v) Assignment Operators:
• Assignment operator is used to assign a value to a variable which is on the left hand side of an assignment statement.
• = (equal to) is commonly used as the assignment operator in all computer programming languages.
• This operator copies the value at the right side of the operator to the left side variable. It is also a binary operator.

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 31

C++ uses different types of assignment operators. They are called as Shorthand assignment operators.

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 32

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 33

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 98.
What are the types of Errors?
Answer:

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 34

Question 99.
Assume a=15, b=20; What will be the result of the following operations?
(a) a&b,
(b) a | b,
(c) a^b,
(d) a>>3,
(e) (~b)
The binary equivalent of 15 is 00001111
The binary equivalent of 20 is 00010100
Answer:

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 35

a&b = (00000100)2 = (4)10
a|b = (00011111)2 = (31)10
a^b = (00011011)2 = (27)10
a>>3 = (00000001)2 = (1)10
(~b) = (11101011)2 = (-21)10

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 100.
Write a short note on const keyword with an example.
Answer:
const is the keyword used to declare a constant, const keyword modifies / restricts the accessibility of a variable. So, it is known as Access modifier.
Eg:
int num =100;

Question 101.
What is the use of setw( ) format manipulator?
Answer:
setw manipulator sets the width of the field assigned for the output. The field width determines the minimum number of characters to be written in output.
Syntax: setw(number of characters)

Question 102.
Why is char often treated as integer data type?
Answer:
Character data type is often said to be an integer type, since all the characters are represented in memory by their associated ASCII Codes. If a variable is declared as char, C++ allows storing either a character or an integer value.

Question 103.
What is a reference variable? What is its use?
Answer:
A reference provides an alias for a previously defined variable. Declaration of a reference consists of base type and an & (ampersand) symbol; reference variable name is assigned the value of a previously declared variable.
Syntax:
<& reference_variable> =

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 104.
Consider the following C++ statement. Are they equivalent?
Answer:
char ch = 67;
char ch = ‘C’;
Yes, they are equivalent.

Question 105.
What is the difference between 56L and 56?
Answer:
56L instructs the compiler to store the given value as long and unsigned int.
56 stores the value in an int.

Question 106.
Determine which of the following are valid constant? And specify their type.
(i) 0.5
(ii) ‘Name’
(iii) ‘\t’
(iv) 27,822
Answer:

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 36

Question 107.
Suppose x and y are two double type variable that you want add as integer and assign to an integer variable. Construct a C++ statement for the doing so.
Answer:
double x,y;
int z = (int)x + int(y)

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 108.
What will be the result of following if num = 6 initially.
(a) cout << num;
(b) cout <<(num==5); Output: (a) 6 (b) 0

Question 109.
Which of the following two statements are valid? Why? Also write their result.
Answer:
int a;
(i) a = 3,014;
(ii) a=(3,014);
(i) a = 3,014; Invalid
(ii) a = (3,014); Valid.

Question 110.
What are arithmetic operators in C++? Differentiate unary and binary arithmetic operators. Give example for each of them.
Answer:
Arithmetic operators perform simple arithmetic operations like addition, subtraction, multiplication, division etc.,

TN State Board 11th Computer Science Important Questions Chapter 9 Introduction to C++ 37

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

The above mentioned arithmetic operators are binary operators which requires minimum of two operands.

Question 111.
Evaluate x+= x + ++x; Let x=5;
Answer:
++x =x+1 =5+1=6 x =6 x+ = 6+6 x+=12 x =x+12 =6+12=18 x = 18

Question 112.
How relational operators and logical operators related to one another?
Answer:
Relational operators are used to determine the relationship between its operands and produce the Boolean result. Logical operators are used to combine the results of two or more comparison expressions that use relational operators. Logical operators don’t compare values they combine Boolean values and produce a Boolean result. Logical operators are: && (and), ||(or), !(not)

Question 113.
Evaluate the following C++ expressions where x, y, z are integers and m, n are floating point numbers. The value of x = 5, y = 4 and m=2.5;
(i) n = x + y / x;
(ii) z = m * x + y;
(iii)z= (x++) * m+x;
Answer:
(i) n = x+y/x; N = 5+4/5 N = 5+0 (the / symbol gives only the quotient) N = 5
(ii) z = m*x+y = 2.5*5+4 = 12.5+4 = 16.5 Z = 16 (z is declared as integer data type it ignores the fractional part)
(iii) z = (x++)*m+x; = 5 * 2.5+5 = 12.5+5 = 17.5 Z 17 (z is declared as integer data type it takes the integer part and ignores the fractional part).

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Choose the correct answer:

Question 1.
C++ was developed by:
(a) Charles Babbage
(b) Bjame Stroustrup
(c) Bill Gates
(d) Sundar Pichai
Answer:
(b) Bjame Stroustrup

Question 2.
C++ was developed in the year:
(a) 1960
(b) 1979
(c) 1985
(d) 1963
Answer:
(b) 1979

Question 3.
C++ supports both:
(a) procedural language
(b) object oriented programming
(c) both (a) and (b)
(d) none
Answer:
(c) both (a) and (b)

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 4.
The name C++ was coined by:
(a) Rick Maseitti
(b) Charles Babbage
(c) Bill Gates
(d) Dennis Ritchie
Answer:
(a) Rick Maseitti

Question 5.
C++ was developed in Laboratory.
(a) T laboratory
(b) AT laboratory
(c) AT & T Bell laboratory
(d) None of the above
Answer:
(c) AT & T Bell laboratory

Question 6.
In ______ the name was change as C++ by Rick Maseitti.
(a) 1983
(b) 1966
(c) 1989
(d) 1994
Answer:
(a) 1983

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 7.
The latest standard version published in December 2017 as:
(a) ISO/ICE 14882:2017
(b) ISO/ICE 14883:2017
(c) ISO/ICE 14885:2017
(d) ICE/ISO 14882:2017
Answer:
(a) ISO/ICE 14882:2017

Question 8.
The first standardized version was published in the year:
(a) 1999
(b) 1986
(c) 1970
(d) 1998
Answer:
(d) 1998

Question 9.
_________ is a set of characters which are allowed to write a C++ program.
(a) character set
(b) number set
(c) symbols
(d) special characters
Answer:
(a) character set

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 10.
The smallest individual unit in a program is known as:
(a) character set
(b) symbols
(c) token
(d) keywords
Answer:
(c) token

Question 11.
_________ is also called as token.
(a) Logical element
(b) Lexical unit
(c) Logical units
(d) symbols
Answer:
(b) Lexical unit

Question 12.
__________ are the reserved works which convey specific meaning to the C++ compiler.
(a) Tokens
(b) Identifiers
(c) Constants
(d) Keywords
Answer:
(d) Keywords

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 13.
C++is:
(a) package
(b) software
(c) case sensitive
(d) non-case sensitive
Answer:
(c) case sensitive

Question 14.
Identify the invalid variable name:
(a) Num
(b) Num2
(c) _add
(d) 2 myfile
Answer:
(d) 2 myfile

Question 15.
__________ are data items whose values do not change during the execution of program.
(a) Literals
(b) This
(c) Identifiers
(d) Special characters
Answer:
(a) Literals

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 16.
Literals are also called as:
(a) identifiers
(b) character set
(c) constants
(d) string
Answer:
(c) constants

Question 17.
______ are whole numbers without any fraction.
(a) String
(b) Integers
(c) Decimal
(d) Keywords
Answer:
(b) Integers

Question 18.
In C++ there are _____ types of integer constants.
(a) two
(b) four
(c) five
(d) three
Answer:
(d) three

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 19.
Identify the Invalid decimal:
(a) 725
(b) -2T
(c) 4.56
(d) 7,500
Answer:
(d) 7,500

Question 20.
Any sequence of one or more octal values that begins with 0 is considered as an ________ constant.
(a) decimal
(b) octal
(c) binary
(d) hexadecimal
Answer:
(b) octal

Question 21.
Identify the invalid octal constant:
(a) 012
(b) -027
(c) +0231
(d) 0158
Answer:
(d) 0158

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 22.
Any sequence of one or more values that starts with ox or OX is considered as:
(a) octal
(b) binary
(c) hexadecimal
(d) decimal
Answer:
(c) hexadecimal

Question 23.
The suffix ________ added with any constant forces that to be represented as long constant.
(a) L or l
(b) I or i
(c) O or o
(d) X or x
Answer:
(a) L or l

Question 24.
The suffix _____ added with any constant forces that to be represented as unsigned constant respectively.
(a) U or u
(b) L or l
(c) O or o
(d) I or i
Answer:
(a) U or u

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 25.
Exponent form of real constant consists of a parts.
(a) 1
(b) 2
(c) 3
(d) 4
Answer:
(b) 2

Question 26.
Identify the invalid character constants:
(a) ‘A’
(b) ‘2’
(c) ‘$’
(d) “A”
Answer:
(d) “A”

Question 27.
ASCII was first developed and published in:
(a) 1964
(b) 1963
(c) 1965
(d) 1970
Answer:
(b) 1963

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 28.
An escape sequence is represented by __________ followed by one or two characters.
(a) double quotes
(b) single quote
(c) backslash
(d) forward slash
Answer:
(c) backslash

Question 29.
\t is a:
(a) vertical tab
(b) backslash
(c) backspace
(d) horizontal tab
Answer:
(d) horizontal tab

Question 30.
\r is a:
(a) alert bell
(b) form feed
(c) carriage return
(d) backslash
Answer:
(c) carriage return

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 31.
\n is a:
(a) new line
(b) carriage return
(c) form feed
(d) horizontal tab
Answer:
(a) new line

Question 32.
String literals are automatically added with a special character _________ at the end.
(a) ‘\0’
(b) ‘\n’
(c) ‘\f
(d) ‘\v’
Answer:
(a) ‘\0’

Question 33.
Identify the valid string literals:
(a) ‘welcome’
(b) ‘A’
(c) ‘1234’
(d) “welcome”
Answer:
(d) “welcome”

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 34.
The symbols which are used to do some mathematical or logical operations are called as:
(a) operands
(b) operators
(c) constants
(d) identifiers
Answer:
(b) operators

Question 35.
The data items or values that the operators act upon are called as:
(a) operands
(b) literals
(c) operators
(d) identifiers
Answer:
(a) operands

Question 36.
Unary operator requires operand.
(a) one
(b) two
(c) three
(d) four
Answer:
(a) one

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 37.
Binary operator requires ______ operand.
(a) one
(b) two
(c) three
(d) four
Answer:
(b) two

Question 38.
Ternary operator requires _______ operand.
(a) one
(b) two
(c) three
(d) four
Answer:
(c) three

Question 39.
If N1 = 10 and N2 = 20. Find the value of S where S = N1+++++N2. –
(a) 30
(b) 29
(c) 32
(d) 31
Answer:
(d) 31\

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 40.
In C++ there are _______ types of bitwise operators.
(a) 2
(b) 4
(c) 5
(d) 3
Answer:
(d) 3

Question 41.
There are ________ bitwise shift operators in C++.
(a) 2
(b) 3
(c) 4
(d) 6
Answer:
(a) 2

Question 42.
_______ operator is used to assign a value to a variable.
(a) Bitwise
(b) Logical
(c) Assignment
(d) Arithmetic
Answer:
(c) Assignment

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 43.
In C++ conditional operator is also called as operator.
(a) Unary
(b) Binary
(c) Ternary
(d) Logical
Answer:
(c) Ternary

Question 44.
_______ is a conditional operator.
(a) : :
(b) *
(c) &
(d) ?:
Answer:
(d) ?:

Question 45.
_________ is a address of operator.
(a) →
(b) &
(c) →*
(d) *
Answer:
(b) &

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 46.
______ is used for multiplication as well as for pointer to a variable.
(a) ::
(b) *
(c) &
(d) ?:
Answer:
(b) *

Question 47.
_______ are also called as separators.
(a) Punctuators
(b) Strings
(c) Constants
(d) Identifiers
Answer:
(a) Punctuators

Question 48.
______ are symbols, which are used as delimiters, while constructing a C++ program.
(a) Logical operators
(b) Binary operators
(c) Punctuators
(d) Arithmetic operators
Answer:
(c) Punctuators

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 49.
C++ provides the ________ operator to get input.
(a) >>
(b) <<
(c) >
(d) <
Answer:
(a) >>

Question 50.
The >> operator called as:
(a) Stream extraction
(b) Stream insertion
(c) Input operator
(d) Output operator
Answer:
(a) Stream extraction

Question 51.
Stream extraction operator is also called as _______ operator.
(a) put to
(b) get form
(c) set form
(d) set into
Answer:
(b) get form

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 52.
C++ provides __________ operator to perform in output operation.
(a) << (b) >>
(c) < (d) >
Answer:
(a) <<

Question 53.
The operator << is called the ______ operator.
(a) Stream insertion
(b) Stream extraction
(c) Expression
(d) Ternary
Answer:
(a) Stream insertion

Question 54.
// are considered as ________ statements.
(a) comment
(b) executable
(c) printable
(d) preprocessor
Answer:
(a) comment

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 55.
The symbol _________ is a directive for the preprocessor.
(a) $
(b) &
(c) ::
(d) #
Answer:
(d) #

Question 56.
______ provide a method of preventing name conflicts in large projects.
(a) iostream
(b) name space
(c) main ( )
(d) int
Answer:
(b) name space

Question 57.
The executable statements should be inside the _________ function.
(a) namespace
(b) size of
(c) int ( )
(d) main ( )
Answer:
(d) main ( )

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 58.
The object file has an extension:
(a) .ojb
(b) .ocb
(c) .obj
(d) .obf
Answer:
(c) .obj

Question 59.
______ makes it easy to create, compile and execute a C++ program.
(a) GUI
(b) Command prompt
(c) Operating system
(d) IDE
Answer:
(d) IDE

Question 60.
To create a source file ______ is used.
(a) Ctrl + N
(b) Ctrl + P
(c) Shift + N
(d) Shift + ctrl + N
Answer:
(a) Ctrl + N

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 61.
______ occur when grammatical rules of C++ are violated.
(a) Syntax errors
(b) Semantic errors
(c) Run-time errors
(d) Logical errors
Answer:
(a) Syntax errors

Question 62.
_________ error occurs when the program is grammatically correct, but it contains some logical error.
(a) Lexical
(b) Syntax
(c) Semantic
(d) Run-time
Answer:
(c) Semantic

Question 63. Every programming language has __________ fundamental elements.
(a) 3
(b) 2
(c) 4
(d) 5
Answer:
(b) 2

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 64.
In a programming language, fields are referred as:
(a) data
(b) records
(c) objects
(d) variables
Answer:
(d) variables

Question 65.
Values are referred to as:
(a) objects
(b) classes
(c) data
(d) variables
Answer:
(c) data

Question 66.
In C++ the data types are classified as __________ main categories.
(a) four
(b) three
(c) six
(d) five
Answer:
(b) three

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 67.
The _________ are the named memory locations to hold values of specific data types.
(a) objects
(b) functions
(c) variables
(d) class
Answer:
(c) variables

Question 68.
________ data types are predefined data types available with C++.
(a) basic
(b) fundamental
(c) derived
(d) user – defined
Answer:
(b) fundamental

Question 69.
There are _________ fundamentals data types in C++.
(a) three
(b) four
(c) five
(d) six
Answer:
(c) five

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 70.
The literal meaning for void is:
(a) half space
(b) empty space
(c) no space
(d) none of these
Answer:
(b) empty space

Question 71.
int data type has ____ bytes.
(a) 1
(b) 2
(c) 3
(d) 8
Answer:
(b) 2

Question 72.
double data type has _______ bytes.
(a) 1
(b) 2
(c) 4
(d) 8
Answer:
(d) 8

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 73.
char data type has _______ bytes.
(a) 1
(b) 2
(c) 5
(d) 8
Answer: (a) 1

Question 74.
float data type has ____ bytes.
(a) 4
(b) 3
(c) 2
(d) 8
Answer:
(a) 4

Question 75.
__________ can be used to modify the memory allocation of any fundamental data type.
(a) variables
(b) modifiers
(c) data type
(d) objects
Answer:
(b) modifiers

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 76.
Modifiers are also called as:
(a) qualifiers
(b) variables
(c) constants
(d) functions
Answer:
(a) qualifiers

Question 77.
There are ________ modifiers used in C++.
(a) three
(b) six
(c) four
(d) five
Answer:
(c) four

Question 78.
short int has the value range from:
(a) -32,768 to 32,767
(b) 32,767 to -32,768
(c) -32,678 to 33,676
(d) 32,678 to 33,676
Answer:
(a) -32,768 to 32,767

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 79.
long double has __________ bytes space in memory.
(a) 5
(b) 11
(c) 10
(d) 12
Answer:
(c) 10

Question 80.
1 byte = ______ bits.
(a) 4
(b) 2
(c) 6
(d) 8
Answer:
(d) 8

Question 81.
char data type has ________ byte.
(a) 2
(b) 1
(c) 3
(d) 4
Answer:
(b) 1

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 82.
__________ are user-defined names assigned to specific memory locations in which the values are stored.
(a) Variables
(b) Int
(c) Float
(d) Void
Answer:
(a) Variables

Question 83.
There are _____ values associated with a symbolic variable.
(a) one
(b) two
(c) three
(d) four
Answer:
(b) two

Question 84.
Declaration of more than one variable in a single statement is separated by using:
(a) :
(b) ,
(c) ;
(d) .
Answer:
(b) ,

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 85.
Assigning an initial value to a variable during its declaration is called as:
(a) execution
(b) declaration
(c) initialization
(d) compilation
Answer:
(c) initialization

Question 86.
A variable that can be initialized during the execution of a program is called:
(a) dynamic initialization
(b) static initialization
(c) compilation
(d) initialization
Answer:
(a) dynamic initialization

Question 87. _________ manipulator is a member of iostream header file.
(a) endl
(b) setw
(c) setprecision
(d) setf
Answer:
(a) endl

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 88.
__________ manipulator sets the width of the field.
(a) setw ( )
(b) set precision ( )
(c) setfill ( )
(d) setf ( )
Answer:
(a) setw ( )

Question 89.
________ is a combination of operators, constants and variables arranged as per the rules of C++.
(a) Expression
(b) Constant
(c) Keywords
(d) Identifiers types of expressions
Answer:
(a) Expression

Question 90.
There are _______ available in C++.
(a) three
(b) four
(c) six
(d) seven
Answer:
(d) seven

Question 91.
The process of converting one fundamental type into another is called as:
(a) type conversion
(b) float conversion
(c) compilation
(d) execution
Answer:
(a) type conversion

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 92.
C++ provides ______ types of conversion.
(a) two
(b) three
(c) six
(d) seven
Answer:
(a) two

Question 93.

(i) Arithmetic operation  (a) a*=5
(ii) Relational operation  (b) a+b
(iii) Unary operation  (c) a<=b
(iv) Assignment operation  (d) ++a

(a) (i) – (c); (ii) – (d); (iii) – (a); (iv) – (b)
(b) (i) – (a); (ii) – (d); (iii) – (b); (iv) – (c)
(c) (i) – (b); (ii) – (c); (iii) – (d); (iv) – (a)
(d) (i) – (d); (ii) – (b); (iii) – (a); (iv) – (c)
Answer:
(c) (i) – (b); (ii) – (c); (iii) – (d); (iv) – (a)

Question 94.
Match the following:

(i) Address of  (a) ::
(ii) Indirection component selector  (b) *
(iii) Scope resolution  (c) &
(iv) Dereference  (d) →

(a) (i) – (c); (ii) – (d); (iii) – (a); (iv) – (b)
(b) (i) – (d); (ii) – (c); (iii) – (b); (iv) – (a)
(c) (i) – (b); (ii) – (a); (iii) – (d); (iv) – (c)
(d) (i) – (d); (ii) – (c); (iii) – (a); (iv) – (b)
Answer:
(a) (i) – (c); (ii) – (d); (iii) – (a); (iv) – (b)

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 95.
Identify the correct statement:
(a) cin>x;
(b) cin>>x>>;
(c) cin>>x>>y;
(d) cin>>x<>x>>y;
Answer:
(c) cin>>x>>y;

Question 96.
Identify the incorrect statement:
(a) The operator « is called the “stream insertion” or “put to” operator
(b) Semantic error is also called as “Logic error”
(c) In C++ the source code should be saved with the extension .c
(d) Compilation translates the source code into machine readable object file with an extension.obj
Answer:
(c) In C++ the source code should be saved with the extension .c

Question 97.
Choose the odd man out:
(a) getch
(b) endl
(c) setw
(d) setf
Answer:
(a) getch

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 98.
Assertion (A):
Process of converting one fundamental type into another is called as “Type conversion”.
Reason (R):
An expression is a combination of operators, Constants and Variable.
(a) Both A and R are true and RJs the correct explanation for A. extension .obj
(b) Both A and R are true, but R is not the correct explanation for A.
(c) A is true, but R is false.
(d) A is false, but R is true.
Answer:
(b) Both A and R are true, but R is not the correct explanation for A.

Question 99.
Who developed C++?
(a) Charles Babbage
(b) Bjame Stroustrup
(c) Bill Gates
(d) Sundar Pichai
Answer:
(b) Bjame Stroustrup

Question 100.
What was the original
(a) CPP
(b) Advanced C
(c) C with Classes
(d) Class with C
Answer:
(c) C with Classes

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 101.
Who coined C++?
(a) Rick Mascitti
(b) Rick Bjrane
(c) Bill Gates
(d) Dennis Ritchie
Answer:
(a) Rick Mascitti

Question 102.
The smallest individual unit in a program is:
(a) Program
(b) Algorithm
(c) Flowchart
(d) Tokens
Answer:
(d) Tokens

Question 103.
Which of the following operator is extraction operator of C++?
(a) >>
(b) <<
(c) <>
(d) ^^
Answer:
(a) >>

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 104.
Which of the following statements is not true?
(a) Keywords are the reserved words convey specific meaning to the C++ compiler.
(b) Reserved words or keywords can be used as an identifier name.
(c) An integer constant must have at least one digit without a decimal point.
(d) Exponent form of real constants consists of two parts.
Answer:
(b) Reserved words or keywords can be used as an identifier name.

Question 105.
Which of the following is a valid string literal?
(a) ‘A’
(b) ‘Welcome’
(c) 1232
(d) “1232”
Answer:
(d) “1232”

Question 106.
A program written in high level language is called as:
(a) Object code
(b) Source code
(c) Executable code
(d) All the above
Answer:
(b) Source code

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 107.
Assume a = 5, b = 6; what will be result of a&b?
(a) 4
(b) 5
(c) 1
(d) 0
Answer:
(a) 4

Question 108.
Which of the following is called as compile time operators?
(a) sizeof
(b) pointer
(c) virtual
(d) this
Answer:
(a) sizeof

Question 109.
How many categories of data types available in C++?
(a) 5
(b) 4
(c) 3
(d) 2
Answer:
(c) 3

Question 110.
Which of the following data types is not a fundamental type?
(a) designed
(b) int
(c) float
(d) char
Answer:
(a) designed

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 111.
What will be the result of following statement?
charch=‘B’;
cout<<(int) ch;
(a) B
(b) b
(c) 65
(d) 66
Answer:
(d) 66

Question 112.
Which of the character is used as suffix to indicate a floating point value?
(a) F
(b)C
(c) L
(d) D
Answer:
(a) F

Question 113.
How many bytes of memory allocates for the following variable declaration if you are using Dev C++? short int x;
(a) 2
(b) 4
(c) 6
(d) 8
Answer:
(a) 2

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 114.
What is the output of the following snippet?
char ch = ‘A’;
ch = ch + 1;
(a) B
(b) A1
(c) F
(d) 1A
Answer:
(a) B

Question 115.
Which of the following is not a data type modifier?
(a) signed
(b) int
(c) belong
(d) short
Answer:
(b) int

Question 116.
Which of the following operator returns the size of the data type?
(a) sizeof ( )
(b) int ( )
(c) long ( )
(d) double ( )
Answer:
(a) sizeof ( )

Samacheer Kalvi TN State Board 11th Computer Applications Important Questions Chapter 9 Introduction to C++

Question 117.
Which operator to be used to access reference of a variable?
(a) $
(b) #
(c) &
(d) \
Answer:
(c) &

Question 118.
This can be used as alternate to endl command:
(a) \t
(b) \b
(c) \0
(d) \n
Answer:
(d) \n

TN Board 11th Computer Science Important Questions