A. variable = variable operator expression.
B. var operator expression.
C. expression operator variable.
D. variable operator = expression.
Shorthands simplify the coding of a certain type of assignment statement. Example: a+=143; is equal to a=a +143;
A. removing type.
B. is same as type conversion.
C. implicit conversion.
D. explicit conversion of an operand to specific type.
A explicit type conversion is user-defined that forces an expression to be of specific type. Itis done as (type) expression.
A. conversion of int into signed int.
B. conversion of int into unsigned int
C. user defined.
D. compiler defined.
The explicit conversion of an operand to a specific type is called type casting.
A. 24
B. 18
C. 12
D. 20
The statement a=b*3+k+8-b+6/8; will assign the value 12 in the variable a. Hence, the output of the code will be 12.
A. float ft=25.345;
B. char ch=’b’;
C. float avg=sum/count;
D. int a=15;
In dynamically initialized Statement assignment statement is part of the declaration
A. arithmetic.
B. relational.
C. arithmetic and relational.
D. arithmetic,relational, logical, compound etc.
5>6 || 5 <6
A. operators.
B. constants.
C. variables.
D. all of the above.
An expression is a sequence of operators, operands and constants. An expression is evaluated to produce the result.
A. operator.
B. operand.
C. expression.
D. functions.
Unary means one. These operators perform on one operand. Eg a= -16 means a=16
A. integral promotion.
B. type casting.
C. type promotion.
D. type conversion.
Conversion of all operands up to the type of largest operand is called Type promotion. In type promotion, the compiler automatically expands the binary representation of objects of integer or floating-point types. Type promotions are commonly used with types smaller than the native type of the targeted element.
A. arithmetic constants.
B. real variables
C. constants
D. integer operators.
Literals are the most obvious kind of constants. They are the smallest unit of the program. In C++ literals are mainly classified into following types: Integer literal, Float literal , character literal and String literal.
A. only arithmetic.
B. only relational.
C. arithmetic and relational.
D. arithmetic, relational, logical, compound, etc.
Example of an expression: 5>6 || 5
A. fixed variable.
B. constant.
C. pointer.
D. operator.
Pointer is a variable that stores the reference to another variable.
A. two operands.
B. three operands.
C. one operand.
D. four operands.
It is a ternary operator, i.e., it requires three operands to operate on.
A variable refers to a storage area whose contents can vary during programming.Variables should be known to the program before being used.
Single line comments begin by // sign while multi line or block comments can be done using /*….*/.
for example
// This is C++ document
/* This is C++ document
Author name: XYZ */
Basic streams used in c++ are:
(1) istream(cin): - used for input.
(2) ostream(cout): - used for output.
< iostream.h > refers to a header file of iostream library which provides input and output functions. The header file Input/Output is included as these facilities are not defined within c++ language.They are implemented within a component of C++ standard liabrary.
It makes the function like main( ) finish and return a value. Returning 0 is the most usual way of telling that the program has terminated and has not found any errors.
These are the examples of Unary Operator:
++ Increment Operator- for incrementing the value.
-– decrement operator- for decrementing the value.
The operators that require two operands to operate upon are called as binary operator.
“marks” the size is 6, (5 for each character and 1 for special character '0' ).
A stream is a sequence of bytes and at lowest level,files are interpreted as stream of bytes.
Identifiers are the building blocks and they are used in general terminology. They are names given to different parts of a program, viz variables, objects, classes, functions, arrays etc.
Individual words in a passage of text, punctuation marks are called tokens. It is the smallest individual unit in a program.
Character set is a set of valid characters that a language can recognize.
A sequence of digits preceded by 0x or OX is taken to be an hexdecimal integer. Eg: 12 will be written as OXC in hexadecimal integer.
The suffix l or L and u or U attached to any constant forces it to be represented as a long and unsigned respectively.
Literals are also referred to as constants. They never change their value during program run. There are several kinds of literals in C++ eg:-integer-constant, character-constant.
Keywords are the words that convey a special meaning to the language compiler.They are reserved words for special purpose and must not be used as normal names. There are a large number of keywords. Eg: char, integer, double etc.
The C++ character set is-
1. Letters (A to Z, a to z ).
2. Digits (0 to 9).
3. Special Symbol (Space = + * - / ^ ( ) [ ] { } < > : ; “ ‘ , . ? | ! @ # $ % ^ & _ (underscore)).
4. White space, Blank space, Horizontal tab, Carriage return, New Line, form feed.
C++ can process 256 ASCII Characters as data or as String literal
The code is as follows:
cout<< "enter any number";
cin >> a;
cout << "the number entered is" << a;
i) Hash or pound sign missing in the 1st line.
ii) cout statement is within double quote (" ").
iii) return 0 should have a termination sign (;).
Compiler translates the correct program into object or assembly instruction text. This process of translation is called code generation.The program execution takes place after the code is generated.
a) Semantic error- This error occurs when statement are not meaningful. The word Semantic means a set of rules which give meaning to a statement.
Eg:-A+B=c;
Here, the expression A+B must be on the right side of the equal sign(=) and the right statement is c=A+B;
b) Data has associated data type.Eg the number 5 is an integer, ‘b’ is a Character constant and ‘Allah’ is a string. If a function is given a wrong data type, the compiler displays type error.
A. +,-,* and /
B. Expressions
C. Operands
D. Operators
Operators are the symbols that represents specific operations. Arithmetic operators carray out arithmetic for C++.
A. int
B. return
C. void
D. sizeof()
The sizeof() is a unary compile time operator that returns the length of a variable, array, object or a data type in bytes.
A. left-to-right sequence
B. right-to-left sequence
C. mid-to-right sequence
D. left-to-mid sequence
A comma operator is used to string together several expressions. The group of expressions separated by commas(,) is evaluated left-to-right in sequence and the result of the right most expression becomes the value of the total comma-separated expressions.
A. Arithmetic expression
B. Explicit conversion
C. Character expression
D. Implicit conversion
Arithmetic expression can either be integer expressions or real expressions. sometimes a mixed expression can also be formed which is a mixture of real and integer expressions.
A. strings together several expressions.
B. is not used in expressions.
C. may or may not be used between expressions.
D. styling tool.
In C++ programming languages, the comma operator is a binary operator that evaluates its first operand and discards the result, and then evaluates the second operand and returns this value. It is basically used to strings together several expressions.
A. not-or-and
B. and -not-or
C. or-and-not
D. not- and –or
The order of evaluation for logical operators is NOT (!) - AND(&&) –OR(||).
A. var =expression.
B. var
C.
var>expression.
D. var oper = expression.
C++ offers special shorthands to simplify simplify a certain type of assignment statements. The general form of is: var oper = expression
A. Single operand
B. Two operand
C. Multiple operand
D. zero operand
A unary operator requires a single operand. Unary +, Unary -, ++, --, sizeof etc. are some unary operators in C++.
A. 0 i.e, false
B. 1 i.e, true
C. 16
D. 15
After executing the statement i=15 ++i<=15; the value of i would be 0 i.e, false.
A.
26
B.
26
C.
25
25
D.
25
24
Such expressions are legal but confusing.
A. same as x=y.
B. x equal to y.
C. <> implies not equal to.
D. x not equal to y
The != is a relational operator which indicates not equal to. Therefore , the statement x !=y implies x not equal to y.
A. changing type.
B. integral promotion.
C. type promotion.
D. type conversion.
The process of converting one predefined type to another is called type casting.
A. removing type.
B. is same as type conversion.
C. implicit conversion.
D. changing an entity of a data type from one type to another.
Type casting is changing an entity of a data type from one type to another as per the need of program.
A. conversion of int into signed int.
B. conversion of int into unsigned int
C. is user defined
D. is compiler defined
Changing one type of value to another type is called type conversion. The explicit type conversion is done by the user as per the need of the program.
A. x/z+a-c
B. (c+b)*x/y+p*ab
C. p%q
D. (sqrt(b)*a)-g
A. (x>y)&&(c+d)>y
B. x In the statement: x<=z|b; one logical OR operator is missing therefore it is an invalid logical expression.
The correct expression will be: x<=z||b;
B. a higher precedence than logical operator. C. a lower precedence than ? D. higer precedence than ? ? is an alternate for if operator.
B. assignment statement. C. relational operators. D. unary operator. int a == 5 B. variable. C. expression. D. all of the above. a=5 or B. 7 and 6 C. 6 and 4 D. 4 and 6 Prefix implies first change the value of x and then use it in the expression B. the while loop is an exit condition loop. C. the test condition is always false. D. the test condition is always true. Here, the condition controlling the execution of the loop is always false. It will never be true.
B. the first statement after the loop. C. the statement following the continue statement. D. the next iteration of the loop. Continue statement ends the current iteration of a loop. Program control is passed from the continue statement to the end of the loop body and continue with next iteration.
B. a character constant expression and a colon. C. an integer constant expression and a semi-colon. D. a character constant expression and a semi-colon. A case label contains the word case followed by an integer constant expression and a colon. The value of each integer constant expression must represent a different value. B. case label, a case expression, a list of programs. C. font label an optional default label, a case expression, a list of statements. D. case label an optional default label, a case expression, a list of statements. switch statement is a selection statement that let us transfer control to different statements within the switch body depending on the value of the switch expression. If the value of the switch expression equals the value of one of the case expressions, the statements following that case expression are processed. If not, the default label statements, if any, are processed. B. switch ( expression ) statement switch. C. switch ( expression ) statement. D. switch (statement) expression. The switch statement executes one or more of a series of cases, based on the value of a controlling expression. The switch statement has the following syntax: switch (expression) statement. B. loop tests for static condition one time. C. loops are conditional statements. D. loops grab information from fields and display it. The loop variable can change in the loop to cause exit. Looping statements are statements that won't stop its process, unless it satisfies its condition, while selection statements will be executed if the input matches one of the selections. The selection that matches the input will be processed.
B. 100. C. 153. D. 257. The ANSI standard specifies that a switch can have upto 257 case statements. But, one must limit the number of case statements to a smaller amount for the sake of efficiency. B. true expression. C. test expression. D. initialization expression. The update expression is executed, at the end of the loop after the loop body is executed.
B. true expression. C. test expression. D. initialization expression. If the test expression evaluates to true,i.e.,1, the loop-body gets executed, otherwise the loop is terminated.
B. two. C. three. D. four. The initialization expression gives the loop variable their first value. The initialization expression is executed only once, in the beginning of the loop.
B. initialization expression, test expression, out expression and loop- body. C. initialization expression, test expression, date expression and loop-body. D. initialization expression, test expression, update expression and loop-body. Every loop has its elements that control and govern its execution. A loop has four elements that have different purposes. These elements are: initialization expression, test expression, update expression and loop-body.
B. loop body while(expression). C. while(loop body (expression)). D. loop body do-while (expression). The syntax is while (expression) loop-body. Here, the loop body may contain a single statement, a compound statement or an empty statement. While is entry dependant loop, due to which expression is defined before the body of the loop. B. container loop. C. eccentric loop. D. nested loop. A nested loop is a loop within a loop, an inner loop within the body of an outer one.
B. for and while-do. C. while and while-do. D. for, while and while-do. In an entry-control loop, the test expression is evaluated before executing the body of the loop,i.e., before entering into a loop. The for and while loops are the entry-control loops.
B. four. C. five. D. six. C++ provides four jump statements: return, goto, break and continue.
B. variable’s limit. C. variable’s scope. D. program’s scope. C++’s rule regarding variables access states that, a variable can be accessed only in the block where it has been declared.
B. getch. C. iostream.h. D. string.h. Input/Output facilities are not defined within the C++ language, rather are implemented through a component of C++ standard library, iostream.h. B. while loop. C. do-while loop. D. exit loop. Do-while is an exit-control loop in which the test expression is evaluated before exiting from the loop. B. entry control loop. C. end control loop. D. exit control loop. In an entry-control loop, the test expression is evaluated before executing the body of the loop, i.e., before entering into a loop.Based on its value, it is decided whether the loop will be executed or not. B. for( initialization expression: test expression: update expression). C. for( initialization expression, test expression, update expression). D. for( initialization expression/ test expression/ update expression). In a for loop, all its loop control elements are gathered at one place. In the syntax, semi-colons are used. B. a higher precedence than logical operator. C. a lower precedence than conditonal expression. D. higer precedence than conditional expression. conditional expression (?:) has higher precedence than assignment operators and comma operator. B. assignment statement. C. relational operators. D. unary operator. int a = 5;
Here a in an initialized variable. B. char ch='b'; C. float avg=sum/count; D. int a=15; Rest three statements are initialized with the constant expressions. Hence, static initialization. In float avg=sum/count; the values are assignede at run time. Hence, it is dynamic initialization. && and || are logical operators, whereas = is an assignment operator. B. operand. C. expression. D. functions. Unary means one. These operators perform on one operand. Eg a= -16 means a=16 B. binary compile time operator. C. unary run time operator. D. binary run time operator. sizeof() operator is a unary compile time operator that returns the length (in bytes) of the variable or parenthesized type specifier that it precedes. The correct precedence is
== (equal to)
!= (not equal to)
&& (logical AND)
|| (logical OR)
?: (conditional operator)
comma operator B. concatenation operator. C. comma operator. D. sizeof() operator. The group of expressions separated by comma operator are evaluated left-to-right in a sequence. According to the precedence of operators, logical not (!) come first, then logical AND (&&), and then logical OR (||). B. same values. C. constants. D. one is real and other is integer. ++1 is an increment operator and it is used in postfix sense here.Therefore value of abc will be incremented only after the operation has been performed. B. lvalue. C. stored. D. (l+r) values. Constant values or identifiers are rvalue. The rvalue represents the row value stored by a variable.
B. it is not important to make both types similar. C. int and double need not be changed. D. to avoid underflow. Casting refers to changing the one type of value into other data type. While casting, we should choose a type which is greater to avoid any kind of overflow.
The output of the following code would be :1 because the result of the && operator would be false (0) which is combined with the true value of || operator.
Hence, 0 || 1 would result in 1.
B. constant. C. pointer. D. an operator. The statement int *ab; represents a pointer declaration. The pointer declaration always starts with an asterisk(*) sign.
B. subtraction. C. parenthesis ( ). D. multiplication and division. The precedence rule of a language specify the order of operator evaluation when two or more operators with different precedence are adjacent in an expression.
The parenthesis operator has the highest precedence than the other operators given in the list.
B. uninitialized variable. C. assigned variable. D. an rvalue. Example:
int i;
Here i is uninitialized variable, since its value has not been initialized so far. B. fabs(). C. abs(). D. absolute(). Example fabs (-1.0) gives 1.0 B. (c+b)*/ x/y+p*ab C. p%a+- q D. (sqrt(-b)*a)-log(-g) Two operators cannot occur in continuation and logarithm of a negative number is not possible. The logical expressions are combination of constants, variables, logical and relational operators. B. explicit conversion. C. coversion of all operands upto the largest operand. D. implicit conversion. It is a step-by -step process. It occurs whenever a variable or expression of a smaller type is converted to larger type. Data Processing is evaluation of data by means of:- Converting an expression of a given type into another type is known as type-casting. Type- casting are of two types - (i) Implicit Type-casting (ii) Explicit Type-casting i) 0 ie false The logical NOT operator (!) works on single expression or operand. It is a unary operator. It negates or reverses the truth value of the expression. When an increment or decrement operators precedes its operand, it is in Prefix form. In this, C++ performs the increment or decrement operation before using it. The built in mathematical functions are stored in header file SOLUTION
A. a higher precedence than conditional operator.
SOLUTION
A. expression.
SOLUTION
A. constant.SOLUTION
int x = 5, y = 5;
cout << ++x << " " << --y
A. 5 and 5
SOLUTION
A. the logical operator && cannot be used with while statement.SOLUTION
A. return 0; statement.SOLUTION
A. an integer constant expression and a colon.SOLUTION
A. font label, an optional default label, a list of statements.SOLUTION
A. switch ( expression ) switch.SOLUTION
A. loops run until the exit condition is met.SOLUTION
A. 50.SOLUTION
A. update expression.SOLUTION
A. update expression.SOLUTION
A. one.SOLUTION
A. initialization expression, test expression, recover expression and loop- body.SOLUTION
A. while(expression) loop-body.SOLUTION
A. do-while loop.SOLUTION
A. for and while.SOLUTION
A. three.SOLUTION
A. program’s limit.SOLUTION
A. stdio.h.SOLUTION
A. for loop.SOLUTION
A. start control loop.SOLUTION
A. for( initialization expression; test expression; update expression).SOLUTION
A. a higher precedence than conditional expression.SOLUTION
A. expression.SOLUTION
A. float ft=25.345;SOLUTION
B. &&
C. = =
D. ||
Right Answer is: CSOLUTION
A. operator.SOLUTION
A. unary compile time operator.SOLUTION
A. ==, !=, &&, SOLUTION
A. addition operator.SOLUTION
B. &&, ||, !.
C. ||, !, &&.
D. &&, ||, !.
Right Answer is: DSOLUTION
A. different in values from each other.
SOLUTION
A. rvalue.SOLUTION
A. to avoid overflow.SOLUTION
a=3, b=6 , c=4 , d=2 ?
a+b>c && b-c < d SOLUTION
A. variable.SOLUTION
A. addition.SOLUTION
A. initialized variable.SOLUTION
A. absol().SOLUTION
A. x/z+a-cSOLUTION
A. salary<=3000 SOLUTION
A. process of converting one predefined type into another.SOLUTION
B. explicit conversion.
C. coversion of all operands upto the largest operand.
D. implicit conversion.
Right Answer is: SOLUTION
i) Mathmetical operators
ii) Relational and
iii) Logical Operators
B. explicit conversion.
C. coversion of all operands upto the largest operand.
D. implicit conversion.
Right Answer is: SOLUTION
i) ++j<=25
B. explicit conversion.
C. coversion of all operands upto the largest operand.
D. implicit conversion.
Right Answer is: SOLUTION
ii) 1 ie True
B. explicit conversion.
C. coversion of all operands upto the largest operand.
D. implicit conversion.
Right Answer is: SOLUTION
For example - if the expression is true, then !expression is false and vice versa.
B. explicit conversion.
C. coversion of all operands upto the largest operand.
D. implicit conversion.
Right Answer is: SOLUTION
B. explicit conversion.
C. coversion of all operands upto the largest operand.
D. implicit conversion.
Right Answer is: SOLUTION
i) Cout<< fee- - ;
ii) Cout<<++ fee ;