# Plus One Computer Application Chapter Wise Questions Chapter 5 Data Types and Operators

Students can Download Chapter 5 Data Types and Operators Questions and Answers, Plus One Computer Application Chapter Wise Questions and Answers helps you to revise the complete Kerala State Syllabus and score more marks in your examinations.

## Kerala Plus One Computer Application Chapter Wise Questions  Chapter 5 Data Types and Operators

### Plus One Computer Application Data Types and Operators 1 Mark Questions and Answers

Question 1.
________ is the main activity carried out in computers
Data processing

Question 2.
The data used in computers are different. To differentiate the nature and size of data _____is used.
Data types

Question 3.
Classify the following data types.
int
array
function
char
pointer
void
float
double
structure
Fundamental data types
int
float
double
void
char
Derived data types
array
function
pointer
structure

Question 4.
Sheela wants to store her age. From the following which is the exact data type.
a) void
b) char
c) int
d) double
c) int

Question 5.
Integer data type uses Integer data type ;
a) 5
b) 2
c) 3
d)4
d)4

Question 6.
char data type uses ______ bytes of memory
a) 1
b) 3
c) 7
d) 8
a)1

Question 7.
From the following which data type uses 4 bytes of memory
a) float
b) short
c) char
d) double
a) float

Question 8.
Expand ASCII _______.
American Standard Code for Information Inter-change

Question 9.
Ramu wants to store the value of From the fol-lowing which is correct declaration
a) char pi=3.14157
b) int pi=3.14157
c) float pi=3.14157
d) long pi=3.14157
c) float pi=3.14157

Question 10.
From the following which is not true , to give a variable name.
a) Starting letter must be an alphabet
b) contains digits
c) Cannot be a key word
d) special characters can be used
d) special characters can be used

Question 11.
Pick a valid variable name from the following
a) 9a
b) float
c)age
d) date of birth
c)age

Question 12.
To perform a unary operation how many number of operands needed?
a) 2
b)3
c) 1
d) None of these
c) 1 (Unary means one)

Question 13.
To perform a binary operation how many number of operands needed?
a) 2
b) 3
c) 1
d) None of these.
a) 2 (binary means two)

Question 14.
To perform a ternary operation how many number of operands needed?
a) 2
b) 3
c) 1
d) None of these.
b) 3 (eg: ternary means three)

Question 15.
In C++ 13% 26 =
a) 26
b) 13
c) 0
d) None of these
% is a mod operator i.e, it gives the remainder. Here the remainder is 13.

Question 16.
In C++ 41/2 =
a) 20.5
b) 20
c) 1
d) None of these
b) 20. (The actual result is 20.5 but both 41 and 2 are integers so .5 must be truncated)

Question 17.
++ is a ______ operator
a) Unary
b) Binary
c) Ternary
d) None of these
a) Unary.

Question 18.
Conditional operator is ______ operator
a) Unary
b) Binary
c) Ternary
d)None of these
c) Ternary

Question 19.
% is a operator ______.
a) Unary
b) Binary
c) Ternary
d) None of these
b) Binary

Question 20.
State true or false:
a) Multiplication, division, modulus have equal priority.
b) Logical and (&&) has less priority than logical or ( )
a) True
b) False

Question 21.
_____ is composed of operators and operands.
a) expression
b) Key words
Identifier
d) Punctuators
a) expression

Question 22.
Supply value to a variable at the time of declaration is known as _____.
Initialisation

Question 23.
From the following which is initialisation
a) int k;
b)int k=100;
c) int k[10];
d) None of these
b) int k=100;

Question 24.
State True / False
In an expression all the operands having lower size are converted(promoted) to the data type of the highest sized operand.
True

Question 25.
Classify the following as arithmetic / Logical expression
a) x+y*z
b) xz
c) x/y
d) x>89 || y<80
a) and c) are Arithmetic
b) and d) are Logical

Question 26.
Suppose x=5 and y=2 then what will be cout<<(float) x/y
2.5 The integer x is converted to float hence the result.

Question 27.
Consider the following.
a = 10;
a =100;
Then a =
a) a = 100
b) a = 50
c)a = 10
d) a = 20
a) a = 100. This short hand means a = a*10

Question 28.
Consider the following.
a=10 ;
a+=10;
Then a=
a) a= 30
b) a= 50
c)a=10
d) a=20
d) a=20. This short hand means a=a+10

Question 29.
Pick the odd one out
a) structure
b) Array
c) Pointer
d) int
d) int, it is fundamental data type the others are derived data types

Question 30.
From the following select not a character of C++ language
a) A
b) 9
c)\
d)@
d)@

Question 31.
Consider the following
float x=25.56; cout<<(int)x; Here the data type of the variable is converted. What type of conversion is this?
a) type promotion
b) type” casting
c) implicit conversion
d) None of these
b) type casting (explicit conversion)

Question 32.
Identify the error in the following C++ statement and correct it.
The maximum number that can store in short type is less than 32767. So to store 68000 we have to use long data type.

Question 33.
Consider the following statements in C++ if(mark>=18)
cout<<“Passed”; ’
else ,
cout<<“Failed”;
Suggest an operator in C++ using which the same , output can be produced.
Conditional operator (?:)

### Plus One Computer Application Data Types and Operators 2 Marks Questions and Answers

Question 1.
Analyses the following .statements and write True or False. Justify
i) There* is an Operator in C++ having no special character in it
ii) An operator cannot have more than 2 operands
iii) Comma operator has the lowest precedence
iv) All logical operators are binary in nature
v) It is not possible to assign the constant 5 to 10 different variables using a single C++ expression
vi) In type promotion the operands with lower data , type will be converted to the highest data type in expression.
i) True (size of operator)
ii) False( conditional operator can have 3 operands
iii) True
iv) False
v) False(Multiple assignment is possible,
eg: a=b=c=…..= 5
vi) True

Question 2.
Consider the following declaration.
const int bp;
bp = 100;
Is it valid? Explain it?
This is not valid. This is an error. A constant variable cannot be modified. That is the error and a constant variable must be initialised. So the correct declaration js as follows, const int bp=100;

Question 3.
Consider the following statements in C++
1) cout<<41/2;
2) cout<<41/2.0; Are this two statements give same result? Explain?
This two statements do not give same results. The first statement 41/2 gives 20 instead of 20.5. The reason is 41 and 2 are integers. If two operands are integers the result must be integer, the real part must be truncated. To get floating result either one of the operand must be float. So the second statement gives 20.5. The reason is 41 is integer but 2.0 is a float.

Question 4.
If mark = 70 then what will be the value of variable result in the following result = mark > 50 ? ’P’: ‘F’;
The syntax of the conditional operator is given below Condition? Value if true: Value if false;
Here the conditional operator first checks the condition i.e.,70>50 it is true. So ‘P’ is assigned to the variable result.
So the result is ‘P’

Question 5.
Is it possible to initialise a variable at the time of execution. What kind of initialisation is this? Give an example
Yes it is possible. This is known as Dynamic initialisation.. The example is given below
Eg: int a=10,b=5;
int c=a*b;
here the variable c is declared and initialised with the value 10*5.

Question 6.
Boolean data type is used to store True / False in C++. Is it true? Is there any data type Called Boolean in C++?
No there is no data type for storing boolean value true / false.
But in C++ non -zero (either negative or positive) is treated as true and zero is treated as false.

Question 7.
Consider the following
n=-15;
if (n)
cout<<“Hello”;
else
cout<<“hai”;
What will be the output of the above code?
The Output is Hello, because n = – 15 a non zero number and it is treated as true hence the result.

Question 8.
Is it possible to declare a variable in between the program as and when the need arise.? Then what is it?
Yes it is possible to declare a variable in between the program as and when the need arise. It is known as dynamic initialisation.
Eg. int x=10,y=20;
…………..;
…………
int z=x*y

Question 9.
char ch;
cout<<“Enter a character”; cin>>ch;
Consider the above code, a user gives 9 to the variable ‘ch’. Is there any problem? Is it valid?
There is no problem and it is valid since 9 is a character. Any symbol from the key board is treated as a character.

Question 10.
“With the same size we can change the sign and range of data”. Comment on this statement.
With the help of type modifiers we can change the sign and range of data with same size. The important modifiers are signed, unsigned, long and short.

Question 11.
Write short notes about C++ short hands?
x=x + 10 can be represented as x+=10, It is called short hands in C++. It is faster.
This is used with all the arithmetic operators as follows.

Question 12.
What is the role of ‘const’ modifier? ‘
This ‘const’ key word is used to declare a constant, Eg. const int bp=100;
By this the variable bp is treated as constant and cannot be possible to change its value during execution.

Question 13.
Specify the most appropriate data type for handling the following data.
i) Rollno. of a student.
ii) Name of an employee.
iii) Price of an article.
iv) Marks of 12 subjects
i) short Rollno;
ii) char name[20];
iii) float price;
iv) short marks[12j;

Question 14.
Write C++ statement for the following.
a) The result obtained when 5 is divided by 2.
b) The. remainder obtained when 5 is divided by 2.
a) 5/2
b) 5%2

Question 15.
Predict the output.justify
int k = 5,
b = 0;
b = k++ + ++k;
cout<<b;
Output is 12. In this statement first it take the value of k in 5 then increment it K++. So first operand for + is 5. Then it becomes 6. Then ++k makes it 7. This is the second operand. Hence the result is 12.

Question 16.
Predict the output.
a) int sum = 10, ctr = 5;
sum = sum + ctr –;
pout<< sum;
b) int sum = 10, ctr = 5;
sum = sum + ++ctr; cout<<sum;
a)15
b) 16

Question 17.
Predict the output.
int a; .
float b; .
a = 5;
cout << sizeof(a + b/2);
Output is 4. Result will be the memory size of floating point number

Question 18.
Predict the output.
int a, b, c;
a = 5; b = 2;
c = a/b;
cout<<c; Answer: Output is 2. Both operands are integers. So the result will be an integer.

Question 19.
The multiple use of input or output operators in a single statement is called cascading of i/o operators.
Eg: To fake three numbers by using one statement is as follows cin>>x>>y>>z;
To print three numbers by using one statement is
as follows
cout<<x<<y<<z;

Question 20.
Trace out and correct the errors in the following code fragments
i) cout<<“Mark=”45;
ii) cin <<“Hellow World!”; iii) cout>>”X + Y;
iv) Cout<<‘Good'<<‘Moming’
i) cout<<“Mark=45”;
ii) cout <<“Hellow World!”;
iii) cout< iv) Cout<<“Good Morning”;

Question 21.
Raju wants to add value 1 to the variable ‘p’ and store the new value in ‘p’ itself. Write four different statements in C++ to do the task.
1) P=P+1; 2) p++;(post increment) 3) ++p; (pre increment) 4) p+=1; (short hand in C++)

Question 22.
Read the following code: charstr[30]; cin>>str;
cout<<str; . If we give the input “Green Computing”, we get the . output “Green”. Why is it so? How can you correct that?
The input statement cin>> cannot read the space. It reads the text up to the space, i.e. the delimiter is space. To read the text up to the enter key gets( ) or getline( ) is used

Question 23.
Match the following :

Question 24.
Write a C++ expression to calculate the value of the following equation.
$$x=\frac{-b+\sqrt{b^{2}-4 a c}}{2 a}$$

Question 25.
A student wants to insert his name and school address in the C++ program that he has written. But this should not affect the compilation or execution of the program. How is it possible? Give an example.
He can use comments to write this information. In C++ comments are used to write information such as programmer’s name, address, objective of the codes etc. in between the actual codes. This is not the part of the programme.
There are two types of comments.
i) Single line (//) and ii) Multi line (/* and */)
i) Single line (//) : Comment is used to make a single line as a comment. It starts with //.
Eg : //programme starts here.
ii) Multi line (/* and */): To make multiple lines as a comment. It starts with /* and ends with */.
Eg : !* this programme is used to find sum of two numbers.*/

Question 26.
Consider the following C++ statements :
char word (20]
cin>>word;
coUt<<word; gets(word); puts(word); If the string entered is “HAPPY NEW YEAR”, predict the output and justify your answer.
cin>>word;
cout<<word;
It displays “HAPPY” because cin takes characters upto the space. That is space is the delimiter for cin. The string after space is truncated. To resolve this use gets ( ) function. Because gets ( ) function reads character upto the enter key.
Hence gets (word);
puts (word);
Displays “HAPPY NEW YEAR”

Question 27.
Write the difference between x = 5 and x ==5 in C++.
x = 5 means the value 5 of the RHs is assigned to the LHS variable x . Here = is the assignment operator. But x ==5, ==this is the relational (comparison) operator. Here it checks whether the value of RHS is equal to the value of LHS and this expression returns a boolean value as a result. It is the equality operation.

Question 28.
a) What is the output of the following program?
# include
void main ( )
{
int a;
a = 5+3*5;
cout << a;
}
b) How do 9, ‘9’ and “9” differ in C++ program?
Here multiplication operation has more priority than addition.
hence a = 5 + 15 = 20
b) Here
9 is an interger
‘9’ is an character
“9” is a string

Question 29.
Read the following C++ program and predict the output by explaining the operations performed.
#include
void main ( )
{
int a=5, b=3;
cout<<a++ /–b;
cout<<a/ (float) b; . . }
Here a = 5 and b = 3 a++ / – – b = 5/2 = 2 That is a++ uses the value 5 and next it changes its value to 6 So a/(float) b = 6/(float)2 = 6/2.0 = 3 So the output, is 2 and 3

Question 30.
What is preprocessor directive statement? Explain. with an example.
A C++ program starts with the pre processor directive i.e., # include, #define, #undef, etc, are such a pre processor directives. By using #include we can link the header files that are needed to use the functions. By using #define we can define some constants.
Eg. #define x 100. Here the value of x becomes 100 and cannot be changed in the program. No semicolon is needed.

Question 31.
The following C++ code segment is a part of a program written by Smitha to find the average of 3 numbers. int a, b, c; float avg; cin>>a>>b>>c;
avg=(a+b+c)/3; ‘
cout<<avg; , What will be the output if she inputs 1, 4 and 5? How can you correct it?
=(1 +4+5)/3 =10/3 =3.3333 Instead of this 3.3333 the output will be 3. This is because if both operands are integers an integer division will be occurred, that is the fractional part will be truncated. To get the correct out put do as follows
case 1: int a,b,c; is replaced by float a,b,c;
OR
case 2: Replace (a+b+c)/3 by (a+b+c)/3.0;
OR
case 3:Type casting. Replace avg=(a+b+c)/3; by avg=(float)(a+b+c)/3;

### Plus One Computer Application Data Types and Operators 3 Marks Questions and Answers

Question 1.
In a panchayath or municipality all the houses have a house number, house name and members. Similar situation is in the case of memory.Explain Answer: The named memory locations are called variable. A variable has three important things 1) variable name : A variable should have a name 2) Memory address : Each and every byte of memory has an address, it is also called location (L) value 3) Content: The value stored in a variable is called content. It is also called Read(R) value.

Question 2.
Briefly explain constants
A constant or a literal is a data item its value doe not change during execution. The keyword const is used to declare a constant. Its declaration is as follows , const data type variable name=value; eg.const int bp=100; const float pi=3.14157; const char ch=’a’; const ehar[]=”Alvis”; .
1) Integer literals : Whole numbers withbut fractional parts are known as integer literals, its value does not change during execution. There are 3 types decimal, octal and hexadecimal. Eg. For decimal 100,150,etc For octal 0100,0240, etc For hexadecimal 0x100, 0x1 A,etc
2) Float literals : A number with fractional parts and its value does not change during execution is called floating point literals. Eg. 3.14157,79.78, etc
3) Character literal: A valid C++ character enclosed in single quotes, its value does not change during execution. Eg. ‘m’, ‘f’, etc
4) String literal One or more characters enclosed in double quotes is called string constant. A string is automatically appended by a null character(‘\0’) . Eg. “Mary’s”,”India”,etc

Question 3.
Consider the following statements int a=10,x=20; float b=49000.34,y=56.78; i) a=b; ii) y=x; Is there any problem for the above statements? What do you mean by type compatibility?
Assignment operator is used to assign the value of RHS to LHS. Following are the two chances

1) The size of RHS is less than LHS. So there is no problem and RHS data type is promoted to LHS. Here it is compatible.
2) The size of RHS is higher than LHS. Here comes the problem sometimes LHS cannot possible to assign RHS. There may be a chance of wrong answer. Here it is not compatible.
Here
i) a=b; There is an error since the size of . LHS is 2 but the size of RHS is 4.
ii) y=x; There is no problem because the size of LHS is 4 and RHS is 2.

Question 4.
A company has decided to give incentives to their salesman as per the sales. The criteria is given below. If the total sales exceeds 10,000 the incentive is 10% .
i) If the total sales >=5,000 and total sales <10,000, the incentive is 6 % ii) If the total sales >=1,000 and total sales <5,000, the incentive is 3 %
Write a C++ program to solve the above prob-lem and print the incentive after accepting the total sales of a salesman. The program code should not make use of ‘if statement. )
#include
using namespace std;
int main( )
{
float sales,incentive;
cout<<“enter the sales”; cin>>sales;
incentive=(sales>10000 ? salesMO: (sales > =5000 ? sales * .06 : (sales >= 1000 ? sales * .03: 0)>>;
cout<<“\nThe incentive is ” << incentive;
}

Question 5.
A C++ program code is given below to find the value of X using the expression
$$x=\frac{a^{2}+b^{2}}{2 a}$$
where a and b are variables
#include
using namespace std;
intmain( )
{
int a;b;
float x ’
cout<<“Enter the values of a and b; cin>a>b;
x=a*a+b*b/2*a;
cout>>x;
}

Predict the type of errors during compilation, execution and verification of the output. Also write the output of two sets of input values
i) a=4 b=8
ii) a=0 b=2
This program contains sortie errors and the correct program is as follows.
#include
using namespace std;
int main( )
{
int a,b; . . .
float x;
cout<<“Enter the values of a and b”; cin>>a>>b;
x=(a*a+b*b)/(2*a);
cout<<x;
}
The output is as follows
i) a=4 and b= 8 then the output is 10
a=0 and b= 2 then the output is an error divide by zero error(run time error)

Question 6.
A list of data items are given below
45,8.432, M, 0.124,8 , 0, 8.1X 1031, 1010, a, 0.00025, 9.2 X1012O, 0471 ,-846, 342.123E03
a) Categorise the given data under proper headings of fundamental data types in C++
b) Explain the specific features of each data type. Also mention any other fundamental data type for which sample data is not given.

b) i) int data type:- It is used to store whole numbers without fractional (decimal point) part. It can be either negative or positive. It consumes 4 bytes (32 bits) of memory.i.e.- 232 . numbers. That is 231 negative numbers and 231 positive numbers (0 is considered as +ve ) So a total of 232 numbers. We can store a number in between -231 to + 231-1.

ii) char data type :- Any symbol from the key board, eg. ‘A’ , ‘?’, ‘9’, It consumes one byte( 8 bits) of memory. It is internally treated as integers, i.e. 28 = 256 characters. Each character is having a ASCII code, ‘a’ is having ASCII code 97 and zero is having ASCII code 48.

iii) float data type:- It is used to store real numbers i.e. the numbers with decimal point. It uses 4 bytes(32 bits) of memory. Eg. 67.89, 89.9 E-15.

iv) double data type:- It is used to store very large real numbers. It uses 8 bytes(64 bits) of memory.

v) void data type :- void means nothing. It is used to represent a function returns nothing.

Question 7.
Write valid reasons after reading the following statements in C++ arid comment on their correctness by give reasons.
i) char num=66;
char num =’B’;
ii) 35 and 35L are different
iii) The number 14,016 and OxE are one and the same
iv) Char data type is often said to be an integer type.
v) To store the value 4.15 float data type is preferred over double
i) The ASCII number of B is 66. So it is equivalent.
ii) 35 is of integer type but 35L is Long
iii) The decimal number 14 is represented in octal is 016 and in hexadecimal is OxE.
iv) Internally char data type stores ASCII numbers.
v) To store the value 4.15 float data type is better because float requires only 4 bytes while double needs 8 bytes hence we can save the memory.

Question 8.
Suggest most suitable derived data types in C++ for storing the following data items or statements :
rived data type
i) Age of 50 students in a class
ii) Address of a memory variable’
iii) A set of instructions to find out the factorial of a number
iv) An alternate name of a previously defined variable
v) Price of 100 products in a consumer store
vi) Name of a student
i) Integer array of size 50
ii) Pointer variable
iii) Function
iv) Reference
v) Float array of size 100
vi) Character array

Question 9.
Considering the following C++ statements.
Fill up the blanks
i) If p=5 and q=3 then q%p is
ii) If E1 is true and E2 is False then E1 && E2 will be
iii) If k=8, ++k <= 8 will be = ______.
iv) If x=2 then (10* ++x) % 7 will be ______.
v) If t=8 and m=(n=3,t-n), the value of m will be ______.
vi) If i=12 the value i after execution of the expression i+=i– + –i will be _____.
i) 3
ii) False
iii) False(++k makes k=9. So 9<=8 is false) ‘
iv) 2(++x becomes 3 ,so 10 * 3 =30%7 =2)
v) 5( here m=(n=3,8-3)=(n=3,5), so m=5, The maximum value will take)
vi) Herei=12
i + = i– + -i
here post decrement has more priority than pre decrement. .
So i– will be evaluated first. Here first uses the value then change so it uses the value 12 and i becomes 11
i + =12 + –i
now i =11.
Here the value of i will be changed and used so i~ becomes 10.
i — = 12 + 10
= 22
So i =22+10
i =32
So the result is 32.

Question 10.
The Maths teacher gives the following problem to Riya and Raju.
X=5 + 3*6. Riya got x=48 and Raju got x=23. Who is right and why it is happened ? Write down the operator precedence in detail?
Here the answer is x=23. It is because of precedence of operators. The order of precedence of operators are given below.

Here multiplication has more priority than addition.

Question 11.
b) Explain the data types in C++
Fundamental data types: It is also called built in data type. They are int, char, float, double and void
i) int data type: It is-used to store whole numbers without fractional (decimal point) part. It can be either negative or positive. It consumes 4 bytes (32 bits) of memory.i.e. 232 numbers. That is 231 negative numbers and 231 positive numbers (0 is considered as +ve) So a total of 2 numbers. We can store a number in between -231 to + 2311.

ii) char data type: Any symbol from the key board,
eg. ‘A’,’?’, ‘9’ It consumes one byte(8 bits) of memory. If is internally treated as integers, i.e. 28 = 256 characters. Each character is having a ASCII code, ‘a’ is having ASCII code 97 and zero is having ASCII code,48.

iii) float data type: It is used to store real numbers i.e. the numbers with decimal point. It uses 4 bytes(32 bits) of memory. Eg. 67.89, 89.9 E-15.

iv) double data type: It is used to store very large real numbers. It uses 8 bytes(64 bits) of memory.

v) void data type: void means nothing. It is used to represent a function returns nothing.
User defined Data types : C++ allows programmers to define their own data type. They are Structure(struct), enumeration (enum), union, class, etc.
Derived data types : The data types derived from fundamental data types are called Derived data types. They are Arrays, pointers, functions, etc

Question 12.
Predict the output of the following C++ statements:
int a = -5, b = 3, c = 4;
C+ = a+++ — b; .
cout<<a<<b<<c;
a = -4, b = 2 and c = 1

Question 13.
Match the following

1. (vi) *
2. (v) &&
3. (ii) >=
4. (iii) >>
5. (i) ++
6. (iv) ?:

Question 14.
Write any five unary operators of C++. Why are they called so?
A unary operator is an operator that need only one operand to perform the operation. The five unary operators of C++ are given below.
Unary +, Unary -, ++, – – and ! (not)

Question 15.
Write C++ examples for the following:
a) Declaration statement
b) Assignment statement
c) Type casting
a) int age;
b) age= 16;
c) avg=(float)a+b+c/3;

### Plus One Computer Application Data Types and Operators 5 Marks Questions and Answers

Question 1.

Consider the above data, we know that there are different types of data are used in the computer. Explain different data types used in C++.
i) int data type: It is used to store whole numbers without fractional (decimal point) part. It can be either negative or positive. It consumes 4 bytes (32 bits) of memory.i.e. 232 numbers. That is 231 negative numbers and 231 positive numbers (0 is considered as +ve) So a total of 232 numbers. We can store a number in between -231 to + 2311.

ii) char data type: Any symbol from the key board,
eg; ’A’.,’?’, ‘9’,…. It consumes one byte( 8 bits) of memory. It is internally treated as integers, i.e. 28 = 256 characters. Each character is having a ASCII code, ‘a’ is having ASCII code 97 and zero is having ASCII code 48.

iii) float data type: It is used to store real numbers i.e. the numbers with decimal point. It uses 4 bytes(32 bit?) of memory.
Eg. 67.89,89.9 E-15.

iv) double data type: It is used to store very large real numbers. It uses 8 bytes(64 bits) of memory.

v) void data type : void means nothing. It is used to represent a function returns nothing.

Question 2.
Define an operator and explain operator in detail.
An operator is a symbol that performs an operation. The data on which operations are carried out are called operands. Following are the operators
1) lnput(>>) and output(<<) operators are used to perform input and output operation. Eg. cin>>n;
cout<<n;
2) Arithmetic operators: It is a binary operator. It is used to perform addition(+), subtractionf-), division (/), multiplication (*) and modulus (%- gives the remainder) operations.
Eg. If x=10 and y=3 then

x/y = 3, because both operands are integer, “to get the floating point result one of the operand must be float.
3) Relational operator: It is also a binary opera- tor. It is used to perform comparison or relational operation between two values and it gives either true(1) px false(O). The operators are <,<=,>,>=,== (equallty)and !=(not equal to)
Eg. If x-10 and y=3 then

4) Logical operators : Here AND(&&), OR(||) are binary operators and NOT(!) is a unary operator. It is used to combine relational operation? and it gives either true(1) or false(O).
If x=True and y=False then

Both operands must be true to get a true value in the case of AND(&&) operation If x=True and y=False then

Either one of the operands must be true to get a true value in the case of OR(||) operation If x=True and y=False then

5) Conditional operator: It is a ternary operator hence it needs three operands. The operator is?:. Syntax: expression ? value if true : value if false. First evaluates the expression if it is true the second part wilt be executed otherwise the third part will be executed.
Eg. If x=10 and y=3 then x>y ? cout< Here the output is 10.

6) sizeof( ): This operator is used to find the size used by each data type.
Eg. sizeof(int) gives 2.

7) Increment and decrement operator:  These are unary operators.

a) Increment operator (++): It is used to increment the value of a variable by one i.e., x++ is equivalent to x=x+1;
b) Decrement operator (–) : It is used to decrement the value of a variable by one i.e., x-is equivalent to x = x-1.

8) Assignment operator (=) : lt is used to assign the value of a right side to the left side variable.eg. x=5; Here the value 5 is assigned, to the variable x.