Step-by-Step Textbook Solutions for Class 12 Computer Application Chapter 01 Review of C++ Programming
Access comprehensive textbook solutions for Chapter 01 Review of C++ Programming using the official curriculum guides for Class 12 Computer Application. Designed to align with the 2026-27 Kerala Board standards, these detailed answers help students reinforce core academic concepts.
Download Chapter 01 Review of C++ Programming Textbook Solutions PDF
Navigate directly to the solved Computer Application textbook exercises using the digital viewer below. Each solution includes detailed step-by-step explanations, allowing students to instantly cross-check their work and identify areas requiring further revision.
One Mark Questions and Answers
Question 1: IDE means ______
Answer:
Integrated Development Environment.
Exam Tips:
a) Write the full form, not just the letters.
Question 2: We know that C++ is a high level language. Which of the following statements is true?
(a) C++ contains English-like statements.
(b) C++ contains mnemonics
(c) C++ contains only 0 and 1
(d) None of these
Answer:
(a) C++ contains English-like statements.
Exam Tips:
a) High-level languages use English-like statements; mnemonics belong to assembly language and 0/1 to machine language.
Question 3: C++ is a ______ language.
(a) High level
(b) Low level
(c) Middle level
(d) None of these
Answer:
(a) High level
Exam Tips:
a) Remember: C++ is high level; assembly is low level.
Question 4: C++ was developed at ______
(a) AT&T Bell Laboratories
(b) San Jose Laboratory
(c) Kansas University Lab
(d) None of these
Answer:
(a) AT&T Bell Laboratories
Exam Tips:
a) Associate C++ with Bjarne Stroustrup at AT&T Bell Labs.
Question 5: C++ is a successor of the ______ language.
(a) C#
(b) C
(c) Java
(d) None of these
Answer:
(b) C
Exam Tips:
a) C++ was developed from C, so it is called 'C with classes' in its early days.
Question 6: The most adopted and popular approach to write programs is ______
Answer:
Structured programming.
Exam Tips:
a) Write the full term 'structured programming'.
Question 7: Which of the following uses the OOP concept?
(a) C
(b) C++
(c) Pascal
(d) Fortran
Answer:
(b) C++
Exam Tips:
a) C++ supports object oriented programming (classes and objects); C, Pascal and Fortran are procedural.
Question 8: ______ is the smallest individual unit of a program.
Answer:
Token
Exam Tips:
a) The five tokens are keywords, identifiers, literals, punctuators and operators.
Question 9: Pick the odd one out.
(a) float
(b) void
(c) break
(d) Alvis
Answer:
(d) Alvis, the others are keywords.
Exam Tips:
a) Keywords are reserved words; Alvis is a user-chosen name.
Question 10: Reserved words for the compiler are called ______
(a) Literals
(b) Identifiers
(c) Keywords
(d) None of these
Answer:
(c) Keywords
Exam Tips:
a) Keywords cannot be used as identifiers.
Question 11: Pick an identifier from the following.
(a) auto
(b) age
(c) float
(d) double
Answer:
(b) age
Exam Tips:
a) auto, float and double are keywords; age is a user-defined name.
Question 12: Pick the invalid identifier.
(a) name
(b) Date of birth
(c) age
(d) joining_time
Answer:
(b) Date of birth, because it contains spaces.
Exam Tips:
a) White spaces are not allowed in identifiers; use an underscore, for example date_of_birth.
Question 13: Pick the octal integer from the following.
(a) 217
(b) 0x217
(c) 0217
(d) None of these
Answer:
(c) 0217. An octal integer starts with 0.
Exam Tips:
a) Octal starts with 0, hexadecimal starts with 0x.
Question 14: Pick the hexadecimal integer from the following.
(a) 217
(b) 0x217
(c) 0217
(d) None of these
Answer:
(b) 0x217. A hexadecimal integer starts with 0x.
Exam Tips:
a) Remember the prefix 0x for hexadecimal.
Question 15: From the following, pick a character constant.
(a) 'A'
(b) 'ALL'
(c) 'AIM'
(d) None of these
Answer:
(a) 'A'. A character constant is a single character enclosed in single quotes.
Exam Tips:
a) Only one character can be inside single quotes.
Question 16: Non-graphic symbols can be represented by using ______
Answer:
Escape sequences.
Exam Tips:
a) Examples are \n, \t and \a.
Question 17: Manish wants to write a program to produce a beep sound. Which escape sequence is used to get an alert (sound)?
(a) \a
(b) \d
(c) \s
(d) None of these
Answer:
(a) \a
Exam Tips:
a) \a stands for 'alert' (audible bell).
Question 18: Ajo wants to print a matter in a new line. Which escape sequence is used for this?
(a) \a
(b) \n
(c) \s
(d) None of these
Answer:
(b) \n
Exam Tips:
a) \n is the new line escape sequence.
Question 19: To represent the null character, ______ is used.
(a) \n
(b) \0
(c) \f
(d) \s
Answer:
(b) \0
Exam Tips:
a) The null character ends every string.
Question 20: State True/False: A string is automatically appended with a null character.
Answer:
True.
Exam Tips:
a) The null character '\0' marks the end of a string, so a string of n characters needs n+1 bytes.
Question 21: From the following, pick a string constant.
(a) 'a'
(b) "abc"
(c) 'abc'
(d) None of these
Answer:
(b) "abc". A string constant is enclosed in double quotes.
Exam Tips:
a) Single quotes are for one character; double quotes are for strings.
Question 22: C++ was developed by ______
(a) Bjarne Stroustrup
(b) James Gosling
(c) Pascal
(d) None of these
Answer:
(a) Bjarne Stroustrup
Exam Tips:
a) James Gosling developed Java.
Question 23: Which of the following is not a character constant?
(a) 'c'
(b) 'e'
(c) 'd'
(d) "c"
Answer:
(d) "c". It is a string constant; the others are character constants.
Exam Tips:
a) Check the quotes: single quotes give a character constant.
Question 24: Which of the following is a valid declaration?
(a) int 91;
(b) int x;
(c) int 9x;
(d) int "x";
Answer:
(b) int x;
Exam Tips:
a) A variable name cannot start with a digit or be written in quotes.
Question 25: Symbols used to perform an operation are called ______
(a) Operand
(b) Operator
(c) Variable
(d) None of these
Answer:
(b) Operator
Exam Tips:
a) Operators act on operands.
Question 26: Consider the following: C = A + B. Here A and B are called ______
(a) Operand
(b) Operator
(c) Variable
(d) None of these
Answer:
(a) Operand
Exam Tips:
a) The data on which an operator works is an operand; here + is the operator.
Question 27: The execution of a program starts at the ______ function.
Answer:
main()
Exam Tips:
a) Every C++ program must have a main() function.
Question 28: The execution of a program ends with the ______ function.
Answer:
main()
Exam Tips:
a) The program starts and ends in main().
Question 29: ______ is used to write a single line comment.
(a) //
(b) /*
(c) */
(d) None of these
Answer:
(a) //
Exam Tips:
a) Use /* ... */ for multi-line comments.
Question 30: const k = 100 means
(a) const float k = 100
(b) const double k = 100
(c) const int k = 100
(d) const char k = 100
Answer:
(c) const int k = 100
Exam Tips:
a) When no type is given with const, int is assumed.
Question 31: Each and every statement in C++ must end with ______
(a) Semicolon
(b) Colon
(c) Full stop
(d) None of these
Answer:
(a) Semicolon
Exam Tips:
a) A missing semicolon is a common syntax error.
Question 32: From the following, select the input operator.
(a) >>
(b) <<
(c) >
(d) <
Answer:
(a) >>
Exam Tips:
a) cin uses >> (extraction operator).
Question 33: From the following, select the output operator.
(a) >>
(b) <<
(c) >
(d) <
Answer:
(b) <<
Exam Tips:
a) cout uses << (insertion operator).
Question 34: In a while loop, the loop variable should be updated
(a) along with the while statement
(b) after the while statement
(c) before the while statement
(d) inside the body of the while
Answer:
(d) inside the body of the while
Exam Tips:
a) Without updating the variable inside the body, the loop never ends.
Question 35: Adeline wrote a C++ program named sum.cpp and compiled it successfully with no error. Some files are generated. Which file is a must to run the program?
(a) sum.exe
(b) sum.obj
(c) sum.vbp
(d) sum.htm
Answer:
(a) sum.exe
Exam Tips:
a) The executable file (.exe) is the only file needed to run the program.
Question 36: Adeline wrote a C++ program named sum.cpp and compiled it successfully with no error. The files sum.obj and sum.exe are generated. Which of these files is not needed to run the program?
Answer:
sum.obj is not needed and can be deleted.
Exam Tips:
a) Source file = .cpp, object file = .obj, executable file = .exe.
Question 37: To terminate a program, which of the following is used?
(a) break
(b) continue
(c) end()
(d) exit()
Answer:
(d) exit()
Exam Tips:
a) exit() needs the header file cstdlib.
Question 38: To write a C++ program, which of the following statements is a must?
(a) sum()
(b) main()
(c) #include
(d) #include
Answer:
(b) main(). A C++ program must contain at least one main() function.
Exam Tips:
a) The other options are optional; main() is always needed.
Question 39: State True/False: Comment statements are ignored by the compiler.
Answer:
True.
Exam Tips:
a) Comments are for the reader of the program only.
Question 40: Using more than one input/output operator in a single statement is called ______
Answer:
Cascading of I/O operators.
Exam Tips:
| Fundamental data types | Derived data types |
|---|---|
| int | array |
| char | function |
| float | pointer |
| double | structure |
| void |
Exam Tips:
a) int, char, float, double and void are fundamental; the rest are built from them (derived).
Question 46: Sheela wants to store her age. Which is the exact data type?
(a) void
(b) char
(c) int
(d) double
Answer:
(c) int
Exam Tips:
a) Age is a whole number, so int is suitable.
Question 47: The integer data type uses ______ bytes of memory.
(a) 5
(b) 2
(c) 3
(d) 4
Answer:
(b) 2 (in the Turbo C++ compiler used in the textbook)
Exam Tips:
a) Remember: int = 2 bytes in the syllabus; char = 1; float = 4; double = 8.
Question 48: The char data type uses ______ bytes of memory.
(a) 1
(b) 3
(c) 7
(d) 8
Answer:
(a) 1
Exam Tips:
a) One character needs one byte.
Question 49: Which data type uses 4 bytes of memory?
(a) float
(b) short
(c) char
(d) double
Answer:
(a) float
Exam Tips:
a) double uses 8 bytes.
Question 50: The full form of ASCII is ______
Answer:
American Standard Code for Information Interchange.
Exam Tips:
a) Write the full form in capital letters properly.
Question 51: Ramu wants to store the value of pi. Which 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 number with a decimal point needs float or double.
Question 52: Which of the following is not true for giving a variable name?
(a) The 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) Only letters, digits and underscore are allowed.
Question 53: 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.
Question 54: 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) Unary = 1, binary = 2, ternary = 3.
Question 55: 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) Example: a + b has two operands.
Question 56: 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.
Question 57: In C++, 13 % 26 = ______
(a) 26
(b) 13
(c) 0
(d) None of these
Answer:
(b) 13. % is the modulus operator, which gives the remainder. Here the remainder is 13.
Exam Tips:
a) When the first number is smaller than the second, the remainder is the first number itself.
Question 58: 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 is dropped.
Exam Tips:
a) Integer division gives an integer result.
Question 59: ++ is a ______ operator.
(a) Unary
(b) Binary
(c) Ternary
(d) None of these
Answer:
(a) Unary
Exam Tips:
a) ++ works on one operand.
Question 60: 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 61: % is a ______ operator.
(a) Unary
(b) Binary
(c) Ternary
(d) None of these
Answer:
(b) Binary
Exam Tips:
a) It needs two operands.
Question 62: State True/False:
1. Multiplication, division and modulus have equal priority.
2. Logical AND (&&) has less priority than logical OR (||).
Answer:
1. True
2. False (&& has higher priority than ||)
Exam Tips:
a) Learn the order: arithmetic, relational, then && before ||.
Question 63: ______ is composed of operators and operands.
(a) expression
(b) Keywords
(c) Identifier
(d) Punctuators
Answer:
(a) expression
Exam Tips:
a) An expression is a combination of operators and operands that gives a value.
Question 64: Supplying a value to a variable at the time of declaration is known as ______
Answer:
Initialisation.
Exam Tips:
a) Example: int k = 100;
Question 65: Which of the following is an initialisation?
(a) int k;
(b) int k = 100;
(c) int k[10];
(d) None of these
Answer:
(b) int k = 100;
Exam Tips:
a) Initialisation = declaration + value.
Question 66: State True/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 is called type promotion (implicit conversion).
Question 67: 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:
(a) and (c) are arithmetic expressions.
(b) and (d) are logical expressions.
Exam Tips:
a) An expression using &&, || or ! is a logical expression.
Question 68: 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, hence the result is a float.
Exam Tips:
a) Type casting one operand is enough to get a decimal result.
Question 69: 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. The short hand means a = a * 10.
Exam Tips:
a) Compound assignment a *= b means a = a * b.
Question 70: 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) a += b means a = a + b.
Question 71: Pick the odd one out.
(a) structure
(b) Array
(c) Pointer
(d) int
Answer:
(d) int. It is a fundamental data type; the others are derived data types.
Exam Tips:
a) Derived types are built from fundamental types.
Question 72: Which of the following is not a character of the C++ language?
(a) A
(b) 9
(c) \
(d) @
Answer:
(d) @
Exam Tips:
a) The @ symbol is not part of the C++ character set.
Question 73: 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) Casting is done by the programmer using (type)expression.
Question 74: Which of the following is ignored by the compiler?
(a) statements
(b) comments
(c) loops
(d) None of these
Answer:
(b) comments
Exam Tips:
a) Comments are not translated.
Question 75: A multi-line comment starts with ______ and ends with ______
(a) /' and '/
(b) */ and /*
(c) /* and */
(d) '/ and /'
Answer:
(c) /* and */
Exam Tips:
a) Do not reverse the order.
Question 76: A single line comment starts with ______
(a) **
(b) @@
(c) */
(d) //
Answer:
(d) //
Exam Tips:
a) A // comment lasts until the end of the line.
Question 77: Alvin wants to store the value of pi. Which is the correct declaration?
(a) char pi = 3.14157
(b) const int pi = 3.14157
(c) const float pi = 3.14157
(d) long pi = 3.14157
Answer:
(c) const float pi = 3.14157
Exam Tips:
a) Pi is a decimal value that must not change, so use const float.
Question 78: To store 70000, which modifier is used with int?
(a) long
(b) short
(c) big
(d) None of these
Answer:
(a) long
Exam Tips:
a) 70000 is more than the int range 32767.
Question 79: To store 60000, which modifier is used with int?
(a) unsigned
(b) short
(c) big
(d) None of these
Answer:
(a) unsigned
Exam Tips:
a) unsigned int stores 0 to 65535.
Question 80: Consider x++ (postfix form). Select the correct definition.
(a) The operation is performed after the value is used
(b) The operation is performed before the value is used
(c) First change then use
(d) None of these
Answer:
(a) The operation is performed after the value is used
Exam Tips:
a) Post = after: first use, then change.
Question 81: Consider ++x (prefix form). Select the correct definition.
(a) The operation is performed after the value is used
(b) The operation is performed before the value is used
(c) First use then change
(d) None of these
Answer:
(b) The operation is performed before the value is used
Exam Tips:
a) Pre = before: first change, then use.
Question 82: Consider the following: int a = 10; float b = 4; cout << a/b; We know that the result is 2.5, a float. What type of conversion is this?
(a) type promotion
(b) type casting
(c) explicit conversion
(d) None of these
Answer:
(a) type promotion (implicit conversion)
Exam Tips:
a) The compiler automatically promotes int to float here.
Question 83: Which of the following has the highest priority?
(a) ++
(b) =
(c) ==
(d) &&
Answer:
(a) ++
Exam Tips:
a) Assignment has one of the lowest priorities.
Question 84: One of your friends told you that post increment (e.g. x++) has more priority than pre increment (e.g. ++x). State True/False.
Answer:
True
Exam Tips:
a) In the operator precedence table of the syllabus, postfix ++ is placed above prefix ++.
Question 85: Raju declared a variable as follows: unsigned number; So he can store a number in the range ______
(a) 0 to 65535
(b) -32768 to 32767
(c) 0 to 65536
(d) 0 to 95536
Answer:
(a) 0 to 65535. unsigned uses 2 bytes of memory but cannot store negative numbers.
Exam Tips:
a) 2 bytes = 16 bits = 65536 values, so the unsigned range is 0 to 65535.
Question 86: Consider the following declaration: signed number; So we can store a number in the range ______
(a) 0 to 65535
(b) -32768 to 32767
(c) 0 to 65536
(d) 0 to 95536
Answer:
(b) -32768 to 32767
Exam Tips:
a) Signed int uses one bit for the sign.
Question 87: Pick the odd one out.
(a) long
(b) short
(c) unsigned
(d) int
Answer:
(d) int. It is a fundamental data type; the others are type modifiers.
Exam Tips:
a) Type modifiers are long, short, signed and unsigned.
Question 88: The memory size and sign can be changed using ______ with fundamental data types.
Answer:
Type modifiers.
Exam Tips:
a) The four type modifiers: signed, unsigned, long, short.
Question 89: "Its value does not change during execution." What is it?
Answer:
Constant.
Exam Tips:
a) Declare constants with the keyword const.
Question 90: "BVMHSS" is called a ______
(a) integer constant
(b) float constant
(c) string constant
(d) None of these
Answer:
(c) string constant
Exam Tips:
a) Characters in double quotes form a string constant.
Question 91: The address of a variable is called ______
Answer:
L-value (Location value) of the variable.
Exam Tips:
a) L = location.
Question 92: The content of a variable is called ______
Answer:
R-value (Read value) of the variable.
Exam Tips:
a) R-value is the value stored in the variable.
Question 93: Suppose the address of a variable age is 1001 and its content is 33. What are the R-value and L-value?
Answer:
R-value is 33 and L-value is 1001.
Exam Tips:
a) L-value is the address; R-value is the content.
Question 94: A total of 65535 application forms are sold in a district. To store the application number, which of the following is valid?
(a) unsigned app_no;
(b) int app_no;
(c) signed app_no;
(d) none of these
Answer:
(a) unsigned app_no;
Exam Tips:
a) The largest number 65535 fits only in an unsigned int.
Question 95: Is it possible to declare a variable as and when a need arises? What kind of declaration is this?
Answer:
Yes. It is known as dynamic declaration.
Exam Tips:
a) Variables can be declared anywhere before their use in C++.
Question 96: Emerin wants to store a constant value. Which keyword is used for this?
Answer:
const
Exam Tips:
a) Write the keyword exactly: const.
Question 97: Suppose x = 5. Then cout << x++ displays ______
Answer:
5. Post increment first uses the value and then increments it.
Exam Tips:
a) The value of x becomes 6 only after it is printed.
Question 98: Suppose x = 5. Then cout << ++x displays ______
Answer:
6. Pre increment first increments the value and then uses it.
Exam Tips:
a) Prefix: change first, use next.
Question 99: An if statement that contains another if statement completely is known as ______
Answer:
Nested if
Exam Tips:
a) Write 'nested if'.
Question 100: Which of the following is not optional with the switch statement?
(a) break
(b) default
(c) case
(d) none of these
Answer:
(c) case
Exam Tips:
a) break and default are optional; at least one case is needed.
Question 101: To exit from a switch statement, ______ is used.
(a) quit
(b) exit
(c) break
(d) none of these
Answer:
(c) break
Exam Tips:
a) Without break, execution falls through to the next case.
Question 102: Which statement is true for the switch statement?
(a) switch is used to test equality
(b) switch is used to test relational or logical expressions
(c) switch can handle real number case data
(d) none of these
Answer:
(a) switch is used to test equality
Exam Tips:
a) switch compares a value with constant cases only.
Question 103: Sonet wants to execute a statement more than once. Which is exactly suitable?
(a) if
(b) loop
(c) switch
(d) if-else if ladder
Answer:
(b) loop
Exam Tips:
a) Loops repeat a block of statements.
Question 104: Odd one out
(a) for
(b) if
(c) switch
(d) if-else if ladder
Answer:
(a) for. It is a loop; the others are branching statements.
Exam Tips:
a) Branching = if, if-else, switch; looping = for, while, do-while.
Question 105: Odd one out
(a) for
(b) if
(c) while
(d) do while
Answer:
(b) if. It is a branching statement; the others are loops.
Exam Tips:
a) Decide first whether each option is a loop or a branch.
Question 106: Which loop does the three things: initialisation, checking and updation?
(a) while
(b) do while
(c) for
(d) none of these
Answer:
(c) for
Exam Tips:
a) All three parts are written in the for statement.
Question 107: Predict the output: for(i=1;i<=10;i++); cout<<i;
(a) 10
(b) 1 to 10
(c) 11
(d) None of these
Answer:
(c) 11. The semicolon after the for statement makes the loop body empty, so cout runs once after the loop ends with i = 11.
Exam Tips:
a) Look for a semicolon right after for(...); it ends the loop body.
Question 108: Which of the following is an exit controlled loop?
(a) for
(b) while
(c) do while
(d) None of these
Answer:
(c) do while
Exam Tips:
a) The do-while checks its condition after executing the body.
Question 109: ______ statement is used for an unconditional jump from one location to another.
Answer:
goto
Exam Tips:
a) goto needs a label.
Question 110: Sunitha wants to skip one iteration. Which of the following will help her?
(a) continue
(b) break
(c) for
(d) case
Answer:
(a) continue
Exam Tips:
a) continue skips the rest of the current iteration; break ends the loop.
Question 111: Pick the odd one out from the following. Give the reason.
1. (a) for (b) while (c) do-while
2. (a) if (b) switch (c) for
Answer:
1. do-while. It is an exit controlled loop; the others are entry controlled loops.
2. for. It is a loop; the others are branching (selection) statements.
Exam Tips:
a) Always add the reason; the question asks for it.
Question 112: Identify the error in the following C++ statement and correct it: short population = 68000;
Answer:
The maximum number that can be stored in a short variable is 32767. So to store 68000 we have to use the long data type.
Exam Tips:
a) Mention the short range (-32768 to 32767) and write the corrected statement: long population = 68000;
Question 113: What would be the appropriate data type to store the following?
1. Number of students in a classroom
2. Age of a student
3. Average mark of a student
4. A question mark (?)
Answer:
1. short or int
2. short or int
3. float
4. char
Exam Tips:
a) Whole numbers: int/short; numbers with decimals: float; a single symbol: char.
Question 114: Pick the odd one out from the following loops. Give the reason.
(a) for (b) while (c) do-while
Answer:
(c) do-while. It is an exit controlled loop; the others are entry controlled loops.
Exam Tips:
a) Entry controlled: test first. Exit controlled: test last.
Question 115: Which of the following data types of C++ has no type modifier?
(a) void
(b) int
(c) char
(d) short
Answer:
(a) void
Exam Tips:
a) Type modifiers apply to int, char and double, not to void.
Two Mark Questions and Answers
Question 116: Mr. Dixon declared a variable as follows: int 9 age; Is it a valid identifier? If not, briefly explain the rules for naming an identifier.
Answer:
It is not a valid identifier because it violates rule 1 below. The rules for naming an identifier are:
1. It must start with a letter (alphabet). An underscore can be treated as a letter.
2. White spaces and special characters cannot be used.
3. Keywords cannot be used as identifiers.
Exam Tips:
a) Say clearly that '9 age' is invalid and then list the rules.
b) The first character must not be a digit.
Question 117: Rose wants to print: \n is used for New Line. Write down the C++ statement for the same.
Answer:
#include <iostream>
using namespace std;
int main()
{
cout<<"\\n is used for New Line";
}
Exam Tips:
a) To print a backslash, write it twice (two backslashes) inside the string.
b) Include the header file iostream and 'using namespace std;'.
Question 118: Alvis wants to give some space using an escape sequence as follows: Welcome to C++. Write down the C++ statement for the same.
Answer:
#include <iostream>
using namespace std;
int main()
{
cout<<"Welcome to \t C++";
}
Exam Tips:
a) \t gives a horizontal tab space.
Question 119: How many bytes are used to store '\a'?
Answer:
One byte is used to store '\a' because it is an escape sequence. An escape sequence is treated as one character, and one character needs one byte.
Exam Tips:
a) Remember: each escape sequence counts as a single character.
Question 120: How many bytes are used to store "\abc"?
Answer:
A string is automatically ended with a null character.
One byte for \a (escape sequence), one byte for b, one byte for c and one byte for the null character.
So a total of 4 bytes are needed to store this string.
Exam Tips:
a) Count the escape sequence as one character and do not forget the null character.
Question 121: How many bytes are used to store "abc"?
Answer:
A string is automatically ended with a null character.
One byte each for a, b and c, and one byte for the null character.
So a total of 4 bytes are needed to store this string.
Exam Tips:
a) Size of a string = number of characters + 1.
Question 122: We know that the value of pi = 3.14157 is a constant (literal). What is a constant? Explain.
Answer:
A constant or a literal is a data item whose value does not change during execution.
1. Integer literals: Whole numbers without a fractional part. Their value does not change during execution. There are 3 types: decimal, octal and hexadecimal.
Examples: decimal 100, 150; octal 0100, 0240; hexadecimal 0x100, 0x1A.
2. Float literals: Numbers with a fractional part. Examples: 3.14157, 79.78.
3. Character literal: A valid C++ character enclosed in single quotes. Example: 'm'.
Exam Tips:
a) Define a constant first and then explain each kind with an example.
b) The string literal (characters in double quotes) can also be mentioned.
Question 123: Write a program to print the message "TOBACCO CAUSES CANCER" on the screen.
Answer:
#include <iostream>
using namespace std;
int main()
{
cout<<"TOBACCO CAUSES CANCER";
}
Exam Tips:
a) Do not forget the header file and 'using namespace std;'.
Question 124: Consider the following code:
int main()
{
cout<<"welcome to C++";
}
After you compile this program, there is an error. Why did it happen? Explain.
Answer:
Here the output operator cout<< is used to display the message "welcome to C++". To use this operator, the corresponding header file (iostream) must be included and the statement 'using namespace std;' must also be written. These were not included, hence the error.
Exam Tips:
a) Name the missing header file: #include <iostream>.
Question 125: You are supplied with a list of tokens in a C++ program. Classify and categorise them under proper headings. Explain each category with its features: tot_mark, age, M5, break, (), int, _pay, ;, cin
Answer:
| Keywords | Identifiers | Literals | Punctuators | Operators |
|---|---|---|---|---|
| break | tot_mark | none | ( ) | none |
| int | age | ; | ||
| M5 | ||||
| _pay | ||||
| cin |
Keywords: break, int. These are reserved words for the compiler and cannot be used for any other purpose.
Identifiers: tot_mark, age, M5, _pay, cin. These are user-defined names (cin is a predefined identifier).
Literals: none in the list. Literals are constants whose value does not change.
Punctuators: ( ), ; These are used to separate tokens.
Operators: none in the list. Operators are symbols used to perform operations.
Exam Tips:
a) Use a table with the five headings; empty headings can be marked 'none'.
b) Explain each category in one line.
Question 126: In C++, the size of the string "book" is 5 and that of "book\n" is 6. Check the validity of the above statement. Justify your answer.
Answer:
A null character (\0) is automatically added at the end of a string, and it is counted as one character. So the size of the string "book" is 4 + 1 = 5. Similarly, a null character is also added to "book\n". \n and \0 are each treated as a single character. Hence the size of the string "book\n" is 5 + 1 = 6. The statement is valid.
Exam Tips:
a) Count each escape sequence as one character and add one for the null character.
Question 127: Is 0x85B a valid integer constant in C++? If yes, why?
Answer:
Yes. It is a hexadecimal number (it starts with 0x and contains the valid hexadecimal digits 8, 5 and B).
Exam Tips:
a) Hexadecimal digits are 0-9 and A-F.
Question 128: Pick the odd man out. Justify.
TOTSAL, TOT_SAL, totsal5, Tot5_sal, SALTOT, tot.sal
Answer:
tot.sal. It contains a special character, the dot (.). An identifier cannot contain a special character, so it is not an identifier. The remaining names satisfy the rules for naming an identifier, so they are valid identifiers.
Exam Tips:
a) Check each name for spaces, special characters and a starting digit.
Question 129: Write a C++ statement to print the following sentence and justify: \ is a special character
Answer:
1. cout<<"\\ is a special character";
2. \\ is treated as an escape sequence which prints a single backslash.
Exam Tips:
a) A single backslash begins an escape sequence, so it is written twice to print it.
Question 130: A student types a C++ program and saves it in his personal folder as Sample.cpp. After getting the output of the program, he checks the folder and finds three files: Sample.cpp, Sample.obj and Sample.exe. Write the reasons for the generation of the two extra files.
Answer:
After compiling Sample.cpp, if there is no error, two files are created. One is the object file (Sample.obj) and the other is the executable file (Sample.exe). The source file (Sample.cpp) and object file (Sample.obj) are not needed to run the program and can be deleted. Only Sample.exe is needed to run the program.
Exam Tips:
a) Explain the role of each file: .cpp = source code, .obj = object code, .exe = executable.
Question 131: Write a program to print the message "SMOKING IS INJURIOUS TO HEALTH" on the screen.
Answer:
#include <iostream>
using namespace std;
int main()
{
cout<<"SMOKING IS INJURIOUS TO HEALTH";
}
Exam Tips:
a) A program always has the header file, the using statement and main().
Question 132: Consider the following:
short number;
number = 76543;
Is it valid? Explain.
Answer:
It is not valid. A short variable uses only two bytes (16 bits) of memory, so we can store a total of 216 = 65536 integers. Half of them are negative and half are positive, so the range is -32768 to +32767 (0 is counted among the positive numbers). The number 76543 is bigger than this range, hence there is an overflow error. To store this number, declare the variable as follows:
long number;
Exam Tips:
a) Mention the range -32768 to +32767 for 2 bytes.
b) State the remedy: use the long data type.
Question 133: Consider the following:
const int bp;
bp = 100;
Is it valid? Explain.
Answer:
This is not valid. A constant variable cannot be modified after it is declared, and a constant variable must be initialised at the time of declaration. The correct declaration is:
const int bp = 100;
Exam Tips:
a) A const variable must be given its value in the same statement.
Question 134: Consider the following statements in C++:
cout<<41/2;
cout<<41/2.0;
Do these two statements give the same result? Explain.
Answer:
The two statements do not give the same result. The first statement, 41/2, gives 20 instead of 20.5, because 41 and 2 are both integers and the result of integer division is an integer; the fractional part is dropped.
To get a floating-point result, at least one operand must be float. The second statement gives 20.5 because 2.0 is a float.
Exam Tips:
a) The type of the result depends on the types of the operands.
Question 135: If mark = 70, what will be the value of the variable result in the following statement?
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 the variable result. The value of result is 'P'.
Exam Tips:
a) Evaluate the condition first, then choose the true or false value.
Question 136: 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 known as dynamic initialisation. Example:
int a=10, b=5;
int c = a*b;
Here the variable c is declared and initialised with the value 10 * 5 while the program runs.
Exam Tips:
a) Dynamic means the value is calculated during execution.
Question 137: Boolean data type is used to store True/False in C++. Is it true? Is there any data type called Boolean in C++?
Answer:
In the syllabus (Turbo C++), there is no separate data type for storing a boolean value. In C++ any non-zero value (either negative or positive) is treated as true and zero is treated as false. (Newer C++ compilers do provide a bool data type.)
Exam Tips:
a) Answer as per the syllabus: non-zero is true and zero is false.
Question 138: 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, because n = -15 is a non-zero number and so it is treated as true.
Exam Tips:
a) Any non-zero value, even a negative one, is true.
Question 139: Is it possible to declare a variable in the middle of the program as and when the need arises? What is it called?
Answer:
Yes, it is possible to declare a variable in the middle of the program as and when the need arises. It is known as dynamic declaration (a variable can also be given its value at that point, which is dynamic initialisation).
Example:
int x=10, y=20;
......
int z=x*y;
Exam Tips:
a) Give a small example showing a declaration after some statements.
Question 140: Consider the following code:
char ch;
cout<<"Enter a character";
cin>>ch;
A user gives 9 to the variable ch. Is there any problem? Is it valid?
Answer:
There is no problem and it is valid, because 9 entered here is treated as a character. Any symbol from the keyboard is treated as a character.
Exam Tips:
a) A digit typed for a char variable is stored as the character '9' and not as a number.
Question 141: "With the same size we can change the sign and range of data." Comment on this statement.
Answer:
The statement is correct. With the help of type modifiers, we can change the sign and range of data without changing the size. The important type modifiers are signed, unsigned, long and short.
Exam Tips:
a) Name the four type modifiers.
Question 142: Write short notes on C++ short hands.
Answer:
x = x + 10 can be written as x += 10. This is called a short hand in C++ and it is faster. It can be used with all arithmetic operators as follows:
| Arithmetic assignment expression | Equivalent arithmetic expression |
|---|---|
| x += 10 | x = x + 10 |
| x -= 10 | x = x - 10 |
| x *= 10 | x = x * 10 |
| x /= 10 | x = x / 10 |
| x %= 10 | x = x % 10 |
Exam Tips:
a) Write the table of all five short hand operators.
Question 143: What is the role of the 'const' modifier?
Answer:
The keyword const is used to declare a constant. Example: const int bp = 100; By this, the variable bp is treated as a constant and its value cannot be changed during execution.
Exam Tips:
a) Mention that a const variable must be initialised.
Question 144: Specify the most appropriate data type for handling the following data:
1. Roll no. of a student
2. Name of an employee
3. Price of an article
4. Marks of 12 subjects
Answer:
1. short rollno;
2. char name[20];
3. float price;
4. short marks[12];
Exam Tips:
a) Use an array for a group of values of the same type, such as marks of 12 subjects.
Question 145: 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 (the result is 2)
2. 5%2 (the result is 1)
Exam Tips:
a) / gives the quotient and % gives the remainder for integers.
Question 146: Predict the output of the following code. Justify.
int k = 5, b = 0;
b = k++ + ++k;
cout<<b;
Answer:
The output is 12. In this statement, the first operand of + is k++, which uses the value 5 and then makes k = 6. Then ++k makes k = 7 and this is the second operand. Hence b = 5 + 7 = 12.
Exam Tips:
a) Explain post and pre increment separately, step by step.
b) (Expressions that change the same variable twice give compiler dependent results; follow the textbook method in the exam.)
Question 147: 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
2. 16
Exam Tips:
a) In the first statement the post decrement uses the old value 5; in the second statement the pre increment makes ctr 6 before it is added.
Question 148: Predict the output.
int a;
float b;
a = 5;
cout<<sizeof(a + b/2);
Answer:
The output is 4. The expression a + b/2 is of float type (the int is promoted to float), and sizeof gives the memory size of a float, which is 4 bytes.
Exam Tips:
a) Find the data type of the whole expression first.
Question 149: Predict the output.
int a, b, c;
a = 5; b = 2;
c = a/b;
cout<<c;
Answer:
The output is 2. Both operands are integers, so the result is an integer.
Exam Tips:
a) Integer divided by integer gives an integer.
Question 150: Explain cascading of I/O operations.
Answer:
The use of multiple input or output operators in a single statement is called cascading of I/O operators. Example: to take three numbers using one statement: cin>>x>>y>>z; To print three numbers using one statement: cout<<x<<y<<z;
Exam Tips:
a) Give one example each for input and output.
Question 151: Trace out and correct the errors in the following code fragments:
1. cout<<"Mark="45;
2. cin<<"Hello World!";
3. cout>>"X + Y;
4. Cout<<'Good'<<'Morning'
Answer:
1. cout<<"Mark=45";
2. cout<<"Hello World!"; (cin is used for input; the output operator with cout is needed)
3. cout<<"X + Y"; (or cout<<X + Y; to print the sum)
4. cout<<"Good Morning"; (cout is written in lower case and strings are in double quotes)
Exam Tips:
a) Check the operator direction, the quotes and the case of cout/cin.
Question 152: What do you mean by a preprocessor directive?
Answer:
A C++ program starts with preprocessor directives, such as #include, #define and #undef. By using #include we can link the header files that are needed to use library functions. By using #define we can define constants. Example: #define x 100. Here the value of x becomes 100 and cannot be changed in the program.
Exam Tips:
a) Preprocessor directives start with # and do not end with a semicolon.
Question 153: Write a program to print the message "Hello, Welcome to C++".
Answer:
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello, Welcome to C++";
}
Exam Tips:
a) Keep the message exactly as given inside the double quotes.
Question 154: Write a program to generate the following table:
| 2013 | 100% |
| 2012 | 99.9% |
| 2011 | 95.5% |
| 2010 | 90.81% |
| 2009 | 85% |
Use a single cout statement for the output.
Answer:
#include <iostream>
using namespace std;
int main()
{
cout<<"2013\t100%\n2012\t99.9%\n2011\t95.5%\n2010\t90.81%\n2009\t85%";
}
Exam Tips:
a) \t gives the tab space between the columns and \n starts each new row.
Question 155: Determine the data type of the following expression, if a is an int, b is a float, c is a long int and d is a double:
\( \frac{(1-ac)^{25}}{c-d} + \frac{(b+a)/c}{(\text{long})(a+d)} \)
Answer:
In type promotion, the operands of lower data type are converted to the highest data type in the expression. Replace each variable with its data type:
\( \frac{(1 - \text{int} \times \text{long})^{25}}{\text{long} - \text{double}} + \frac{(\text{float} + \text{int})/\text{long}}{(\text{long})(\text{int} + \text{double})} \)
The first part is double (long - double gives double) and the second part is float. So the whole expression is double + float = double. Hence the data type of the expression is double (the highest data type).
Exam Tips:
a) Convert step by step, working inside the brackets first.
b) The final type is the highest type among all the operands.
Question 156: While writing a program, Geo uses a while loop but forgets to update the loop variable. What will happen?
Answer:
The loop variable inside a while loop must be updated; otherwise the condition never becomes false and the loop will not terminate. The loop will run infinitely.
Exam Tips:
a) Use the term 'infinite loop'.
Question 157: Draw the flow chart of the if statement.
Answer:
Exam Tips:
a) Use a diamond for the test expression and a rectangle for the body.
Question 158: Draw the flow chart of the if else statement.
Answer:
Exam Tips:
a) Show both the True and False paths clearly and join them at the end.
Question 159: Write a while loop that displays the numbers from 500 to 550.
Answer:
int i=500;
while (i<=550)
{
cout<<i;
i=i+1;
}
Exam Tips:
a) Initialise i before the loop and update it inside the body.
Question 160: Compare the if-else statement and the conditional operator.
Answer:
The conditional operator can be used as an alternative to the if-else statement. The conditional operator is a ternary operator.
Syntax of if-else:
if (expression 1)
expression 2;
else
expression 3;
First expression 1 is evaluated. If it is true, expression 2 is executed; otherwise expression 3 is executed. The same can be written using the conditional operator as:
expression 1 ? expression 2 : expression 3;
Exam Tips:
a) Write both syntaxes side by side.
Question 161: Draw the flow chart of the for loop.
Answer:
Exam Tips:
a) Mark the flow of initialisation (before the test), test, body and update.
Question 162: Find the errors in the syntax, if any, and correct them.
a) while (test condition);
{
}
b) do (condition)
{
}while;
c) switch(condition)
{
Case 1:
Case 2:
Case 3:
Case 4:
}
Answer:
a) There is no need for a semicolon after while(test condition). The corrected loop is:
while (test condition)
{
}
b) In the do-while loop, the keyword while with the condition must be written at the end and it ends with a semicolon:
do
{
}while (condition);
c) The switch contains an expression instead of a condition, and the case labels are written in lower case:
switch(expression)
{
case 1:
case 2:
case 3:
case 4:
}
Exam Tips:
a) Remember: no semicolon after while(...) of a while loop but a semicolon after while(...) of a do-while loop.
Question 163: State whether the following statements are True or False. In either case justify your answer.
1. break is essential in switch
2. for loop is an entry controlled loop
3. do-while loop is an entry controlled loop
4. switch is a selection statement
Answer:
1. False. It is not essential, for example in a single case statement.
2. True. It first checks the condition, and only if it is true is the body executed.
3. False. It is an exit controlled loop.
4. True.
Exam Tips:
a) Write True/False first and then the reason.
Question 164: Given the code segment: for(i=1; i<10; i++) cout<<i;
1. Rewrite the code using a do-while loop.
2. What will be the output when i=0? Give the reason.
Answer:
1. i=1;
do
{
cout<<i;
i++;
}while(i<10);
2. When i starts from 0, it prints 0 to 9, because the loop will execute one more time. With i=1 the loop executes 9 times, but with i=0 it executes 10 times.
Exam Tips:
a) Put initialisation before do, the update inside and the condition at the end.
Question 165: Write the equivalent code for the following statement: R = (P<Q ? P : Q)
Answer:
if (P<Q)
R=P;
else
R=Q;
Exam Tips:
a) The part before ? is the if condition.
Question 166: Examine the following code snippet and find the output. What will happen if the statement int ch; is replaced by char ch;?
int ch;
for(ch='A'; ch<='Z'; ++ch)
cout<<ch<<" ";
Answer:
This code prints 65 66 67 ... 90 (the ASCII values of A to Z). If the statement int ch; is replaced by char ch;, it prints A B C ... Z.
Exam Tips:
a) An int variable shows the ASCII number while a char variable shows the character.
Question 167: Your friend uses the following identifiers in a program. Find out the invalid identifiers, with the reason: basic pay, area, date-of-birth, B3, 9A, switch
Answer:
basic pay – Invalid because white space is not allowed.
area – Valid
date-of-birth – Invalid because the hyphen (-) is not allowed.
B3 – Valid
9A – Invalid because an identifier should not begin with a digit.
switch – Invalid because keywords are not allowed.
Exam Tips:
a) Give the reason for every invalid name.
Question 168: Predict the output:
int x=5;
int y=10;
cout<<(x+y)%2;
Answer:
(x+y) % 2 = (5+10) % 2 = 15 % 2 = 1. It prints 1.
Exam Tips:
a) Evaluate the bracket first.
Question 169: Classify the following C++ tokens in accordance with the table given below:
int, %, digit, 25.6, "break", =, do, cin
| Keyword | Identifier | Literal | Operator |
|---|---|---|---|
Answer:
Keyword: int, do
Identifier: digit, cin (cin is a predefined identifier)
Literal: "break" (string literal), 25.6 (float literal)
Operator: % (modulus operator), = (assignment operator)
Exam Tips:
a) "break" is inside double quotes, so it is a string literal and not a keyword.
Question 170: Rewrite the following C++ code using the conditional operator.
if (a>b)
max=a;
else
max=b;
Answer:
max = (a>b) ? a : b;
Exam Tips:
a) The condition comes before ? and the two values are separated by a colon.
Question 171: Write the C++ expressions to calculate the values of the following:
1. \( x = \frac{b^2 - 4ac}{2a} \)
2. \( y = a^2 + 2ab + b^2 \)
Answer:
1. x = (b*b - 4*a*c)/(2*a);
2. y = a*a + 2*a*b + b*b;
Exam Tips:
a) Use brackets around the numerator and the denominator.
b) There is no power operator in C++, so a squared is written a*a.
Question 172: Consider the following code and predict the output. Justify your answer.
for(int i=1; i<10; ++i)
{
if (i==8)
{
break;
}
cout<<"\t"<<i;
}
Answer:
The output is 1 2 3 4 5 6 7. This loop is meant to print 1 to 9, but it terminates (break) when the value of i becomes 8. Hence it prints 1 to 7.
Exam Tips:
a) break ends the loop completely.
Question 173: Predict the output for the following program code:
for(i=1; i<=10; ++i)
{
if (i==7)
continue;
cout<<"\t";
cout<<i;
}
Answer:
The output is 1 2 3 4 5 6 8 9 10. This loop is used to print 1 to 10, but it bypasses one iteration when the value of i becomes 7. Hence it prints 1 to 10 except 7.
Exam Tips:
a) continue skips only the current iteration.
Question 174: How many times will the following loop be executed?
int s = 0, i = 0;
do
{
s += i;
i++;
} while(i <= 5);
Answer:
This loop will be executed 6 times. The value of i inside the body is 0, 1, 2, 3, 4 and 5; after the sixth time i becomes 6 and the condition is false.
Exam Tips:
a) Trace i for each iteration in a small table.
Three Mark Questions and Answers
Question 175: In a panchayath or municipality, all the houses have a house number, house name and members. A similar situation exists in the case of memory. Explain.
Answer:
The named memory locations are called variables. 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 the location value (L-value).
3. Content: The value stored in a variable is called its content. It is also called the read value (R-value).
Exam Tips:
a) Compare: house name = variable name, house number = address, members = content.
Question 176: Briefly explain constants.
Answer:
A constant or a literal is a data item whose value does not change during execution. The keyword const is used to declare a constant. Its declaration is:
const data_type variable_name = value;
Examples:
const int bp = 100;
const float pi = 3.14157;
const char ch = 'a';
1. Integer literals: Whole numbers without a fractional part. There are 3 types: decimal, octal and hexadecimal. Examples: decimal 100, 150; octal 0100, 0240; hexadecimal 0x100, 0x1A.
2. Float literals: Numbers with a fractional part. Examples: 3.14157, 79.78.
3. Character literals: A valid C++ character enclosed in single quotes. Examples: 'm', 'f'.
4. String literals: One or more characters enclosed in double quotes. A string is automatically ended with a null character ('\0'). Examples: "Mary's", "India".
Exam Tips:
a) Name the four types of literals with one example each.
Question 177: Consider the following statements:
int a=10, x=20;
float b=49000.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 assigns the value of the right hand side (RHS) to the left hand side (LHS). There are two cases:
1. The size of the RHS is less than that of the LHS. There is no problem; the RHS data type is promoted to the LHS type. Here the types are compatible.
2. The size of the RHS is greater than that of the LHS. Here a problem arises, because sometimes the LHS cannot hold the RHS value and a wrong answer may result. Here the types are not compatible.
In a=b; there is a problem, because the size of the LHS (int, 2 bytes) is less than the size of the RHS (float, 4 bytes), so the fractional part is lost.
In y=x; there is no problem, because the size of the LHS (float, 4 bytes) is greater than that of the RHS (int, 2 bytes).
Exam Tips:
a) Explain type compatibility in terms of the sizes of the two sides.
Question 178: A company has decided to give incentives to its salesmen as per the sales. The criteria are:
- If the total sales exceeds 10,000, the incentive is 10%.
- If the total sales >= 5,000 and < 10,000, the incentive is 6%.
- If the total sales >= 1,000 and < 5,000, the incentive is 3%.
Write a C++ program to solve the above problem and 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*.10 : (sales>=5000 ? sales*.06 : (sales>=1000 ? sales*.03 : 0)));
cout<<"\nThe incentive is "<<incentive;
}
Exam Tips:
a) Use nested conditional operators when if is not allowed.
b) Remember a final value (0) for sales below 1000.
Question 179: A C++ program code is given below to find the value of \( 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:
This program contains some errors. The corrected 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;
}
Compile time (syntax) errors: the semicolon is missing after 'int a,b'; 'cin>a>>b' should be 'cin>>a>>b'; and 'cout>>x' should be 'cout<<x'.
Logical error: x=a*a+b*b/2*a gives a wrong value because of operator precedence; the correct expression is (a*a+b*b)/(2*a).
Run time error: division by zero when a = 0.
The output is:
1. a=4 and b=8: x = (16+64)/8 = 10
2. a=0 and b=2: Divide by zero error (run time error).
Exam Tips:
a) Classify each mistake as a syntax error, a logical error or a run time error.
b) Note that the program uses integer division in (a*a+b*b)/(2*a) because a and b are int.
Question 180: We know that a program has a structure. Explain the structure of a C++ program.
Answer:
A typical C++ program contains four sections:
1. Include files
2. Function declarations
3. Function definitions
4. Main function program
Example:
#include <iostream>
using namespace std;
int sum(int x, int y)
{
return (x+y);
}
int main()
{
cout<<sum(2,3);
}
Exam Tips:
a) Name the four sections in order and give a small example.
Question 181: Write a program to read two numbers and find their sum.
Answer:
#include <iostream>
using namespace std;
int main()
{
int n1,n2,sum;
cout<<"Enter two numbers";
cin>>n1>>n2;
sum=n1+n2;
cout<<"The sum of "<<n1<<" and "<<n2<<" is "<<sum;
}
Exam Tips:
a) Read the input, process it, then display the output.
Question 182: Write a program to read three scores and find the average.
Answer:
#include <iostream>
using namespace std;
int main()
{
int s1,s2,s3;
float avg;
cout<<"Enter the three scores";
cin>>s1>>s2>>s3;
avg=(s1+s2+s3)/3.0;
cout<<"The average CE score is "<<avg;
}
Exam Tips:
a) Divide by 3.0 (not 3) so that the decimal part is not lost.
Question 183: Write a program to find the area and perimeter of a circle.
Answer:
#include <iostream>
using namespace std;
int main()
{
const float pi=3.14157;
float r,area,perimeter;
cout<<"Enter the radius of a circle";
cin>>r;
area=pi*r*r;
perimeter=2*pi*r;
cout<<"Area of the circle is "<<area<<"\nPerimeter of the circle is "<<perimeter;
}
Exam Tips:
a) Area = pi r squared and perimeter = 2 pi r; declare pi as a constant.
Question 184: Write a program to find the simple interest.
Answer:
#include <iostream>
using namespace std;
int main()
{
float p,n,r,si;
cout<<"Enter the Principal amount";
cin>>p;
cout<<"Enter the number of years";
cin>>n;
cout<<"Enter the rate of interest";
cin>>r;
si=p*n*r/100;
cout<<"Simple interest is "<<si;
}
Exam Tips:
a) Simple interest = principal x years x rate / 100.
Question 185: Write a program to convert temperature from Celsius to Fahrenheit.
Answer:
#include <iostream>
using namespace std;
int main()
{
float c,f;
cout<<"Enter the Temperature in Celsius:";
cin>>c;
f=1.8*c+32;
cout<<c<<" Degree Celsius = "<<f<<" Degree Fahrenheit";
}
Exam Tips:
a) F = 1.8 x C + 32.
Question 186: Write a program to read the weight in grams and convert it into kilograms.
Answer:
#include <iostream>
using namespace std;
int main()
{
float gm,kg;
cout<<"Enter the weight in grams:";
cin>>gm;
kg=gm/1000;
cout<<gm<<" grams = "<<kg<<" Kilograms";
}
Exam Tips:
a) 1 kg = 1000 g.
Question 187: Write a program to read your height in centimetres and convert it into feet and inches.
Answer:
#include <iostream>
using namespace std;
int main()
{
int m,cm;
float inch;
int feet;
cout<<"Enter your height in Centimeter:";
cin>>cm;
cout<<"Your height is "<<cm/100<<" Meters and "<<cm%100<<" cm\n";
inch=cm/2.54;
feet=inch/12;
inch=(int)inch%12;
cout<<feet<<" feet and "<<inch<<" inch";
}
Exam Tips:
a) 1 inch = 2.54 cm and 1 foot = 12 inches.
b) The % operator works only with integers, so inch is cast to int.
Question 188: Write a program to find the area of a triangle.
Answer:
#include <iostream>
using namespace std;
int main()
{
int b,h;
float area;
cout<<"Enter values for b and h";
cin>>b>>h;
area=0.5*b*h;
cout<<"The area of the triangle is "<<area;
}
Exam Tips:
a) Area = 1/2 x base x height; use 0.5 and not 1/2 (which is 0 in integer division).
Question 189: Write a program to
1. print the ASCII value of a given digit
2. print the ASCII value of backspace
Answer:
#include <iostream>
using namespace std;
int main()
{
char ch;
int asc,bak;
cout<<"Enter a digit:";
cin>>ch;
asc=ch;
cout<<"ASCII for "<<ch<<" is "<<asc;
bak='\b';
cout<<"\nASCII for backspace is "<<bak;
}
Exam Tips:
a) Assigning a char to an int variable stores its ASCII code.
Question 190: Write a program to read a time in seconds and convert it into hours, minutes and seconds.
Answer:
#include <iostream>
using namespace std;
int main()
{
long h,m,s;
cout<<"Enter the time in seconds:";
cin>>s;
h=s/3600;
s=s%3600;
m=s/60;
s=s%60;
cout<<h<<" hr:"<<m<<" min:"<<s<<" secs";
}
Exam Tips:
a) Use / for the quotient and % for the remainder at every step.
Question 191: Two pairs of C++ expressions are given below.
1. a=10, a==10
2. b=a++, b=++a
How do they differ? What will be the effect of the expressions?
Answer:
1. = is the assignment operator; a=10 assigns the value 10 to the left hand side variable a. But == is the equality operator; a==10 checks whether the left hand side and right hand side are equal. If they are equal, it gives true, otherwise false.
2. In a++, ++ is a post increment operator (after the operand) and in ++a, ++ is a pre increment operator (before the operand). They are different.
Post increment: first use the value of a and then change it. Example: if a=10, then b=a++ gives b=10 and a=11.
Pre increment: first change the value of a and then use it. Example: if a=10, then b=++a gives b=11 and a=11.
Exam Tips:
a) Always show the values of both variables after executing the statement.
Question 192: Consider the following:
int a=45.65;
cout<<a;
What is the output of the above code? Is it possible to convert a data type into another type? Explain.
Answer:
The output of the code is 45; the floating-point number is converted into an integer (the fractional part is dropped). It is possible to convert a data type into another data type. There are two types of type conversion:
1. Implicit type conversion: This is performed by the C++ compiler internally. C++ converts all the lower sized data types to the highest sized operand. This is known as type promotion. The data types from lower size to higher size are: unsigned int (2 bytes), int (2 bytes), long (4 bytes), unsigned long (4 bytes), float (4 bytes), double (8 bytes), long double (10 bytes).
2. Explicit type conversion: This is known as type casting and is done by the programmer. The syntax is: (data type to be converted) expression
Example: int x=10; (float) x; This expression converts the data type of x from integer to float.
Exam Tips:
a) Mention both implicit conversion (type promotion) and explicit conversion (type casting).
Question 193: Your friend Arun asked you whether there is any loop that does the three things: initialisation, testing and updation. What is your answer? Explain.
Answer:
Yes. There is only one loop, the for loop, that does all three things. The other loops do only the checking; the initialisation must be done before the loop and the updation must be done inside the loop.
The syntax of the for loop is:
for(initialisation; testing; updation)
{
Body of the for loop;
}
Exam Tips:
a) Write the syntax of the for loop in the answer.
Question 194: Distinguish between the exit(0) function and the return statement.
Answer:
Both are used to terminate the program, but they are different. return is a keyword and exit(0) is a function. We can use more than one exit(0) function in a program, but only one return statement can be used in a scope. To use exit(0), the header file cstdlib must be included.
Exam Tips:
a) Mention that exit() needs the header file cstdlib.
Question 195: Rewrite the following program using if else:
#include <iostream>
using namespace std;
int main()
{
int a,b,big;
cout<<"Enter two integers";
cin>>a>>b;
big=(a>b)?a:b;
cout<<"Biggest number is "<<big<<endl;
return 0;
}
Answer:
#include <iostream>
using namespace std;
int main()
{
int a,b,big;
cout<<"Enter two integers";
cin>>a>>b;
if (a>b)
big=a;
else
big=b;
cout<<"Biggest number is "<<big<<endl;
return 0;
}
Exam Tips:
a) Replace condition ? x : y by if (condition) ... else ...
Question 196: Rewrite the following using the nested switch construct.
#include <iostream>
using namespace std;
int main()
{
int a,b;
cout<<"Enter values for a and b";
cin>>a>>b;
if(b==0)
cout<<"Divide by zero error";
else if(a==0)
cout<<"The result is zero";
else
cout<<"The result is "<<(float)a/b;
}
Answer:
#include <iostream>
using namespace std;
int main()
{
int a,b;
cout<<"Enter values for a and b";
cin>>a>>b;
switch(b)
{
case 0: cout<<"Divide by zero error";
break;
default:
switch(a)
{
case 0: cout<<"The result is zero";
break;
default: cout<<"The result is "<<(float)a/b;
}
}
}
Exam Tips:
a) Each case checks equality with a constant, so test b==0 first and then a==0 in a nested switch.
Question 197: Consider the following output and write down the code for the same.
*
* *
* * *
* * * *
Answer:
#include <iostream>
using namespace std;
int main()
{
int i,j;
for(i=1;i<5;i++)
{
for(j=1;j<=i;j++)
cout<<"* ";
cout<<endl;
}
}
Exam Tips:
a) The outer loop controls the rows and the inner loop controls the number of stars in each row.
Question 198: Consider the following output and write down the code for the same.
1
1 2
1 2 3
1 2 3 4
Answer:
#include <iostream>
using namespace std;
int main()
{
int i,j;
for(i=1;i<5;i++)
{
for(j=1;j<=i;j++)
cout<<j<<" ";
cout<<endl;
}
}
Exam Tips:
a) Print the inner loop variable j.
Question 199: Consider the following output and write down the code for the same.
1
2 2
3 3 3
4 4 4 4
Answer:
#include <iostream>
using namespace std;
int main()
{
int i,j;
for(i=1;i<5;i++)
{
for(j=1;j<=i;j++)
cout<<i<<" ";
cout<<endl;
}
}
Exam Tips:
a) Print the outer loop variable i.
Question 200: Consider the following output and write down the code for the same.
1
2 3
4 5 6
7 8 9 10
Answer:
#include <iostream>
using namespace std;
int main()
{
int i,j,k=0;
for(i=1;i<5;i++)
{
for(j=1;j<=i;j++)
cout<<++k<<" ";
cout<<endl;
}
}
Exam Tips:
a) Use a separate counter k that increases every time something is printed.
Question 201: Consider the following output and write down the code for the same.
1
1 3
1 3 5
1 3 5 7
Answer:
#include <iostream>
using namespace std;
int main()
{
int i,j;
for(i=1;i<5;i++)
{
for(j=1;j<=i;j++)
cout<<j*2-1<<" ";
cout<<endl;
}
}
Exam Tips:
a) j*2-1 gives the odd numbers 1, 3, 5, 7.
Question 202: Consider the following output and write down the code for the same.
2
4 4
6 6 6
8 8 8 8
Answer:
#include <iostream>
using namespace std;
int main()
{
int i,j;
for(i=1;i<5;i++)
{
for(j=1;j<=i;j++)
cout<<i*2<<" ";
cout<<endl;
}
}
Exam Tips:
a) i*2 gives the even numbers 2, 4, 6, 8.
Question 203: Write a program to print the sum of the first n natural numbers.
Answer:
#include <iostream>
using namespace std;
int main()
{
int n,i,sum=0;
cout<<"Enter a value for n";
cin>>n;
for(i=1;i<=n;i++)
{
sum=sum+i;
}
cout<<"The sum of first "<<n<<" numbers is "<<sum;
}
Exam Tips:
a) Initialise sum to 0 before the loop.
Question 204: Write a program to read a number and check whether it is a palindrome or not.
Answer:
#include <iostream>
using namespace std;
int main()
{
int n,m,rem,rev=0;
cout<<"Enter a number";
cin>>n;
m=n;
while(n)
{
rem=n%10;
rev=rev*10+rem;
n=n/10;
}
if(rev==m)
cout<<"The number "<<m<<" is palindrome";
else
cout<<"The number "<<m<<" is not palindrome";
}
Exam Tips:
a) Reverse the number and compare it with the original; keep a copy of the original in m.
Question 205: Write a program to print the factorial of a number.
Answer:
#include <iostream>
using namespace std;
int main()
{
int n,i;
long fact=1;
cout<<"Enter a number";
cin>>n;
for(i=1;i<=n;i++)
fact=fact*i;
cout<<"The factorial of "<<n<<" is "<<fact;
}
Exam Tips:
a) Initialise fact to 1, not 0, and use a long variable for large results.
Question 206: Write a program to print the Fibonacci series.
Answer:
#include <iostream>
using namespace std;
int main()
{
int n,fib1=0,fib2=1,fib3;
cout<<"Enter the limit";
cin>>n;
cout<<"The fibonacci series is ";
if(n==1)
cout<<fib1<<",";
else if(n==2)
cout<<fib1<<","<<fib2<<",";
else if (n>2)
{
cout<<fib1<<","<<fib2<<",";
fib3=fib1+fib2;
while(fib3<=n)
{
cout<<fib3<<",";
fib1=fib2;
fib2=fib3;
fib3=fib1+fib2;
}
}
else
cout<<"Invalid";
}
Exam Tips:
a) Each term is the sum of the previous two terms; this program prints the terms up to the given limit.
Question 207: Write a program to read a number and check whether the given number is an Armstrong number or not.
Answer:
#include <iostream>
using namespace std;
int main()
{
int n,m,rem,cube=0;
cout<<"Enter a number";
cin>>n;
m=n;
while(n)
{
rem=n%10;
cube=cube+rem*rem*rem;
n=n/10;
}
if(cube==m)
cout<<"The number "<<m<<" is Armstrong";
else
cout<<"The number "<<m<<" is not Armstrong";
}
Exam Tips:
a) An Armstrong number (of 3 digits) is equal to the sum of the cubes of its digits, e.g. 153 = 1 + 125 + 27.
Question 208: Distinguish between an entry controlled loop and an exit controlled loop.
Answer:
An entry controlled loop first checks the condition and executes (enters) the body of the loop only if the condition is true. An exit controlled loop first executes the body of the loop once, even if the condition is false, and then checks the condition. The for loop and while loop are entry controlled loops, but the do-while loop is an exit controlled loop.
Exam Tips:
a) Mention that an exit controlled loop runs at least once.
Question 209: Write a program to find the largest of 3 numbers.
Answer:
#include <iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"Enter three numbers";
cin>>a>>b>>c;
if (a>b && a>c)
cout<<a<<" is large";
else if (b>a && b>c)
cout<<b<<" is large";
else
cout<<c<<" is large";
}
Exam Tips:
a) Use the logical AND to compare a number with both the others.
Question 210: Check whether a given number is prime or not.
Answer:
#include <iostream>
using namespace std;
int main()
{
int n,i;
cout<<"Enter a number";
cin>>n;
for(i=2;i<=n/2;i++)
{
if(n%i==0)
{
cout<<n<<" is not a prime no.";
return 0;
}
}
cout<<n<<" is a prime";
}
Exam Tips:
a) A number is prime if it has no divisor from 2 up to half of the number.
Question 211: Write a program to read a number and display its factors.
Answer:
#include <iostream>
using namespace std;
int main()
{
int n,i;
cout<<"Enter a number greater than zero";
cin>>n;
cout<<"The factors are ";
for(i=1;i<=n;i++)
if(n%i==0)
cout<<i<<",";
}
Exam Tips:
a) i is a factor of n if n % i is 0.
Question 212: You are given the heights of 3 students. Write the relevant code segment to find the maximum height.
Answer:
#include <iostream>
using namespace std;
int main()
{
int h1,h2,h3,max;
cout<<"Enter height1:";
cin>>h1;
cout<<"Enter height2:";
cin>>h2;
cout<<"Enter height3:";
cin>>h3;
if(h1>h2 && h1>h3)
max=h1;
else if(h2>h1 && h2>h3)
max=h2;
else
max=h3;
cout<<"The maximum height is "<<max;
}
Exam Tips:
a) Compare each height with the other two using &&.
Question 213: Write the easiest code snippet for printing your name 1000 times. Explain.
Answer:
#include <iostream>
using namespace std;
int main()
{
int i;
char name[20];
cout<<"Enter your name: ";
cin>>name;
for(i=0;i<1000;i++)
cout<<name<<endl;
}
Exam Tips:
a) A loop that runs 1000 times is the easiest way; i runs from 0 to 999.
Question 214: Whenever a string is entered, its reverse is displayed (for example, if we enter 'CAR' the output is 'RAC'). Write a suitable program for this.
Answer:
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
int i,len;
char str[80];
puts("Enter a string :");
gets(str);
len=strlen(str);
for(i=len-1;i>=0;i--)
putchar(str[i]);
}
Exam Tips:
a) strlen() gives the length and the loop prints characters from the last one to the first.
Question 215: Write a C++ program to display the following:
A
A B
A B C
A B C D
A B C D E
Answer:
Program 1:
#include <iostream>
using namespace std;
int main()
{
char i,j;
for(i='A';i<'F';i++)
{
for(j='A';j<=i;j++)
cout<<j<<"\t";
cout<<endl;
}
}
Program 2 (using the ASCII values):
#include <iostream>
using namespace std;
int main()
{
int i,j;
for(i=65;i<70;i++)
{
for(j=65;j<=i;j++)
cout<<(char)j<<"\t";
cout<<endl;
}
}
Exam Tips:
a) The ASCII code of 'A' is 65, so the loop can also run from 65 to 69.
Question 216: The new line character is \n. When \n is used in a cout statement, the output does not contain the characters \n. Why did this happen? Explain.
Answer:
\n is a character constant and it is also known as an escape sequence. Escape sequences are used to represent non-graphic symbols such as the carriage return key (enter key), tab key, back space, space bar, etc. An escape sequence consists of a backslash symbol and one or more characters. It is not printed; it performs an action (here, moving to a new line).
| Escape sequence | Non-graphic character |
|---|---|
| \a | Audible bell |
| \b | Back space |
| \n | New line |
| \r | Carriage return |
| \t | Horizontal tab |
| \v | Vertical tab |
| \\ | To print \ |
| \' | To print ' |
| \" | To print " |
| \? | To print ? |
| \0 | Null character |
Exam Tips:
a) An escape sequence is not printed; it performs an action such as moving to a new line.
Question 217: 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 this happen? Write down the operator precedence in detail.
Answer:
The answer x = 23 is correct (Raju is right). This is because of the precedence of operators: multiplication has a higher priority than addition, so 3 * 6 = 18 is calculated first and then 5 + 18 = 23.
The order of precedence of operators (from highest to lowest) is:
| Priority | Operators |
|---|---|
| 1 (highest) | ++ (post increment), -- (post decrement) |
| 2 | ++ (pre increment), -- (pre decrement), sizeof, !, unary +, unary - |
| 3 | * (multiplication), / (division), % (modulus) |
| 4 | + (addition), - (subtraction) |
| 5 | <, <=, >, >= (relational operators) |
| 6 | ==, != (equality operators) |
| 7 | && (logical AND) |
| 8 | || (logical OR) |
| 9 | ?: (conditional operator) |
| 10 (lowest) | = (assignment operator) and short hand operators |
Exam Tips:
a) Write the answer 23 first and then explain with the precedence table.
Question 218: Rewrite the following code using while and do-while loops.
for(i=1;i<5;++i)
{
cout<<"\n"<<i;
}
Answer:
1. Using a while loop:
i=1;
while(i<5)
{
cout<<"\n"<<i;
i++;
}
2. Using a do-while loop:
i=1;
do
{
cout<<"\n"<<i;
i++;
}while(i<5);
Exam Tips:
a) Keep the same condition i<5 in all the loops.
Question 219: Rewrite the following C++ code using the switch statement.
if (choice=='S')
cout<<"Science";
else if (choice=='C')
cout<<"Commerce";
else if (choice=='H')
cout<<"Humanities";
else
cout<<"Invalid Option";
Answer:
switch(choice)
{
case 'S':
cout<<"Science";
break;
case 'C':
cout<<"Commerce";
break;
case 'H':
cout<<"Humanities";
break;
default:
cout<<"Invalid option";
}
Exam Tips:
a) Use default for the final else part and break at the end of each case.
Question 220: Consider the following code and predict the output:
int a=5, b=6, c=7;
if (a<b || b>c)
cout<<"\nOne";
if (a<b && b>c)
cout<<"\nTwo";
if (!(a>b))
cout<<"\nThree";
Answer:
Case 1: if (a<b || b>c) means 5<6 || 6>7, that is True || False = True. The condition is true, hence it prints One.
Case 2: if (a<b && b>c) means 5<6 && 6>7, that is True && False = False. The condition is false, hence it prints nothing.
Case 3: if (!(a>b)) means !(5>6) = !(False) = True. The condition is true, hence it prints Three.
The output is:
One
Three
Exam Tips:
a) Evaluate each condition separately and show the truth values.
Question 221: Match the following:
| Name | Symbol |
|---|---|
| Modulus operator | ++ |
| Logical operator | == |
| Relational operator | = |
| Assignment operator | ?: |
| Increment operator | % |
| Conditional operator | && |
Answer:
| Name | Symbol |
|---|---|
| Modulus operator | % |
| Logical operator | && |
| Relational operator | == |
| Assignment operator | = |
| Increment operator | ++ |
| Conditional operator | ?: |
Exam Tips:
a) Do not confuse = (assignment) with == (relational).
Question 222: Write a C++ program to calculate the simple interest SI by accepting the principal amount P, the rate of interest R and the number of years N, using the equation SI = PNR/100.
Answer:
#include <iostream>
using namespace std;
int main()
{
float P,N,R,SI;
cout<<"Enter the Principal amount";
cin>>P;
cout<<"Enter the number of years";
cin>>N;
cout<<"Enter the rate of interest";
cin>>R;
SI=P*N*R/100;
cout<<"Simple interest is "<<SI;
}
Exam Tips:
a) Declare the variables as float so that fractional results are not lost.
Question 223: Rewrite the following conditional statement using the 'if' statement in C++.
min=(a<b) ? (a<c ? a : c) : (b<c ? b : c);
Answer:
if(a<b && a<c)
min=a;
else if(b<c)
min=b;
else
min=c;
Exam Tips:
a) Check each of the three numbers against the other two.
Five Mark Questions and Answers
Question 224: Define 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 (<<) operators: These are used to perform input and output operations. Example: cin>>n; cout<<n;
2. Arithmetic operators: These are binary operators used to perform addition (+), subtraction (-), division (/), multiplication (*) and modulus (% - gives the remainder). Example: if x=10 and y=3, then
| x+y | x-y | x*y | x/y | x%y |
|---|---|---|---|---|
| 13 | 7 | 30 | 3 | 1 |
Here 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 also 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<y | x<=y | x>y | x>=y | x==y | x!=y |
|---|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0 | 1 |
4. Logical operators: AND (&&) and OR (||) are binary operators and NOT (!) is a unary operator. They are used to combine relational operations and give either true (1) or false (0). If x=1 and y=0, then
| x && x | x && y | y && x | y && y |
|---|---|---|---|
| 1 | 0 | 0 | 0 |
For AND (&&), both operands must be true to get a true value.
| x || x | x || y | y || x | y || y |
|---|---|---|---|
| 1 | 1 | 1 | 0 |
For OR (||), at least one of the operands must be true to get a true value.
| !x | !y |
|---|---|
| 0 | 1 |
5. Conditional operator: It is a ternary operator, so it needs three operands. The operator is ?: Syntax: expression ? value if true : value if false. First the expression is evaluated; if it is true, the second part is executed, otherwise the third part. Example: if x=10 and y=3, then x>y ? cout<<x : cout<<y; gives the output 10.
6. sizeof(): This operator is used to find the size used by each data type. Example: sizeof(int) gives 2 (in the syllabus compiler).
7. Increment and decrement operators: These are unary operators. The increment operator (++) increases the value of a variable by one, i.e. x++ is equivalent to x=x+1. The decrement operator (--) decreases the value of a variable by one, i.e. x-- is equivalent to 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 the variable x.
Exam Tips:
a) Define an operator first and then explain each kind with an example.
b) Remember how many operands each kind needs: unary 1, binary 2, ternary 3.
Question 225: A list of data items is given below:
45, 8.432, M, 0.124, 8, 0, 8.1 x 1031, 1010, a, 0.00025, 9.2 x 10120, 0471, -846, 342.123E03
1. Categorise the given data under proper headings of the 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.
| int | float | double | char | void |
|---|---|---|---|---|
| 45 8 0 1010 0471 -846 | 8.432 0.124 0.00025 342.123E03 8.1 x 1031 | 9.2 x 10120 | M a | No sample data is given |
2. Features of each data type:
(i) int data type: It is used to store whole numbers without a fractional (decimal point) part. It can be either negative or positive. In the syllabus (Turbo C++) it takes 2 bytes (16 bits) and we can store a number from -32768 to +32767; with a 4-byte int (32 bits), as in newer compilers, the range is -231 to +231-1.
(ii) char data type: It stores any symbol from the keyboard, for example 'A', '?', '9'. It takes one byte (8 bits) of memory. It is internally treated as an integer, so 28 = 256 characters can be represented. Each character has an ASCII code; 'a' has the ASCII code 97 and '0' has the ASCII code 48.
(iii) float data type: It is used to store real numbers, i.e. numbers with a decimal point. It uses 4 bytes (32 bits) of memory. Examples: 67.89, 89.9E-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 that returns nothing. No sample data is given for this type.
Exam Tips:
a) Make a table of the five types and the data under each.
b) Write the memory size of each type.
Question 226: Write valid reasons after reading the following statements in C++ and comment on their correctness:
1. char num = 66;
2. char num = 'B';
3. 35 and 35L are different
4. The numbers 14, 016 and 0xE are one and the same
5. The char data type is often said to be an integer type
6. To store the value 4.15, the float data type is preferred over double
Answer:
1. Correct. The ASCII number of B is 66, so char num = 66; stores the character 'B'.
2. Correct. It is equivalent to the first statement, since 'B' has the ASCII value 66.
3. Correct. 35 is of integer type but 35L is of long type.
4. Correct. The decimal number 14 is 016 in octal and 0xE in hexadecimal.
5. Correct. Internally, the char data type stores ASCII numbers, which are integers.
6. Correct. To store 4.15, float is better, because float requires only 4 bytes while double needs 8 bytes, so memory is saved.
Exam Tips:
a) Give a reason for every statement; the reason carries the marks.
Question 227: Suggest the most suitable derived data types in C++ for storing the following data items or statements:
1. Ages 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. Prices 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) The derived data types are array, function, pointer, reference, structure, class and so on.
Question 228: 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 the execution of the expression i += i-- + --i will be ______
Answer:
1. 3
2. False
3. False (++k makes k = 9, so 9 <= 8 is false)
4. 2 (++x makes x = 3, so 10 * 3 = 30 and 30 % 7 = 2)
5. 5 (m = (n=3, 8-3) = (n=3, 5); the comma operator gives the last value, so m = 5)
6. 32. Here i = 12. In i += i-- + --i, the post decrement i-- uses the value 12 and then i becomes 11. Then --i makes i = 10 before use, so the right side is 12 + 10 = 22. So i = 10 + 22 = 32.
Exam Tips:
a) Show the steps for each part.
b) In the last part, the post decrement has higher priority than the pre decrement. (Such expressions are compiler dependent; follow the textbook method.)
Question 229: 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. The 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 (the sizeof operator)
2. False (the conditional operator has 3 operands)
3. True
4. False (the logical NOT operator ! is unary)
5. False (multiple assignment is possible, e.g. a=b=c=...=5)
6. True
Exam Tips:
a) Always give a one-line reason for each.
Question 230: Match the following numbers and data types in C++ to form the most suitable pairs:
| Number | Data type |
|---|---|
| 1. 142789 | a. Signed |
| 2. 240 | b. Double |
| 3. -150 | c. Long int |
| 4. 8.4 x 10-4000 | d. Float |
| 5. 0 | e. Long double |
| 6. 0.0008 | f. Unsigned short |
| 7. -127 | g. Short int |
| 8. 2.8 x 10308 | h. Signed char |
Answer:
1. 142789 – c. Long int
2. 240 – g. Short int
3. -150 – a. Signed
4. 8.4 x 10-4000 – e. Long double
5. 0 – f. Unsigned short
6. 0.0008 – d. Float
7. -127 – h. Signed char
8. 2.8 x 10308 – b. Double
Exam Tips:
a) Think about the range of each type; numbers beyond 32767 need long, and very large or very small real numbers need double or long double.
Question 231: Rewrite the following code using the if else if ladder.
#include <iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter a number in between 1-7";
cin>>n;
switch(n)
{
case 1: cout<<"Sunday";break;
case 2: cout<<"Monday";break;
case 3: cout<<"Tuesday";break;
case 4: cout<<"Wednesday";break;
case 5: cout<<"Thursday";break;
case 6: cout<<"Friday";break;
case 7: cout<<"Saturday";break;
default: cout<<"Invalid";
}
}
Answer:
#include <iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter a number in between 1-7:";
cin>>n;
if(n==1)
cout<<"Sunday";
else if(n==2)
cout<<"Monday";
else if(n==3)
cout<<"Tuesday";
else if(n==4)
cout<<"Wednesday";
else if(n==5)
cout<<"Thursday";
else if(n==6)
cout<<"Friday";
else if(n==7)
cout<<"Saturday";
else
cout<<"Invalid";
}
Exam Tips:
a) Each case becomes an 'else if (n==value)' and default becomes the final else.
Question 232: Consider the following code:
#include <iostream>
using namespace std;
int main()
{
int mark;
cout<<"Enter a mark";
cin>>mark;
if(mark>=75)
cout<<"Distinction";
else if (mark>=60)
cout<<"First class";
else if (mark>=50)
cout<<"Second class";
else if (mark>=40)
cout<<"Passed";
else
cout<<"Failed";
}
Is it possible to rewrite the above program using the switch statement? Distinguish between switch and the if else if ladder.
Answer:
No. It is not possible to write the above code using the switch statement. The following are the differences between switch and the if else if ladder:
1. switch can test only for equality, but if can evaluate a relational or logical expression.
2. if else is more versatile.
3. if else can handle floating-point values but switch cannot.
4. If the test expression contains more variables, if else is used.
5. When a value is tested against a set of constants, switch is more efficient than if else.
Exam Tips:
a) Give the reason why the program cannot use switch: the conditions are ranges (relational expressions).
Question 233: Write down the code for the following output using a while loop.
*
* *
* * *
* * * *
Answer:
#include <iostream>
using namespace std;
int main()
{
int i,j;
i=1;
while(i<=4)
{
j=1;
while(j<=i)
{
cout<<"* ";
j++;
}
i++;
cout<<endl;
}
}
Exam Tips:
a) Use a nested while loop; initialise j inside the outer loop so it restarts for each row.
Question 234: "We know that the execution of a program is sequential." Is it possible to change this sequential manner? Explain the different jump statements in detail.
Answer:
The execution of a program is sequential, but we can change this sequential manner by using jump statements. The jump statements are:
1. goto statement: By using goto we can transfer the control anywhere in the program without any condition. Syntax: goto label;
Example:
#include <iostream>
using namespace std;
int main()
{
float a,b;
cout<<"Enter 2 numbers";
cin>>a>>b;
if(b==0)
goto end;
cout<<"The quotient is "<<a/b;
return 0;
end: cout<<"Division by zero error";
}
2. break statement: It is used to skip over a part of the code, i.e. to exit prematurely from a loop such as while, do-while, for or switch.
Syntax:
while (expression)
{
if (condition)
break;
}
Example:
#include <iostream>
using namespace std;
int main()
{
int i=1;
while(i<10)
{
cout<<i<<endl;
if(i==5)
break;
i++;
}
}
The output is 1 2 3 4 5 (each on a new line).
3. continue statement: It bypasses one iteration of the loop.
Syntax:
while (expression)
{
if (condition)
continue;
}
Example:
#include <iostream>
using namespace std;
int main()
{
int i=0;
while(i<10)
{
i++;
if(i==5)
continue;
cout<<i<<endl;
}
}
The output is 1 2 3 4 6 7 8 9 10 (each on a new line); the value 5 is skipped.
4. exit(0) function: It is used to terminate the program. For this, the header file cstdlib must be included.
Exam Tips:
a) Explain each of the four jump statements with syntax and an example.
b) Remember that break leaves the loop, while continue only skips one iteration.
Question 235: Write a program to print the prime numbers less than 100.
Answer:
#include <iostream>
using namespace std;
int main()
{
int i,j=4;
cout<<"The prime numbers less than 100 are given below\n2,3,";
while(j<=100)
{
for(i=2;i<=j/2;i++)
if(j%i==0)
break;
if(i==j/2+1)
cout<<j<<",";
j++;
}
}
Exam Tips:
a) The loop for(i=2; i<=j/2; i++) tests all possible divisors; if none divides j, the loop ends with i = j/2 + 1.
b) This program prints 2 and 3 first and starts testing from 4.
Question 236: Write a program to print the Armstrong numbers less than 1000.
Answer:
#include <iostream>
using namespace std;
int main()
{
int n,i,rem,cube;
for(i=1;i<1000;i++)
{
n=i;
cube=0;
while(n)
{
rem=n%10;
cube=cube+rem*rem*rem;
n=n/10;
}
if(cube==i)
cout<<i<<",";
}
}
Exam Tips:
a) Reset n and cube for every value of i.
b) The Armstrong numbers (sum of cubes of digits) less than 1000 are 1, 153, 370, 371 and 407.
Question 237: Given the total mark of each student in the SSLC examination, write a C++ code fragment to find the grades.
Answer:
#include <iostream>
using namespace std;
int main()
{
int mark;
cout<<"Enter total mark";
cin>>mark;
if (mark>100 || mark<0)
cout<<"Invalid mark";
else
{
if (mark>=90)
cout<<"Your grade is A+";
else if (mark>=80)
cout<<"Your grade is A";
else if (mark>=70)
cout<<"Your grade is B+";
else if (mark>=60)
cout<<"Your grade is B";
else if (mark>=50)
cout<<"Your grade is C+";
else if (mark>=40)
cout<<"Your grade is C";
else if (mark>=30)
cout<<"Your grade is D+";
else
cout<<"Your grade is D";
}
}
Exam Tips:
a) First check for an invalid mark, then use an if else if ladder from the highest grade to the lowest.
Question 238: You are about to study the fundamentals of the C++ programming language. Do a comparative study of the basics of the new language with that of a natural language like English or Malayalam to familiarise yourself with C++. Provide sufficient explanations for the compared items in the C++ language.
Answer:
Character set: To study a language, first we have to become familiar with its character set. For example, to study the English language, first we study the alphabets. Similarly, the C++ character set includes letters (A to Z and a to z), digits (0 to 9), special characters (+, -, ?, *, /, etc.) and white spaces (non-printable characters).
Token: It is the smallest individual unit, similar to a word in English or Malayalam. C++ has 5 tokens:
1. Keywords: These are reserved words for the compiler. We cannot use them for any other purpose. Example: float is used to declare a variable to store numbers with a decimal point.
2. Identifiers: These are user-defined words. Examples: variable name, function name, class name, object name, etc.
3. Literals (constants): Their values do not change during execution. Example: in Maths, pi = 3.14157 and the boiling point of water is 100.
4. Punctuators: In English or Malayalam, punctuation marks are used to increase readability, but here they are used to separate the tokens. Examples: { } ( ) , ;
5. Operators: These are symbols used to perform an operation (arithmetic, relational, logical, etc.).
Exam Tips:
a) Compare each C++ element with its counterpart in a natural language: alphabet = character set, word = token, punctuation = punctuators.
b) List the five tokens.
Question 239: 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 data type: It is used to store whole numbers without a fractional (decimal point) part. It can be either negative or positive. It takes 2 bytes (16 bits) of memory, i.e. 216 = 65536 numbers. We can store a number from -32768 to +32767. Example: Roll no and Age in the data above.
2. char data type: It stores any symbol from the keyboard, for example 'A', '9'. It takes one byte (8 bits) of memory. It is internally treated as an integer, i.e. 28 = 256 characters. Each character has an ASCII code; 'a' has the ASCII code 97 and '0' has the ASCII code 48. The Name above can be stored as a character array.
3. float data type: It is used to store real numbers, i.e. numbers with a decimal point. It uses 4 bytes (32 bits) of memory. Examples: 67.89, 89.9E-15. The Weight above is a float value.
4. double data type: It is used to store very large real numbers. It uses 8 bytes (64 bits) of memory.
5. void data type: void means nothing. It is used to represent a function that returns nothing.
Exam Tips:
a) Write the memory size and the range for each type.
b) Relate each data item in the question to a data type.
Question 240: Explain the conditional statements in detail.
Answer:
1. Simple if: Syntax:
if (expression)
statement;
or
if (expression)
{
Block of statements
}
First the expression is evaluated; only if it is true is the statement executed. Example:
if (n>0)
cout<<n<<" is positive";
2. if else: Syntax:
if (expression)
statement block 1;
else
statement block 2;
First the expression is evaluated. If it is true, statement block 1 is executed, otherwise statement block 2 is executed. Only one block is executed at a time, so it is called a branching statement. Example:
if (n>0)
cout<<n<<" is positive";
else
cout<<n<<" is negative";
3. if else if ladder: Syntax:
if (expression 1)
{
statement block 1;
}
else if (expression 2)
{
statement block 2;
}
else if (expression 3)
{
statement block 3;
}
.....
else
{
statement block n;
}
First expression 1 is evaluated; if it is true, only statement block 1 is executed. Otherwise expression 2 is evaluated; if it is true, only statement block 2 is executed, and so on. If all the expressions are false, only the last statement block n is executed. Example:
if(mark>=90)
cout<<"Your grade is A+";
else if (mark>=80)
cout<<"Your grade is A";
else if (mark>=70)
cout<<"Your grade is B+";
else if (mark>=60)
cout<<"Your grade is B";
else if (mark>=50)
cout<<"Your grade is C+";
else if (mark>=40)
cout<<"Your grade is C";
else if (mark>=30)
cout<<"Your grade is D+";
else
cout<<"Your grade is D";
4. Conditional operator: It is a ternary operator and an alternative to the if else construct. Syntax: expression 1 ? expression 2 : expression 3; or expression 1 ? value if true : value if false; Expression 1 is evaluated; if it is true, expression 2 is executed, otherwise expression 3. Example:
n>0 ? cout<<n<<" is positive" : cout<<n<<" is negative";
5. switch: It is a multiple branch statement. Syntax:
switch(expression)
{
case value: statements; break;
case value: statements; break;
case value: statements; break;
......
default : statements;
}
First the expression is evaluated and the statements with the matching case value are executed. Example:
switch(n)
{
case 1: cout<<"Sunday"; break;
case 2: cout<<"Monday"; break;
case 3: cout<<"Tuesday"; break;
case 4: cout<<"Wednesday"; break;
case 5: cout<<"Thursday"; break;
case 6: cout<<"Friday"; break;
case 7: cout<<"Saturday"; break;
default : cout<<"Invalid";
}
Exam Tips:
a) Give the syntax and one example for each of the five conditional statements.
Question 241: Explain the different loops in detail.
Answer:
1. for loop: The syntax of the for loop is:
for(initialisation; checking; update loop variable)
{
Body of loop;
}
First the initialisation is executed once. Then the checking is carried out; if it is true, the body of the for loop is executed. Then the loop variable is updated and the checking is carried out again. This process continues until the checking becomes false. It is an entry controlled loop.
Example:
for(i=1, j=1; i<=10; i++, j++)
cout<<i<<" * "<<j<<" = "<<i*j;
2. while loop: It is also an entry controlled loop. The syntax is:
Loop variable initialised
while(expression)
{
Body of the loop;
Update loop variable;
}
Here the loop variable must be initialised outside the while loop. Then the expression is evaluated; if it is true, only then is the body of the loop executed, and the loop variable must be updated inside the body. The body of the loop is executed until the expression becomes false.
Example:
i=1;
j=1;
while(i<=10)
{
cout<<i<<" * "<<j<<" = "<<i*j;
i++;
j++;
}
3. do-while loop: It is an exit controlled loop. The syntax is:
do
{
Statements
}while(expression);
Here the body is executed at least once, even if the condition is false. After executing the body, the expression is checked; if it is false, the loop quits, otherwise the process continues.
Exam Tips:
a) Give the syntax of all three loops and say which are entry controlled and which are exit controlled.
Question 242: Write a program to find the simple interest and compound interest.
Answer:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
float p,n,r,si,ci;
cout<<"Enter the Principal amount";
cin>>p;
cout<<"Enter the number of years";
cin>>n;
cout<<"Enter the rate of interest";
cin>>r;
si=p*n*r/100;
ci=p*pow((1+r/100),n)-p;
cout<<"Simple interest is "<<si;
cout<<"\nThe compound interest is "<<ci;
}
Exam Tips:
a) Compound interest = P(1 + R/100)^N - P; use pow() from the header file cmath.
Question 243: Mr. X wants to get the output 9 when inputting 342 and 12 when inputting 651. Write the program and draw a suitable flowchart for X.
Answer:
The required output is the sum of the digits of the number (3 + 4 + 2 = 9 and 6 + 5 + 1 = 12).
Flowchart:
Program:
#include <iostream>
using namespace std;
int main()
{
int n,rem,sum=0;
cout<<"Enter a number";
cin>>n;
while(n)
{
rem=n%10;
sum=sum+rem;
n=n/10;
}
cout<<"The sum of digits is "<<sum;
}
Exam Tips:
a) First find the rule that connects the input and the output.
b) n % 10 gives the last digit and n / 10 removes it.
Question 244: Differentiate the break and continue statements with suitable examples.
Answer:
1. break statement: It is used to skip over a part of the code, i.e. to exit prematurely from a loop such as while, do-while, for or switch.
Syntax:
while (expression)
{
if (condition)
break;
}
Example:
#include <iostream>
using namespace std;
int main()
{
int i=1;
while(i<10)
{
cout<<i<<endl;
if(i==5)
break;
i++;
}
}
The output is 1 2 3 4 5 (each on a new line).
2. continue statement: It bypasses one iteration of the loop.
Syntax:
while (expression)
{
if (condition)
continue;
}
Example:
#include <iostream>
using namespace std;
int main()
{
int i=0;
while(i<10)
{
i++;
if(i==5)
continue;
cout<<i<<endl;
}
}
The output is 1 2 3 4 6 7 8 9 10 (each on a new line); the value 5 is skipped.
Exam Tips:
a) Give the difference in one line: break ends the loop, continue skips only one iteration.
Question 245: Write a C++ program to get the following output.
1
2 3
4 5 6
7 8 9 10
Answer:
#include <iostream>
using namespace std;
int main()
{
int i,j,k=1;
for(i=1;i<5;i++)
{
for(j=1;j<=i;j++)
cout<<k++<<" ";
cout<<endl;
}
}
Exam Tips:
a) Use a counter k that increases after every print: k++ prints the current value and then increments it.
Free study material for Computer Application
Free Kerala Board Textbook Explanations: Class 12 Computer Application Chapter 01 Review of C++ Programming
Accessing Chapter 01 Review of C++ Programming Solutions
Review comprehensive exercise answers for Class 12 Computer Application Chapter 01 Review of C++ Programming. Fully updated to match current Kerala Board syllabus guidelines, these textbook solutions help students verify their work and maintain accurate study notes.
Concept-Driven Answers for Class 12 Computer Application
Each solution includes detailed reasoning to foster genuine comprehension of Chapter 01 Review of C++ Programming concepts. Reviewing these step-by-step breakdowns allows learners to master both analytical and descriptive questions expected in school evaluations.
Maximizing Study Efficiency
Frequent review of these structured answers builds strong analytical capabilities and response efficiency. Maximize your academic readiness by combining these textbook solutions with our curated study materials and mock evaluations for Class 12 Computer Application.
FAQs
The complete and updated Kerala Plus Two Computer Application Chapter 1 Review of C++ Programming Questions and Answers is available for free on StudiesToday.com. These solutions for Class 12 Computer Application are as per latest Kerala Board curriculum.
Yes, our experts have revised the Kerala Plus Two Computer Application Chapter 1 Review of C++ Programming Questions and Answers as per 2026 exam pattern. All textbook exercises have been solved and have added explanation about how the Computer Application concepts are applied in case-study and assertion-reasoning questions.
Toppers recommend using Kerala Board language because Kerala Board marking schemes are strictly based on textbook definitions. Our Kerala Plus Two Computer Application Chapter 1 Review of C++ Programming Questions and Answers will help students to get full marks in the theory paper.
Yes, we provide bilingual support for Class 12 Computer Application. You can access Kerala Plus Two Computer Application Chapter 1 Review of C++ Programming Questions and Answers in both English and Hindi medium.
Yes, you can download the entire Kerala Plus Two Computer Application Chapter 1 Review of C++ Programming Questions and Answers in printable PDF format for offline study on any device.