Kerala Plus One Computer Science Chapter 6 Data Types and Operators Questions and Answers

Solutions for Class 11 Computer Science: Chapter 06 Data Types and Operators

Access comprehensive textbook solutions for Chapter 06 Data Types and Operators using the official curriculum guides for Class 11 Computer Science. Designed to align with the 2026-27 Kerala Board standards, these detailed answers help students reinforce core academic concepts.

Practice Class 11 Computer Science Solutions: Chapter 06 Data Types and Operators

Access the complete solution PDF for Class 11 Computer Science below. Regular practice with these targeted textbook answers builds familiarity with standard question patterns and helps secure higher marks in final school evaluations.

One Mark Questions and Answers

Question 1: ___________ is the main activity carried out in computers.

Answer:

Data processing

Exam Tips:

a) Computers take in data, process it and give information; "processing" is the key word.

 

Question 2: The data used in computers are of different kinds. To differentiate the nature and size of data, ___________ is used.

Answer:

Data types

Exam Tips:

a) A data type tells the compiler what kind of value a variable holds and how much memory it needs.

 

Question 3: Classify the following data types:
int, array, function, char, pointer, void, float, double, structure

Answer:

Fundamental data typesDerived data types
intarray
floatfunction
doublepointer
voidstructure
char

Exam Tips:

a) The five fundamental (built-in) types are int, char, float, double and void; everything else in this list is built from them.
b) Present the answer as two columns so each type is clearly placed.

 

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

Answer:

c) int

Exam Tips:

a) Age is a whole number with no fractional part, so int is the right choice.

 

Question 5: Integer data type uses ________ bytes of memory.
a) 5
b) 2
c) 3
d) 4

Answer:

d) 4

Exam Tips:

a) Remember the sizes together: char 1, int 4, float 4, double 8 bytes.

 

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

Answer:

a) 1

Exam Tips:

a) One byte (8 bits) can hold \(2^8 = 256\) different characters.

 

Question 7: Which of the following data types uses 4 bytes of memory?
a) float
b) short
c) char
d) double

Answer:

a) float

Exam Tips:

a) short uses 2 bytes, char 1 byte and double 8 bytes, so only float fits.

 

Question 8: The full form of ASCII is ___________.

Answer:

American Standard Code for Information Interchange

Exam Tips:

a) Write all five words correctly; a partly correct expansion may not get the mark.

 

Question 9: Ramu wants to store the value of π. Which of the following is the correct declaration?
a) char pi = 3.14157
b) int pi = 3.14157
c) float pi = 3.14157
d) long pi = 3.14157

Answer:

c) float pi = 3.14157

Exam Tips:

a) A value with a decimal point needs float (or double); int and long would drop the fractional part.

 

Question 10: Which of the following is not true about naming a variable?
a) Starting letter must be an alphabet
b) It can contain digits
c) It cannot be a keyword
d) Special characters can be used

Answer:

d) Special characters can be used

Exam Tips:

a) The only special character allowed in an identifier is the underscore (_).

 

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

Answer:

c) age

Exam Tips:

a) 9a starts with a digit, float is a keyword and "date of birth" has spaces, so all three are invalid.

 

Question 12: How many operands are needed to perform a unary operation?
a) 2
b) 3
c) 1
d) None of these

Answer:

c) 1 (unary means one)

Exam Tips:

a) Link the prefix to the number: unary = 1, binary = 2, ternary = 3 operands.

 

Question 13: How many operands are needed to perform a binary operation?
a) 2
b) 3
c) 1
d) None of these

Answer:

a) 2 (binary means two)

Exam Tips:

a) Arithmetic operators like +, -, *, / and % are all binary operators.

 

Question 14: How many operands are needed to perform a ternary operation?
a) 2
b) 3
c) 1
d) None of these

Answer:

b) 3 (ternary means three)

Exam Tips:

a) The conditional operator (?:) is the only ternary operator in C++.

 

Question 15: In C++, 13 % 26 = ?
a) 26
b) 13
c) 0
d) None of these

Answer:

b) 13
% is the modulus operator; it gives the remainder. 13 divided by 26 gives quotient 0 and remainder 13.

Exam Tips:

a) When the first number is smaller than the second, the remainder is the first number itself.

 

Question 16: In C++, 41/2 = ?
a) 20.5
b) 20
c) 1
d) None of these

Answer:

b) 20
The actual result is 20.5, but both 41 and 2 are integers, so the fractional part .5 is truncated.

Exam Tips:

a) Integer divided by integer always gives an integer in C++; check the operand types before answering.

 

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

Answer:

a) Unary

Exam Tips:

a) ++ works on a single variable (x++ or ++x), so it is unary.

 

Question 18: The conditional operator is a _________ operator.
a) Unary
b) Binary
c) Ternary
d) None of these

Answer:

c) Ternary

Exam Tips:

a) It needs three operands: condition ? value if true : value if false.

 

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

Answer:

b) Binary

Exam Tips:

a) % needs two integer operands, e.g. 7 % 2 = 1.

 

Question 20: State True or False.
1. Multiplication, division and modulus have equal priority.
2. Logical AND (&&) has less priority than logical OR (||).

Answer:

1. True
2. False

Exam Tips:

a) Logical AND (&&) has higher priority than logical OR (||); this is a common trap.

 

Question 21: _______ is composed of operators and operands.
a) Expression
b) Keywords
c) Identifier
d) Punctuators

Answer:

a) Expression

Exam Tips:

a) Example: in a + b, a and b are operands, + is the operator, and the whole is an expression.

 

Question 22: Supplying a value to a variable at the time of declaration is known as __________.

Answer:

Initialisation

Exam Tips:

a) Give an example if space allows: int k = 100;

 

Question 23: Which of the following is initialisation?
a) int k;
b) int k = 100;
c) int k[10];
d) None of these

Answer:

b) int k = 100;

Exam Tips:

a) Only option (b) gives a value along with the declaration; (a) and (c) are just declarations.

 

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

Answer:

True

Exam Tips:

a) This automatic conversion is called type promotion or implicit type conversion.

 

Question 25: Classify the following as arithmetic or logical expressions.
a) x + y * z
b) x < y && y > z
c) x / y
d) x > 89 || y < 80

Answer:

Arithmetic expressions: (a) and (c)
Logical expressions: (b) and (d)

Exam Tips:

a) An expression joined by && or || is logical; one using +, -, *, /, % only is arithmetic.

 

Question 26: Suppose x = 5 and y = 2. What will be the output of cout<<(float)x/y;

Answer:

2.5
The integer x is converted to float, so the division is done as floating-point division.

Exam Tips:

a) Without the (float) cast the answer would be 2; mention why the cast changes the result.

 

Question 27: Consider the following.
a = 10;
a *= 10;
Then a = ?
a) a = 100
b) a = 50
c) a = 10
d) a = 20

Answer:

a) a = 100
This short hand means a = a * 10.

Exam Tips:

a) Expand the short hand first (a = a * 10), then calculate.

 

Question 28: Consider the following.
a = 10;
a += 10;
Then a = ?
a) a = 30
b) a = 50
c) a = 10
d) a = 20

Answer:

d) a = 20
This short hand means a = a + 10.

Exam Tips:

a) In short hands the operator comes before = with no space: +=, -=, *=, /=, %=.

 

Question 29: Pick the odd one out.
a) structure
b) array
c) pointer
d) int

Answer:

d) int
int is a fundamental data type; the others are derived (or user-defined) data types.

Exam Tips:

a) In odd-one-out questions, always state the reason along with the answer.

 

Question 30: Which of the following is not a character of the C++ language?
a) A
b) 9
c) \
d) @

Answer:

d) @

Exam Tips:

a) Letters, digits and symbols such as \ are part of the C++ character set; learn the list of special characters given in the textbook.

 

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

Answer:

b) type casting (explicit conversion)

Exam Tips:

a) Conversion written by the programmer using (type) is explicit (type casting); conversion done automatically by the compiler is implicit (type promotion).

 

Question 32: Identify the error in the following C++ statement and correct it.
short population = 68000;

Answer:

The largest value a short variable can hold is 32767. 68000 is larger than this, so it cannot be stored in a short variable.
Correct statement: long population = 68000;

Exam Tips:

a) Remember the range of short: -32768 to 32767.
b) Write the corrected statement, not just the reason; both are needed for full marks.

 

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.

Answer:

Conditional operator (?:)
Example: (mark>=18) ? cout<<"Passed" : cout<<"Failed";

Exam Tips:

a) The conditional operator is a short replacement for a simple if...else statement.

 

Two Mark Questions and Answers

Question 34: Analyse the following statements and write True or False. Justify.
1. There is an operator in C++ having no special character in it.
2. An operator cannot have more than 2 operands.
3. Comma operator has the lowest precedence.
4. All logical operators are binary in nature.
5. It is not possible to assign the constant 5 to 10 different variables using a single C++ expression.
6. In type promotion, the operands with lower data type will be converted to the highest data type in the expression.

Answer:

1. True (sizeof operator)
2. False (the conditional operator has 3 operands)
3. True
4. False (the NOT operator ! is unary)
5. False (multiple assignment is possible), e.g. a = b = c = 5;
6. True

Exam Tips:

a) The question says "Justify", so give a reason or example for each False statement.
b) sizeof is the only C++ operator made of letters instead of symbols.

 

Question 35: Consider the following declaration.
const int bp;
bp = 100;
Is it valid? Explain.

Answer:

It is not valid. A constant must be initialised when it is declared, and its value cannot be changed later. So bp = 100; is an error.
The correct declaration is:
const int bp = 100;

Exam Tips:

a) Mention both errors: the constant is not initialised, and a constant cannot be assigned later.
b) Always end with the corrected statement.

 

Question 36: Consider the following statements in C++.
1. cout<<41/2;
2. cout<<41/2.0;
Do these two statements give the same result? Explain.

Answer:

No, they give different results.
1. 41/2 gives 20, not 20.5. Both 41 and 2 are integers, so integer division is done and the fractional part is truncated.
2. 41/2.0 gives 20.5. Here 2.0 is a floating-point number, so 41 is promoted to float and the result is 20.5.

Exam Tips:

a) If at least one operand is a float, the result is a float.
b) Write the output of each statement separately with its reason.

 

Question 37: If mark = 70, what will be the value of the variable result in the following?
result = mark > 50 ? 'P' : 'F';

Answer:

The syntax of the conditional operator is:
condition ? value if true : value if false;
Here the condition 70 > 50 is true, so 'P' is assigned to result.
So result = 'P'

Exam Tips:

a) Write the syntax of ?: first; it earns part of the marks.
b) Substitute the value of mark and show whether the condition is true or false.

 

Question 38: Is it possible to initialise a variable at the time of execution? What kind of initialisation is this? Give an example.

Answer:

Yes, it is possible. This is called dynamic initialisation.
Example: int a = 10, b = 5;
int c = a * b;
Here c is declared and initialised with the value of a * b (that is, 50), which is calculated during execution.

Exam Tips:

a) In dynamic initialisation the variable is given the value of an expression worked out at run time.
b) Use an example where the initial value is an expression, not a constant.

 

Question 39: Boolean data type is used to store True/False in C++. Is it true? Is there any data type called Boolean in C++?

Answer:

There is no data type named "Boolean" among the five fundamental data types studied (int, char, float, double and void). In C++, any non-zero value (negative or positive) is treated as true and zero is treated as false.
Standard C++ does provide the type bool, which can hold the values true and false (stored as 1 and 0).

Exam Tips:

a) Key point to write: non-zero = true, zero = false.
b) Relational and logical expressions give 1 for true and 0 for false.

 

Question 40: Consider the following.
n = -15;
if (n)
cout<<"Hello";
else
cout<<"hai";
What will be the output of the above code?

Answer:

The output is Hello.
n = -15 is a non-zero number, so it is treated as true and the if part is executed.

Exam Tips:

a) A negative number is also non-zero, so it counts as true; only 0 is false.

 

Question 41: Is it possible to declare a variable in between the program as and when the need arises? What is it called?

Answer:

Yes, in C++ a variable can be declared anywhere in the program when it is needed. When such a variable is given a value calculated at run time, it is called dynamic initialisation.
Example: int x = 10, y = 20;
int z = x * y;

Exam Tips:

a) Give an example where the new variable gets its value from other variables.

 

Question 42: Consider the following code.
char ch;
cout<<"Enter a character";
cin>>ch;
A user gives 9 as the value of ch. Is there any problem? Is it valid?

Answer:

There is no problem; it is valid. 9 is accepted as the character '9'. Any symbol from the keyboard is treated as a character.

Exam Tips:

a) The character '9' is stored as its ASCII code 57, not as the number 9.

 

Question 43: "With the same size we can change the sign and range of data." Comment on this statement.

Answer:

This is done with the help of type modifiers. They change the sign and range of data while keeping the same size. The important type modifiers are signed, unsigned, long and short.
Example: signed short ranges from -32768 to 32767, while unsigned short (same 2 bytes) ranges from 0 to 65535.

Exam Tips:

a) Name all four modifiers: signed, unsigned, long, short.
b) A signed/unsigned example shows clearly that the range changes while the size stays the same.

 

Question 44: Write short notes on C++ short hands.

Answer:

x = x + 10 can be written as x += 10. This is called a short hand (arithmetic assignment) in C++. It is shorter and faster. It can be used with all arithmetic operators as follows.

Arithmetic Assignment ExpressionEquivalent Arithmetic Expression
x += 10x = x + 10
x -= 10x = x - 10
x *= 10x = x * 10
x /= 10x = x / 10
x %= 10x = x % 10

Exam Tips:

a) Write the short hand without a space between the operator and = (+=, not + =).
b) A small two-column table like this is the quickest way to show all five.

 

Question 45: What is the role of the 'const' modifier?

Answer:

The keyword const is used to declare a constant.
Example: const int bp = 100;
Now bp is treated as a constant and its value cannot be changed during execution.

Exam Tips:

a) Point out that a const variable must be given its value at declaration.

 

Question 46: Specify the most appropriate data type for handling the following data.
1. Roll number of a student
2. Name of an employee
3. Price of an article
4. Marks of 12 subjects

Answer:

1. short roll_no;
2. char name[20];
3. float price;
4. short marks[12];

Exam Tips:

a) Use valid variable names in declarations (no spaces); use an underscore instead.
b) A name is a group of characters, so it needs a character array, not a single char.

 

Question 47: Write C++ expressions for the following.
1. The result obtained when 5 is divided by 2.
2. The remainder obtained when 5 is divided by 2.

Answer:

1. 5 / 2 (gives 2)
2. 5 % 2 (gives 1)

Exam Tips:

a) / gives the quotient and % gives the remainder; do not mix them up.

 

Question 48: Predict the output of the following code. Justify.
int k = 5, b;
b = 0;
b = k++ + ++k;
cout<<b;

Answer:

Output is 12.
k++ first uses the value of k, which is 5, and then increases k to 6. So the first operand of + is 5.
Then ++k increases k to 7 and uses 7. This is the second operand.
So b = 5 + 7 = 12.

Exam Tips:

a) Post-increment (k++): use first, then change. Pre-increment (++k): change first, then use.
b) Track the value of k after each step to avoid mistakes.

 

Question 49: Predict the output.
1. int sum = 10, ctr = 5;
sum = sum + ctr--;
cout<<sum;
2. int sum = 10, ctr = 5;
sum = sum + ++ctr;
cout<<sum;

Answer:

1. 15 (ctr-- uses 5 and then becomes 4)
2. 16 (++ctr becomes 6 and then 6 is used)

Exam Tips:

a) Write a short reason for each output; it shows you understood pre and post operators.

 

Question 50: Predict the output.
int a;
float b;
a = 5;
cout<<sizeof(a + b/2);

Answer:

Output is 4.
The expression a + b/2 has a float operand, so the result is of float type. sizeof gives the size of float, which is 4 bytes.

Exam Tips:

a) sizeof depends on the type of the expression, not its value; find the result type by type promotion first.

 

Question 51: 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 integer division is done and the result is an integer (the .5 is dropped).

Exam Tips:

a) c is also an int, so even 2.5 could not be stored in it.

 

Question 52: Explain cascading of I/O operations.

Answer:

Using the input or output operator more than once in a single statement is called cascading of I/O operators.
Example: To read three numbers in one statement:
cin>>x>>y>>z;
To print three numbers in one statement:
cout<<x<<y<<z;

Exam Tips:

a) Give one example each for cin and cout.
b) Check that every operator is written as >> for cin and << for cout.

 

Question 53: Trace out and correct the errors in the following code fragments.
1. cout<<"Mark ="45;
2. cin<<"Hellow World!";
3. cout>>"X + Y;
4. Cout<<'Good,<<'Morning'

Answer:

1. cout<<"Mark = 45";
2. cout<<"Hellow World!";
3. cout<<X + Y;
4. cout<<"Good Morning";

Exam Tips:

a) C++ is case sensitive: cout must be in small letters.
b) cout uses << and cin uses >>; a string must be inside double quotes.
c) Do not forget the semicolon at the end of each corrected statement.

 

Question 54: Raju wants to add 1 to the variable p and store the new value in p itself. Write four different statements in C++ to do the task.

Answer:

1. p = p + 1;
2. p++; (post increment)
3. ++p; (pre increment)
4. p += 1; (short hand)

Exam Tips:

a) Use the same variable name in the same case (p, not P) in all four statements.

 

Question 55: Read the following code.
char str[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 it?

Answer:

cin>> stops reading at a space; the space acts as the delimiter. So only "Green" is stored.
To read the text up to the Enter key, use gets() or getline().
Example: gets(str); or cin.getline(str, 30);

Exam Tips:

a) Answer both parts: the reason (space is the delimiter) and the correction (gets() or getline()).

 

Question 56: Match the following.

NameSymbol
a) Modulus operator(i) ++
b) Logical operator(ii) ==
c) Relational operator(iii) =
d) Assignment operator(iv) ?:
e) Increment operator(v) &&
f) Conditional operator(vi) %

Answer:

NameSymbol
a) Modulus operator(vi) %
b) Logical operator(v) &&
c) Relational operator(ii) ==
d) Assignment operator(iii) =
e) Increment operator(i) ++
f) Conditional operator(iv) ?:

Exam Tips:

a) Do not confuse = (assignment) with == (relational, equal to).
b) Write the pairs with both the letter and the Roman numeral so each match is clear.

 

Question 57: Write a C++ expression to calculate the value of the following equation.
\(x = \frac{-b + \sqrt{b^2 - 4ac}}{2a}\)

Answer:

x = (-b + sqrt(b*b - 4*a*c)) / (2*a);

Exam Tips:

a) Put the whole numerator and the whole denominator in brackets; -b + sqrt(...)/2*a gives a wrong value.
b) Count opening and closing brackets before you finish.
c) sqrt() needs the header file cmath (math.h).

 

Question 58: 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.

Answer:

He can use comments. In C++, comments are used to write information such as the programmer's name, address, purpose of the code, etc. in between the actual code. Comments are not part of the program and are ignored by the compiler. There are two types of comments:
1. Single line comment (//): It makes a single line a comment. It starts with //.
Example: // program starts here
2. Multi-line comment (/* and */): It makes many lines a comment. It starts with /* and ends with */.
Example: /* this program is used to find the sum of two numbers */

Exam Tips:

a) Name both types and give one example of each.
b) Mention that the compiler ignores comments, which is why they do not affect execution.

 

Question 59: 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.

Answer:

cin>>word; cout<<word; displays "HAPPY", because cin reads characters only up to a space. The space is the delimiter for cin, so the rest of the string is not taken.
gets() reads characters up to the Enter key. So
gets(word); puts(word); displays "HAPPY NEW YEAR".

Exam Tips:

a) Give the output for each pair of statements separately with its reason.

 

Question 60: Write the difference between x = 5 and x == 5 in C++.

Answer:

x = 5: = is the assignment operator. The value 5 on the right side is stored in the variable x on the left side.
x == 5: == is the relational (equality) operator. It checks whether x is equal to 5 and gives true (1) or false (0).

Exam Tips:

a) Name both operators (assignment and relational) and say what each one does.

 

Question 61: 1. What is the output of the following program?
#include <iostream.h>
void main()
{
int a;
a = 5 + 3*5;
cout << a;
}
2. How do 9, '9' and "9" differ in a C++ program?

Answer:

1. Multiplication has higher priority than addition.
So a = 5 + 15 = 20. The output is 20.
2. 9 is an integer, '9' is a character and "9" is a string.

Exam Tips:

a) Single quotes mean a character; double quotes mean a string (which also ends with '\0').
b) Show the step 3*5 = 15 before adding.

 

Question 62: Read the following C++ program and predict the output by explaining the operations performed.
#include<iostream.h>
void main()
{
int a = 5, b = 3;
cout<<a++ / --b;
cout<<a / (float) b;
}

Answer:

Here a = 5 and b = 3.
a++ / --b: --b makes b = 2 and a++ uses 5, so 5/2 = 2 (integer division). After this, a becomes 6.
a / (float) b = 6 / 2.0 = 3
So the output is 2 and 3 (printed together as 23).

Exam Tips:

a) Note the changed values of a and b after the first statement before working out the second.
b) Mention that no space is printed between the two outputs.

 

Question 63: What is a preprocessor directive statement? Explain with an example.

Answer:

A C++ program usually starts with preprocessor directives such as #include, #define and #undef. They are processed before compilation.
#include is used to link the header files needed to use library functions.
#define is used to define constants.
Example: #define x 100
Here x is replaced by 100 and cannot be changed in the program. No semicolon is needed at the end.

Exam Tips:

a) Preprocessor directives begin with # and do not end with a semicolon.
b) Give one example each of #include and #define.

 

Question 64: The following C++ code segment is 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?

Answer:

Expected average = (1 + 4 + 5)/3 = 10/3 = 3.3333
But the output will be 3, because both operands are integers. Integer division is done and the fractional part is truncated.
To get the correct output, do any one of the following:
1. Replace int a, b, c; by float a, b, c;
2. Replace (a + b + c)/3 by (a + b + c)/3.0
3. Use type casting: avg = (float)(a + b + c)/3;

Exam Tips:

a) Storing the result in a float variable does not help; the division itself must be done in float.
b) Any one correct method is enough, but write it as a full statement.

 

Three Mark Questions and Answers

Question 65: In a panchayath or municipality, all houses have a house number, house name and members. A similar situation exists in the case of memory. Explain.

Answer:

Named memory locations are called variables. A variable has three important things:
1. Variable name: Every variable must have a name (like the house name).
2. Memory address: Every byte of memory has an address (like the house number). It is also called the L-value (location value).
3. Content: The value stored in the variable (like the members of the house). It is also called the R-value (read value).

Exam Tips:

a) Link each part of the variable to the house example; that is what the question asks.
b) Remember L-value = address and R-value = content.

 

Question 66: Briefly explain constants.

Answer:

A constant (literal) is a data item whose value does not change during execution. The keyword const is used to declare a constant:
const data_type variable_name = value;
Examples: const int bp = 100;
const float pi = 3.14157;
const char ch = 'a';
const char name[] = "Alvis";
Types of literals:
1. Integer literals: Whole numbers without a fractional part. They can be decimal, octal or hexadecimal.
Decimal: 100, 150; Octal: 0100, 0240; Hexadecimal: 0x100, 0x1A
2. Floating point literals: Numbers with a fractional part.
Example: 3.14157, 79.78
3. Character literals: A valid C++ character enclosed in single quotes.
Example: 'm', 'f'
4. String literals: One or more characters enclosed in double quotes. A null character ('\0') is added automatically at the end.
Example: "Mary's", "India"

Exam Tips:

a) List all four types of literals with one example each.
b) Octal literals start with 0 and hexadecimal literals start with 0x.

 

Question 67: Consider the following statements.
int a = 10, x = 20;
float b = 45000.34, y = 56.78;
1. a = b;
2. y = x;
Is there any problem with the above statements? What do you mean by type compatibility?

Answer:

The assignment operator stores the value of the RHS in the LHS variable. There are two cases:
a) The RHS data type is lower than the LHS data type. The RHS value is promoted to the LHS type, so there is no problem. The types are compatible.
b) The RHS data type is higher than the LHS data type. The LHS may not be able to hold the RHS value exactly, and the result may be wrong. The types are not compatible.
So:
1. a = b; There is a problem. A float value is assigned to an int variable, so the fractional part is lost (a gets 45000 instead of 45000.34).
2. y = x; There is no problem. The int value 20 is promoted to float and y becomes 20.0.

Exam Tips:

a) State what actually happens to the value (45000.34 becomes 45000) for full marks.
b) Lower to higher type is safe; higher to lower type may lose data.

 

Question 68: A company has decided to give incentives to its salesmen according to their sales. The criteria are given below.
If the total sales exceed 10,000, the incentive is 10%.
1. If the total sales >= 5,000 and < 10,000, the incentive is 6%.
2. If the total sales >= 1,000 and < 5,000, the incentive is 3%.
Write a C++ program to print the incentive after accepting the total sales of a salesman. The program should not use the 'if' statement.

Answer:

#include<iostream>
using namespace std;
int main()
{
float sales, incentive;
cout<<"Enter the sales: ";
cin>>sales;
incentive = (sales > 10000 ? sales * 0.10 : (sales >= 5000 ? sales * 0.06 : (sales >= 1000 ? sales * 0.03 : 0)));
cout<<"\nThe incentive is " << incentive;
return 0;
}

Exam Tips:

a) Nested conditional operators (?:) replace the if...else ladder; check the brackets carefully.
b) Write percentages as decimals: 10% = 0.10, 6% = 0.06, 3% = 0.03.
c) >= must be written without a space between > and =.

 

Question 69: A C++ program is given below to find the value of x using the expression \(x = \frac{a^2 + b^2}{2a}\), where a and b are variables.
#include<iostream>
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;
}
Predict the types of errors during compilation, execution and verification of the output. Also write the output for two sets of input values:
1. a = 4, b = 8
2. a = 0, b = 2

Answer:

The program has syntax errors (int a;b; missing semicolon after float x, missing closing quote, wrong operators in cin and cout) and a logical error in the expression (missing brackets). The correct program is:
#include<iostream>
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:
1. a = 4 and b = 8: x = (16 + 64)/8 = 80/8 = 10. The output is 10.
2. a = 0 and b = 2: the denominator 2*a is 0, so there is a divide by zero error (run-time error).

Exam Tips:

a) Classify errors: syntax errors appear at compilation, divide by zero at execution (run time), and wrong formula is a logical error found while verifying output.
b) Show the working for a = 4, b = 8 rather than only the final value.
c) Remember that brackets are needed for both the numerator and the denominator.

 

Question 70: A list of data items is given below.
45, 8.432, M, 0.124, 8, 0, \(8.1 \times 10^{31}\), 1010, a, 0.00025, \(9.2 \times 10^{120}\), 0471, -846, 342.123E03
1. Categorise the given data under proper headings of fundamental data types in C++.
2. Explain the specific features of each data type. Also mention any other fundamental data type for which sample data is not given.

Answer:

1.

intfloatdoublecharvoid
458.432\(9.2 \times 10^{120}\)MNo sample data is given
80.124a
00.00025
1010342.123E03
0471\(8.1 \times 10^{31}\)
-846

2. Features of each data type:
(i) int: Stores whole numbers without a fractional part. They can be negative or positive. It uses 4 bytes (32 bits) of memory, so it can hold \(2^{32}\) numbers, from \(-2^{31}\) to \(+2^{31} - 1\).
(ii) char: Stores any symbol from the keyboard, e.g. 'A', '?', '9'. It uses 1 byte (8 bits), so \(2^8 = 256\) characters are possible. Internally a character is stored as its ASCII code; 'a' has ASCII code 97 and '0' has ASCII code 48.
(iii) float: Stores real numbers (numbers with a decimal point). It uses 4 bytes (32 bits). Example: 67.89, 89.9E-15
(iv) double: Stores very large real numbers with more precision. It uses 8 bytes (64 bits).
(v) void: void means nothing. It is used to show that a function returns nothing. No sample data is given for void.

Exam Tips:

a) Make sure every item from the list appears once in the table; a missed item loses marks.
b) \(9.2 \times 10^{120}\) is too large for float (limit about \(3.4 \times 10^{38}\)), so it goes under double.
c) 0471 is an octal integer literal, so it goes under int.

 

Question 71: Read the following statements in C++ and comment on their correctness by giving reasons.
1. char num = 66; and char num = 'B'; are equivalent
2. 35 and 35L are different
3. The numbers 14, 016 and 0xE are one and the same
4. char data type is often said to be an integer type
5. To store the value 4.15, float data type is preferred over double

Answer:

1. Correct. The ASCII code of B is 66, so both statements store the same value.
2. Correct. 35 is of int type but 35L is of long type.
3. Correct. The decimal number 14 is 016 in octal and 0xE in hexadecimal.
4. Correct. Internally, the char data type stores the ASCII code, which is an integer.
5. Correct. float needs only 4 bytes while double needs 8 bytes, so float saves memory and is enough for 4.15.

Exam Tips:

a) For conversions, check: 016 = 1 × 8 + 6 = 14 and 0xE = 14.
b) Give a reason with every comment; just "correct" earns little.

 

Question 72: Suggest the most suitable derived data types in C++ for storing the following data items or statements.
1. Age of 50 students in a class
2. Address of a memory variable
3. A set of instructions to find the factorial of a number
4. An alternate name of a previously defined variable
5. Price of 100 products in a consumer store
6. Name of a student

Answer:

1. Integer array of size 50
2. Pointer variable
3. Function
4. Reference
5. Float array of size 100
6. Character array

Exam Tips:

a) For arrays, mention both the data type and the size (e.g. int age[50]).
b) A reference is an alias (another name) for an existing variable.

 

Question 73: Consider the following C++ statements and fill in the blanks.
1. If p = 5 and q = 3, then q%p is _______
2. If E1 is true and E2 is false, then E1 && E2 will be _______
3. If k = 8, ++k <= 8 will be ________
4. If x = 2, then (10 * ++x) % 7 will be ________
5. If t = 8 and m = (n = 3, t - n), the value of m will be ______
6. If i = 12, the value of i after execution of the expression i += i-- + --i will be ______

Answer:

1. 3 (3 % 5 = 3)
2. False
3. False (++k makes k = 9, and 9 <= 8 is false)
4. 2 (++x makes x = 3, 10 * 3 = 30 and 30 % 7 = 2)
5. 5 (the comma operator gives the value of the last expression; n = 3, so t - n = 8 - 3 = 5)
6. 32
Here i = 12. i-- uses the value 12 and then i becomes 11.
--i then makes i = 10 and uses 10.
So the right side is 12 + 10 = 22.
i += 22 means i = 10 + 22 = 32.

Exam Tips:

a) In a comma expression, all parts are evaluated left to right and the last value is the result.
b) For increment/decrement questions, write the value of the variable after every step.
c) Remember: % gives the remainder, so 3 % 5 is 3, not 0.

 

Question 74: 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 did it happen? Write down the operator precedence in detail.

Answer:

Raju is right; x = 23. This is because of the precedence of operators. Multiplication has higher priority than addition, so 3 * 6 = 18 is done first and then 5 + 18 = 23. Riya added first: (5 + 3) * 6 = 48, which is wrong.
The order of precedence (highest first) is:

++ (post increment), -- (post decrement)
++ (pre increment), -- (pre decrement), sizeof, !, unary +, unary -
* (multiplication), / (division), % (modulus)
+ (addition), - (subtraction)

Exam Tips:

a) Say who is right and also show both calculations.
b) Operators in the same row have equal priority and are evaluated from left to right.

 

Question 75: Explain the data types in C++.

Answer:

Fundamental data types: These are also called built-in data types. They are int, char, float, double and void.
1. int: Stores whole numbers without a fractional part, negative or positive. It uses 4 bytes (32 bits), so it can hold \(2^{32}\) numbers, from \(-2^{31}\) to \(+2^{31} - 1\).
2. char: Stores any symbol from the keyboard, e.g. 'A', '9'. It uses 1 byte (8 bits), so \(2^8 = 256\) characters are possible. Each character has an ASCII code; 'a' has ASCII code 97 and '0' has ASCII code 48.
3. float: Stores real numbers (numbers with a decimal point). It uses 4 bytes (32 bits). Example: 67.89, 89.9E-15
4. double: Stores very large real numbers. It uses 8 bytes (64 bits).
5. void: void means nothing. It is used to show that a function returns nothing.
User-defined data types: C++ allows programmers to define their own data types, such as structure (struct), enumeration (enum), union and class.
Derived data types: Data types built from the fundamental data types are called derived data types, such as arrays, pointers and functions.

Exam Tips:

a) Group the answer under the three headings: fundamental, user-defined and derived.
b) Give the memory size of each fundamental type.
c) Write powers clearly, e.g. \(2^{31} - 1\), not 2311.

 

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

Answer:

a++ uses -5 and then a becomes -4.
--b makes b = 2 and uses 2.
c = 4 + (-5 + 2) = 4 - 3 = 1
So a = -4, b = 2 and c = 1. The output is -421 (the values are printed together).

Exam Tips:

a) Show the step-by-step working; the final printed output alone may not earn full marks.
b) Note that cout prints the three values with no space between them.

 

Question 77: Match the following.

AB
1. Arithmetic operator(i) ++
2. Logical operator(ii) >=
3. Relational operator(iii) >>
4. Input operator(iv) ?:
5. Increment operator(v) &&
6. Conditional operator(vi) *
(vii) <<

Answer:

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

Exam Tips:

a) Column B has one extra item; << is the output operator, so it is left unmatched.
b) Input uses >> (get from) and output uses << (put to).

 

Question 78: Write any five unary operators of C++. Why are they called so?

Answer:

A unary operator is an operator that needs only one operand to perform its operation.
Five unary operators of C++ are:
unary +, unary -, ++ (increment), -- (decrement) and ! (NOT)

Exam Tips:

a) Write the reason (only one operand) along with the list.
b) sizeof is also a unary operator and can be used as an alternative in the list.

 

Question 79: Write C++ examples for the following.
1. Declaration statement
2. Assignment statement
3. Type casting

Answer:

1. int age;
2. age = 16;
3. avg = (float)(a + b + c)/3;

Exam Tips:

a) In type casting, the type name is written in brackets before the value or expression.
b) Make sure your example is also logically correct, not just valid syntax.

 

Five Mark Questions and Answers

Question 80: Consider the following data.
Name: Jose
Roll no: 20
Age: 17
Weight: 45.650
We know that different types of data are used in the computer. Explain the different data types used in C++.

Answer:

1. int: Stores whole numbers without a fractional part, negative or positive (e.g. Roll no 20, Age 17). It uses 4 bytes (32 bits), so it can hold \(2^{32}\) numbers, from \(-2^{31}\) to \(+2^{31} - 1\).
2. char: Stores any symbol from the keyboard, e.g. 'A', '9'. It uses 1 byte (8 bits), so \(2^8 = 256\) characters are possible. Internally a character is stored as an integer (its ASCII code); 'a' has ASCII code 97 and '0' has ASCII code 48. A name like Jose is stored in a character array.
3. float: Stores real numbers (numbers with a decimal point), e.g. Weight 45.650. It uses 4 bytes (32 bits). Example: 67.89, 89.9E-15
4. double: Stores very large real numbers. It uses 8 bytes (64 bits).
5. void: void means nothing. It is used to show that a function returns nothing.

Exam Tips:

a) Link each data item in the question to a data type; that makes the answer stand out.
b) For each type, write what it stores, its size and an example.
c) Five data types for five marks: do not leave out void.

 

Question 81: Define an operator and explain the operators in detail.

Answer:

An operator is a symbol that performs an operation. The data on which the operation is carried out are called operands. The operators are:
1. Input (>>) and output (<<): These are used for input and output operations.
Example: cin>>n; cout<<n;
2. Arithmetic operators: These are binary operators used for addition (+), subtraction (-), multiplication (*), division (/) and modulus (%, gives the remainder).
Example: If x = 10 and y = 3, then

x+yx-yx*yx/yx%y
1373031

x/y = 3 because both operands are integers. To get a floating-point result, one of the operands must be float.
3. Relational operators: These are binary operators used to compare two values. They give either true (1) or false (0). The operators are <, <=, >, >=, == (equal to) and != (not equal to).
Example: If x = 10 and y = 3, then

x<yx<=yx>yx>=yx==yx!=y
FalseFalseTrueTrueFalseTrue

4. Logical operators: AND (&&) and OR (||) are binary operators and NOT (!) is a unary operator. They are used to combine relational expressions and give true (1) or false (0).
In AND (&&), both operands must be true to get true. If x = True and y = False, then

x && xx && yy && xy && y
TrueFalseFalseFalse

In OR (||), at least one operand must be true to get true. If x = True and y = False, then

x || xx || yy || xy || y
TrueTrueTrueFalse

NOT (!) reverses the value. If x = True and y = False, then

!x!y
FalseTrue

5. Conditional operator (?:): It is a ternary operator, so it needs three operands.
Syntax: expression ? value if true : value if false;
The expression is checked first. If it is true, the second part is executed; otherwise the third part is executed.
Example: If x = 10 and y = 3, then x>y ? cout<<x : cout<<y; prints 10.
6. sizeof(): This operator gives the memory size of a data type or variable.
Example: sizeof(int) gives 4.
7. Increment and decrement operators: These are unary operators.
a) Increment (++): increases the value of a variable by one; x++ is the same as x = x + 1;
b) Decrement (--): decreases the value of a variable by one; x-- is the same as x = x - 1;
8. Assignment operator (=): It assigns the value on the right side to the variable on the left side.
Example: x = 5; Here the value 5 is assigned to x.

Exam Tips:

a) Start with the definition of operator and operand; it is often a separate mark.
b) Give an example for every type of operator; small truth tables for logical operators earn full credit.
c) Mention whether each operator is unary, binary or ternary.
d) Keep int size consistent (4 bytes) in all answers of the same paper.

 

Free Kerala Board Textbook Explanations: Class 11 Computer Science Chapter 06 Data Types and Operators

Chapter Exercise Answers for Class 11 Computer Science

Review comprehensive exercise answers for Class 11 Computer Science Chapter 06 Data Types and Operators. Fully updated to match current Kerala Board syllabus guidelines, these textbook solutions help students verify their work and maintain accurate study notes.

Detailed Answer Guides for Chapter 06 Data Types and Operators

Each solution includes detailed reasoning to foster genuine comprehension of Chapter 06 Data Types and Operators concepts. Reviewing these step-by-step breakdowns allows learners to master both analytical and descriptive questions expected in school evaluations.

Complete Preparation Kit for Class 11 Exams

Consistent practice with these solution guides cultivates faster problem-solving habits and clearer logical structuring. For a complete preparation experience, pair these textbook answers with our dedicated revision notes and sample papers for Class 11 Computer Science.

FAQs

Where can I find the latest Kerala Plus One Computer Science Chapter 6 Data Types and Operators Questions and Answers for the 2026-27 session?

The complete and updated Kerala Plus One Computer Science Chapter 6 Data Types and Operators Questions and Answers is available for free on StudiesToday.com. These solutions for Class 11 Computer Science are as per latest Kerala Board curriculum.

Are the Computer Science Kerala Board solutions for Class 11 updated for the new 50% competency-based exam pattern?

Yes, our experts have revised the Kerala Plus One Computer Science Chapter 6 Data Types and Operators Questions and Answers as per 2026 exam pattern. All textbook exercises have been solved and have added explanation about how the Computer Science concepts are applied in case-study and assertion-reasoning questions.

How do these Class 11 Kerala Board solutions help in scoring 90% plus marks?

Toppers recommend using Kerala Board language because Kerala Board marking schemes are strictly based on textbook definitions. Our Kerala Plus One Computer Science Chapter 6 Data Types and Operators Questions and Answers will help students to get full marks in the theory paper.

Do you offer Kerala Plus One Computer Science Chapter 6 Data Types and Operators Questions and Answers in multiple languages like Hindi and English?

Yes, we provide bilingual support for Class 11 Computer Science. You can access Kerala Plus One Computer Science Chapter 6 Data Types and Operators Questions and Answers in both English and Hindi medium.

Is it possible to download the Computer Science Kerala Board solutions for Class 11 as a PDF?

Yes, you can download the entire Kerala Plus One Computer Science Chapter 6 Data Types and Operators Questions and Answers in printable PDF format for offline study on any device.