A. decimal form.
B. only in exponential form.
C. fractional or exponential form.
D. a string literals.
Real numbers contains fractional parts. These can be written in fractional form or exponent form.
A. 10
B. 2
C. 16
D. 8
The octal numeral system, or oct for short, is the base-8 number system, and uses the digits 0 to 7.
A. double quotation marks.
B. semicolon.
C. colon.
D. full stop.
The semicolon( ; ) is part of the syntax of C++. It tells the compiler that you're at the end of a command. Thus used for termination of statements.
A. sub class.
B. object.
C. a function name.
D. lastly executed.
main( )is executed when a program starts. It is the point where all C++ programs begin their execution.
A. commas.
B. octal integers.
C. real constants.
D. fractions.
Integer constants does not contain character or floating numbers. These are whole numbers without any fractional part.
A. multiple character surrounded by single quotes.
B. multiple characters surrounded by double quotes.
C. strings where as ‘ 0’ is not added.
D. none of the above.
A string literal is the representation of a string value within the source code of a computer program. A regular string literal consists of zero or more characters enclosed in double quotes, as in " hello ".
A. functions.
B. special characters.
C. reserved keywords.
D. special symbols.
Identifier are used to describe variables, classes, functions etc.
A. constants.
B. variables.
C. varying float numbers.
D. can change.
Literals are data items that never change their value during a program.
A. Keywords.
B. Identifiers, Literals.
C. Punctuators, operators.
D. Constants.
Keywords are reserved words for special purpose.
A. <<.
B. +.
C. ( )
D. &&.
( ) parenthesis evaluates first because of higher precedence.
A. token.
B. functions.
C. subclass.
D. Class
A token is the smallest element of a C++ program that is meaningful to the compiler.
A. not available in c++
B. available in c++
C. Not a part of C++
D. none of the above
Predefined data types are the fundamental data types, that are the part of C++.
The bitwise exclusive OR operator (^) compares each bit of its first operand to the corresponding bit of its second operand. If one bit is 0 and the other bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.
A. relational operator.
B. unary arithmetic operator.
C. increment operator.
D. binary arithmetic operator.
It produces the remainder on dividing the first by the second operand, which is an integer. Thus, two arguements are passed as an arguement to this operator.
A. 0.
B. 1.
C. 10.
D. 12.
Modulus operator produces the remainder on dividing the first by the second operand.
A. are unary operators.
B. are binary operators.
C. operate on many operators.
D. are ternary operators.
Increment ++ and decrement operators -- operate upon a single operand. they are known as Unary operators.
A. 120.
B. 121.
C. 122.
D. 124.
Pre-increment and post-increment operators increase the value of an operand by 1.
A. produces different results on different systems.
B. produces same results on different systems.
C. produces different results on same system.
D. is not implementation dependent.
Multiple use of these operators on the same operand is discouraged and is purely an implementation dependent.
A. an assignment operator.
B. a relational operator.
C. a comparison operator.
D. a unary operator.
= is used to assign a value. Example value=10 assigns 10 to value(variable).
A. an assignment operator.
B. a relational operator.
C. a conditional operator.
D. a unary operator.
== (equal to) is a comparison operator which is used in testing or comparing value. Example value==10 tests whether value is equal to 10 or not? This expression results in value 1 if the comparison is true, and 0 if it is false.
A. 1.
B. 2.
C. 3.
D. 4.
C++ provides three logical operators to combine existing expressions. These are || (logical OR), && (logical AND) and ! (logical NOT).
A. logical AND (&&) operator.
B. logical NOT (!) operator.
C. logical OR (
The logical AND operator combines two expressions into one. It returns true only when both its operands are true else it returns false. Example: 6>8 && 4>2 results into 0 (false) because the first expression is false.
In the above expression, first && operators executes, followed by ||. Thus, the result 1 is obtained which corresponds to true.
A. 0.
B. 1.
C. 2.
D. 4.
The modulus operator returns the remainder, when 22 is divided by 5, which is 2.
&& is having highest precedence among the following operators.
A. arithmetic > relational > logical > conditional > comma operator.
B. relational > conditional > comma operator > arithmetic > logical.
C. conditional > arithmetic > logical > comma operator > relational.
D. comma operator > arithmetic > logical > conditional > relational.
The operators are designed to perform the specific task. Higher precedence operators are evaluated first and then lower precedence ones.
A. type conversion.
B. typedef.
C. type expression.
D. integral promotion.
Constants and variables are mixed in an expression, then they are converted to same type. This is called type casting or type conversion.
A. conio.h
B. math.h
C. stdio.h
D. mathematical.h
Header files are included into a program source file by the "#include" preprocessor directive.
A. 60.
B. 70.
C. 75.
D. 80.
All the variables participating in the multiple assignment statement must be declared before.
A. x= / 2;
B. x= =/ 2;
C. x/ = 2;
D. 2 /= x ;
Shorthands simplify the code of a certain type of assignment statement.
A. “xyz” is the target variable and “a” can be a constant, variable or expression.
B. “a” is the target variable and “xyz” can be a constant, variable or expression.
C. “a” is the target variable and “xyz” is a constant always.
D. “a” is the target variable and “xyz” is a constant or variable only.
An assignment statement assigns a value to the variable. For Example - a=10;
A. x<= ! y && z.
B. (-y).
C. a+b > && z.
D. (x-y).
Two operators cannot occur in continuation.
A. x % 2 == 0.
B. x / 2 = 0.
C. x % 2 =0.
D. x / 2 == 0.
Modulus operator finds the remainder when one number is divided by another. A number is even if the remainder obtained on dividing it by 2 is 0.
A. exp <= 65 && exp >= 90.
B. exp >= 65
The ASCII codes for uppercase characters are from 65 to 90.
A. size of double.
B. sizeof(double).
C. size of double.
D. size (double).
sizeof operator returns the size of a variable or data type in bytes. The general format is sizeof(type), where type is a C++ data type.
A. size of answer.
B. size of (answer).
C. size of (long answer).
D. sizeof (answer).
sizeof operator returns the size of a variable or data type in bytes. The general format is sizeof(var) (where var is a declared variable).
A. NOT, OR, AND.
B. OR, AND, NOT.
C. AND, OR, NOT.
D. NOT, AND, OR.
NOT (!) operator has higher precedence than AND (&&) operator and OR (||) operator.
A. 3.
B. 5.
C. 7.
D. 6.
C++ provides 6 relational operators for comparing numbers and characters, which are <,>,<=,>=,!=,==.
A. 202.
B. 302.
C. 303.
D. 304.
Step wise process is a+ = 100+102, a+ = 202, a = 102 + 202 = 304.
A. as error.
B. 0.
C. 0.2.
D. 3.
Modulus operator requires two int operands and not the float ones.
A. expr1? expr2 ? expr3.
B. expr1: expr2 ? expr3.
C. expr1? expr2 ; expr3.
D. expr1? expr2 : expr3.
It gives the value of expr2 if expr1 evaluates to true otherwise it gives the value of expr3.
A. conditional operator.
B. logical AND operator.
C. logical NOT operator.
D. assignment operator.
Ternary operators require three operands. Relational and assignment operators are binary operators.
A. one.
B. two.
C. three.
D. four.
A binary operator requires two operands to operate upon.
A. increment operator.
B. size of operator.
C. relational operator.
D. arithmetic operator.
It can be used in 2 ways: size of var (where var is a declared variable) and size of type (where type is a C++ data type).
A. work with strings and numbers.
B. work with numbers, characters but not with strings.
C. not work with characters and strings.
D. work with numbers, characters and strings.
C++ provides 6 relational operators for comparing numbers and characters, but they don’t work with strings. If the comparison is true, they result into 1, else to 0 if the comparison is false.
A. binary operators.
B. unary operators.
C. modulus operators.
D. logical operators.
Arithmetic operators are binary in nature as they perform operations on two operands.
A. salary<5000
B. salary>=3000 && salary<=5000
C. salary >5000
D. salary<=3000 && salary>=5000
The logical expression to check salary range between 3000-5000 is salary>=3000 && salary<=5000. The AND ( &&) operator is used to result in true only when both conditions will satisfy.
A. An integer value
B. Float value
C. Char value
D. Address of a variable
A pointer is a variable that has the capability of hold address of another variable. It can't hold values, it only holds addresses.
A. x/divisor= = 2
B. x/2= 0
C. x%2= =0
D. x*2=even
The condition to check whether the value of variable "x" is even or not is: x%2= =0. The % is the remainder operator that is used to compare whether the value of variable x is divisible by 2 or not.
A. int
B. %
C. sizeof()
D. &&
The compile time operator sizeof() is a unary compile-time operator that returns the length of the variable in bytes. Example- cout << sizeof(int); The above statement will display output as 2.
A. Programmer
B. Compiler
C. By both programmer and compiler
D. User defined conversion
Implicit conversion is performed by compiler automatically without any intervention of user as per the standard conversion/promotion rule.
A. 300
B. 100
C. 250
D. 2500
val =2500; sale=val>1700?300:100; cout << sale; The output of the above expression will be 300 because the test condition of the ternary operator is false.
A. char.
B. float.
C. int.
D. long.
i) ’z’ is char and char is converted to an int.
The binary operators are:
1. Arithmetic Operators
2. Logical Operators3. Relational Operators
4. Conditional Operator
5. Shift Operators
a) Character constant must have one character that should be enclosed within single quotation marks, Eg ‘y’ , ‘n’ , ‘a’ etc.
b) String Literal is a sequence of characters surrounded by double quotes. It by default terminates with a special character ‘0’ which is a string character.
Eg: “Computer Science” is a string literal and it terminates as “Computer Science0”
Integer constants are whole numbers without any fractional part. They follow the following rules—
i) There must be atleast one digit
ii) Must not contain any decimal point.
iii) It may contain either a + or a – sign.
iv) A number with no sign is assumed to be positive.
v) No commas or blanks are allowed within an integer constant.
There are following tokens in C++:
i) Keywords
ii) Identifiers
iii) Literals
iv) Punctuators
v) Operators
A. 4.
B. 4.5.
C. 12.
D. 12.5.
Result of an integer division expression is always an integer.
A. 50.
B. true.
C. 51.
D. false.
Post increment operator first prints the value and then increments.
A. 20.
B. 21.
C. false.
D. true.
Pre increment operator first increments the value and then prints.
A. type casting.
B. type conversion.
C. type promotion.
D. integral promotion.
The sequence is long double, double, floats, unsigned long, long int, long and unsigned.
A. (ceil (p) + x ) z.
B. c/a +p * x / z.
C. log (-18) + x/ y.
D. a + b * c / d.
Logarithm of a negative number is not possible. So it is a domain error.
A. (sqrt (a) *b ) – c.
B. q (a + b- z /4 ).
C. a + b * c / d.
D. p / q + a – c.
Here, operator is missing between q and a.
A. (sqrt (a) *b ) – c.
B. a + b * c / d.
C. x + * r.
D. p / q + a – c.
Here, two operators are in continuation.
A. true true.
B. false true.
C. false false.
D. true false.
Pre increment operator firsts increments the value and then prints the value, whereas post increment operator first prints the value and then increment it.
A. 99 101.
B. 99 100.
C. 100 100.
D. 100 101.
Post decrement operator first prints the value , then decreases by 1,whereas pre increment operator first increases the value by 1 and then prints the value.
A. logical AND (&&) operator.
B. logical NOT (!) operator.
C. logical OR ( The logical OR operator combines the two expressions which make its operands.
B. prefix version. C. logical version. D. increment or decrement version. Postfix version comes after the operand. B. prefix version. C. logical version. D. increment or decrement version. Prefix version comes before the operand. B. func=100 is 3. C. func=100 is 100. D. func=100 is 0. = is assignment operator which assigns value. Don’t confuse it with == operator, which is a relational operator and compares value.
B. 100. C. func ==100 is 10. D. func ==100 is 0. == is a relational operator, which compares value and results in 1 if true and 0 if comparison is false. B. associate operations for handling it. C. operations for handling data. D. expressions. A data type identifying one of various types of data, as floating-point, boolean or integer. B. Small gift given as a rememberance. C. called Lexial Units or Lexial Elements. D. none of the above. C++ tokens (Lexical elements) are identifiers, keywords, literals, operators. It is the smallest element in a c++ program. B. within curly braces. C. within anglular brackets. D. There is no bracket at all. In C++ code is always written within curly braces { }. B. primitive data types. C. basic data types. D. fundamental data types. User-defined data types are formed from primitive data types. B. first. C. after multiplication and division. D. before addition and subtraction. According to hierarchy of precedence, parenthesis have more precedence than multiplication and division. B. reserved words. C. seperators. D. punctuators. They are predefined reserved identifiers that have special meaning. B. functions. C. subclass. D. class. Token as a smallest element of a C++ program, that is meaningful to the compiler. B. output( ) C. start ( ) D. main( ) main() is the entry point of any C++ program. B. Character constant. C. Hexadecimal integer constant. D. String Literal. To specify a hexadecimal integer constant, start the hexadecimal sequence with a 0 followed by the character X (or x ). Follow the X or x with one or more hexadecimal characters (the digits 0 to 9 and the upper or lowercase letters A to F. B. to send a newline character 'n' and then, flush the output buffer. C. it flushes the output buffer. D. to send a newline character 'n' but, does not flush the output buffer. 'n' and endl manipulator sends a new line character 'n' but endl also flushes the output buffer whereas, 'n' does not flush the output buffer. It stands console error. It is tied to standard error. Three bitwise operators are: (ii) ^ (bitwise exclusive OR also referred to as XOR) iii) | (Bitwise OR) Equal to (=) sign is used for: ii) As an Assignment operator in an expression. i) Comma is used in an argument list to seperate various elements of a list. ii) Semicolon is used for termination of statement. Input Operator is >> Logical errors produce incorrect output or undesired output when the syntax is correct. For example when we divide an integer value by 0 the result is not logical. It is a situation where logical error arises.
Following are the program errors: A compiler is a special program that processes statements written in a particular programming language and turns them into machine language. It analyses the program code for correctness. The IDEs (Integrated Development Environment) are text editors and provide facilities for typing, editing, searching, compiling etc. It is a main function of a program. All C++ programs begin their execution from main( ) function. The relational operators supported by C++ language are-
<
<=
>
>=
!=
==
B. 5.01 C. 5.3 D. 5.03 The output of a/b where a=15.9 and b=3 will be 5.3.
B. unary operators. C. modulus operators. D. logical operators. Arithmetic operators are Binary in nature as they perform operation on two operands. B. -k+y*y C. -z D. (amt+qnt*value)-bal Value can contain a decimal number eg. 5.75 (as Rs/-) B. three operands C. unary operand. D. four operand. The conditional operator ( ?: ) works on three operands that is why it is also called ternary operator.
B. integers. C. real constants/variable. D. all of the above. Expressions are the statements used to evaluate result. Mixed mode expressions are made up of integers , decimals , constants and variables.
B. integral promotion. C. type promotion. D. type conversion.SOLUTION
A. postfix version.SOLUTION
A. postfix version.SOLUTION
cout << “ func=100 is “ << func=10 << “ n” ;
A. func=100 is 10.SOLUTION
int func=3;
cout << “ func==100 is “ << func==10 << “ n” ;
A. func ==100 is 3.SOLUTION
A. type of data.SOLUTION
A. Used for change.SOLUTION
A. within square brackets.SOLUTION
A. user-defined data types.SOLUTION
A. last.SOLUTION
A. literals.SOLUTION
A. token.SOLUTION
A. enter( )SOLUTION
A. Integer.SOLUTION
A. same as 'n'.SOLUTION
B. to send a newline character 'n' and then, flush the output buffer.
C. it flushes the output buffer.
D. to send a newline character 'n' but, does not flush the output buffer.
Right Answer is: SOLUTION
B. to send a newline character 'n' and then, flush the output buffer.
C. it flushes the output buffer.
D. to send a newline character 'n' but, does not flush the output buffer.
Right Answer is: SOLUTION
(i) & (bitwise And)
B. to send a newline character 'n' and then, flush the output buffer.
C. it flushes the output buffer.
D. to send a newline character 'n' but, does not flush the output buffer.
Right Answer is: SOLUTION
i) Initialization of variables.
B. to send a newline character 'n' and then, flush the output buffer.
C. it flushes the output buffer.
D. to send a newline character 'n' but, does not flush the output buffer.
Right Answer is: SOLUTION
B. to send a newline character 'n' and then, flush the output buffer.
C. it flushes the output buffer.
D. to send a newline character 'n' but, does not flush the output buffer.
Right Answer is: SOLUTION
and
B. to send a newline character 'n' and then, flush the output buffer.
C. it flushes the output buffer.
D. to send a newline character 'n' but, does not flush the output buffer.
Right Answer is: SOLUTION
B. to send a newline character 'n' and then, flush the output buffer.
C. it flushes the output buffer.
D. to send a newline character 'n' but, does not flush the output buffer.
Right Answer is: SOLUTION
1. Syntax error
2. Semantic Error
3. Type errors
4. Run time errors
B. to send a newline character 'n' and then, flush the output buffer.
C. it flushes the output buffer.
D. to send a newline character 'n' but, does not flush the output buffer.
Right Answer is: SOLUTION
B. to send a newline character 'n' and then, flush the output buffer.
C. it flushes the output buffer.
D. to send a newline character 'n' but, does not flush the output buffer.
Right Answer is: SOLUTION
B. to send a newline character 'n' and then, flush the output buffer.
C. it flushes the output buffer.
D. to send a newline character 'n' but, does not flush the output buffer.
Right Answer is: SOLUTION
SOLUTION
A. 5.1SOLUTION
A. binary operators. SOLUTION
A. a%bSOLUTION
A. two operands.SOLUTION
A. combination of arithmetic operators.SOLUTION
A. casting.