Choose The Correct Answer<\/span><\/p>\nQuestion 1.
\nThe latest standard version published in December 2017 as ISO\/IEC …………….. which is informally known as C++ 17.
\n(a) 14882 : 1998
\n(b) 14883 : 2017
\n(c) 14882 : 2017
\n(d) 14882 : 2000
\nAnswer:
\n(c) 14882 : 2017<\/p>\n
Question 2.
\nC++ language was developed at ……………….
\na) Microsoft
\nb) Borland International
\nc) AT & T Bell Lab
\nd) Apple Corporation
\nAnswer:
\nc) AT & T Bell Lab<\/p>\n
Question 3.
\nAn integer constant is also called……………..
\n(a) fixed point constant
\n(b) floating-point constant
\n(c) real constants
\n(d) Boolean literals
\nAnswer:
\n(a) fixed point constant<\/p>\n
<\/p>\n
Question 4.
\nC++supports ………… programming paradigms.
\na) Procedural
\nb) Object-Oriented
\nc) Both A and B
\nd) None of these
\nAnswer:
\nc) Both A and B<\/p>\n
Question 5.
\n…………….. relational operators are binary operators.
\n(a) 7
\n(b) 8
\n(c) 6
\n(d) 2
\nAnswer:
\n(c) 6<\/p>\n
Question 6.
\nC++ is a superset (extension) of …………….. language.
\na) Ada
\nb) BCPL
\nc) Simula
\nd) C
\nAnswer:
\nd) C<\/p>\n
<\/p>\n
Question 7
\n…………….. used to label a statement.
\n(a) colon
\n(b) comma
\n(c) semicolon
\n(d) parenthesis
\nAnswer:
\n(a) colon<\/p>\n
Question 8.
\nThe name C++ was coined by …………….
\na) Lady Ada Lovelace
\nb) Rick Mascitti
\nc) Dennis Ritchie
\nd) Bill Gates
\nAnswer:
\nb) Rick Mascitti<\/p>\n
Question 9.
\nIDE stands for ……………..
\n(a) Integrated Development Environment
\n(b) International Development Environment
\n(c) Integrated Digital Environment
\n(d) None of the above
\nAnswer:
\n(a) Integrated Development Environment<\/p>\n
<\/p>\n
Question 10.
\nTill 1983, C++ was referred to as …………………
\na) New C
\nb) C with Classes
\nc) Both A and B
\nd) None of these
\nAnswer:
\nc) Both A and B<\/p>\n
Question 11.
\n…………….. data type signed more precision fractional value.
\n(a) char
\n(b) short
\n(c) long double
\n(d) signed doubles
\nAnswer:
\n(c) long double<\/p>\n
Question 12.
\nC# (C-Sharp), D, Java, and newer versions of C languages have been influenced by ………………. language.
\na) Ada
\nb) BCPL
\nc) Simula
\nd) C++
\nAnswer:
\nd) C++<\/p>\n
<\/p>\n
Question 13.
\n…………….. manipulator is the member of iomanip header file.
\n(a) setw
\n(b) setfill
\n(c) setf
\n(d) all the above
\nAnswer:
\n(d) all the above<\/p>\n
Question 14.
\nC++is ……………… language.
\na) Structural
\nb) Procedural
\nc) Object-oriented
\nd) None of these
\nAnswer:
\nc) Object-oriented<\/p>\n
Question 15.
\nC++ includes ………………..
\na) Classes and Inheritance
\nb) Polymorphism
\nc) Data abstraction and Encapsulation
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
<\/p>\n
Question 16.
\nC language does not allow ………………
\na) Exception handling
\nb) Inheritance
\nc) Function overloading
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
Question 17.
\n……………. is a set of characters which are allowed to write a C++ program.
\na) Character set
\nb) Tokens
\nc) Punctuators
\nd) None of these
\nAnswer:
\na) Character set<\/p>\n
Question 18.
\nA character represents any …………………..
\na) Alphabet
\nb) Number
\nc) Any other symbol (special characters)
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
<\/p>\n
Question 19.
\nMost of the Character set, Tokens, and expressions are very common to C based programming languages like ………………..
\na) C++
\nb) Java
\nc) PHP
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
Question 20.
\n…………… is a white space.
\na) Horizontal tab
\nb) Carriage return
\nc) Form feed
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
Question 21.
\nC++ program statements are constructed by many different small elements called……………….
\na) Lexical units
\nb) Lexical elements
\nc) Tokens
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
<\/p>\n
Question 22.
\n…………… is a C++token.
\na) Keywords
\nb) Identifiers and Literals
\nc) Punctuators and Operators
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
Question 23.
\nThe smallest individual unit in a program is known as a ……………
\na) Token
\nb) Lexical unit
\nc) Token or a Lexical unit
\nd) None of these
\nAnswer:
\nc) Token or a Lexical unit<\/p>\n
Question 24.
\n………………… are the reserved words which convey specific meaning to the C++ compiler.
\na) Keywords
\nb) Identifiers and Literals
\nc) Punctuators and Operators
\nd) All the above
\nAnswer:
\na) Keywords<\/p>\n
<\/p>\n
Question 25.
\n………………. are the essential elements to construct C++ programs.
\na) Keywords
\nb) Identifiers and Literals
\nc) Punctuators and Operators
\nd)All the above
\nAnswer:
\na) Keywords<\/p>\n
Question 26.
\nMost of the keywords are common to …………… languages.
\na) C, and C++
\nb) C++ and Java
\nc) C, C++ and Java
\nd) None of these
\nAnswer:
\nc) C, C++ and Java<\/p>\n
Question 27.
\n……………. is a case sensitive programming language.
\na) C, and C++
\nb) C++ and Java
\nc) C, C++ and Java
\nd) None of these
\nAnswer:
\nc) C, C++ and Java<\/p>\n
<\/p>\n
Question 28.
\nIn ……………. language, all the keywords must be in lowercase.
\na) C, and C++
\nb) C++ and Java
\nc) C, C++ and Java
\nd) None of these
\nAnswer:
\nc) C, C++ and Java<\/p>\n
Question 29.
\n……………… is a new keyword in C++.
\na) using
\nb) namespace
\nc) std
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
Question 30.
\n…………….. is a new keyword in C++.
\na) bal
\nb) static_cast
\nc) dynamic_cast
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
<\/p>\n
Question 31.
\n………….. is a new keyword in C++.
\na) true
\nb) false
\nc) Both A and B
\nc) None of these
\nAnswer:
\nc) None of these<\/p>\n
Question 32.
\nIdentifiers are the user-defined names given to …………..
\na) Variables and functions
\nb)Arrays
\nc) Classes
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
Question 33.
\nIdentifiers containing a …………. should be avoided by users.
\na) Double underscore
\nb) Underscore
\nc) number
\nd) None of these
\nAnswer:
\na) Double underscore<\/p>\n
<\/p>\n
Question 34.
\nThe first character of an identifier must be an ………….
\na) Alphabet
\nb) Underscore (_)
\nc) Alphabet or Underscore (_)
\nc) None of these
\nAnswer:
\nc) Alphabet or Underscore (_)<\/p>\n
Question 35.
\nOnly …………… is permitted for the variable name.
\na) Alphabets
\nb) Digits
\nc) Underscore
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
Question 36.
\nIdentify the correct statement from the following.
\na) C++ is case sensitive as it treats upper and lower-case characters differently.
\nb) Reserved words or keywords cannot be used as an identifier name.
\nc) As per ANSI standards, C++ places no limit on its length.
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
<\/p>\n
Question 37.
\nANSI stands for …………..
\na) All National Standards Institute
\nb) Advanced National Standards Institute
\nc) American National Standards Institute
\nd) None of these
\nAnswer:
\nc) American National Standards Institute<\/p>\n
Question 38.
\nIdentify the invalid variable name from the following.
\na) num-add
\nb) this
\nc) 2myfile
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
Question 39.
\nIdentify the odd one from the following.
\na) Int
\nb) _add
\nc) int
\nd) tail marks
\nAnswer:
\nc) int<\/p>\n
<\/p>\n
Question 40.
\n……………… are data items whose values do not change during the execution of a program.
\na) Literals
\nb) Constants
\nc) Identifiers
\nd) Both A and B
\nAnswer:
\nd) Both A and B<\/p>\n
Question 41.
\n…………. is a type constant in C++.
\na) Boolean constant
\nb) Character constant
\nc) String constant
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
Question 42.
\n…………… is a type of numeric constant.
\na) Fixed point constant
\nb) Floating-point constant
\nc) Both A and B
\nd) None of these
\nAnswer:
\nc) Both A and B<\/p>\n
<\/p>\n
Question 43.
\n……………. are whole numbers without any fractions.
\na) Integers
\nb) Real constant
\nc) Floating-point constant
\nd) None of these
\nAnswer:
\na) Integers<\/p>\n
Question 44.
\nIn C++, there are …………….. types of integer constants.
\na) Two
\nb) Three
\nc) Four
\nd) Six
\nAnswer:
\nb) Three<\/p>\n
Question 45.
\nIn C++, ……………… is a type of integer constant.
\na) Decimal
\nb) Octal
\nc) Hexadecimal
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
<\/p>\n
Question 46.
\nAny sequence of one or more digits (0 …. 9) is called ……………… integer constant.
\na) Decimal
\nb) Octal
\nc) Hexadecimal
\nd) All the above
\nAnswer:
\na) Decimal<\/p>\n
Question 47.
\nAny sequence of one or more octal values (0 …. 7) that begins with 0 is considered as a(n) …………… constant.
\na) Decimal
\nb) Octal
\nc) Hexadecimal
\nd) All the above
\nAnswer:
\nb) Octal<\/p>\n
Question 48.
\nWhen you use a fractional number that begins with 0, C++ has consider the number as ………………..
\na) An integer not an Octal
\nb) A floating-point not an Octal
\nc) An integer not a Hexadecimal
\nd) None of these
\nAnswer:
\na) An integer not an Octal<\/p>\n
<\/p>\n
Question 49.
\nAny sequence of one or more Hexadecimal values (0 …. 9, A …. F) that starts with Ox or OX is considered as a(n) ………….. constant.
\na) Decimal
\nb) Octal
\nc) Hexadecimal
\nd) All the above
\nAnswer:
\nc) Hexadecimal<\/p>\n
Question 50.
\nIdentify the invalid octal constant,
\na) 05,600
\nb) 04.56
\nc) 0158
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
Question 51.
\nIdentify the valid hexa decimal constant
\na) 0X1,A5
\nb) 0X.14E
\nc) CAFE
\nd) CPP
\nAnswer:
\nc) CAFE<\/p>\n
<\/p>\n
Question 52.
\nThe suffix ………….. added with any constant forces that to be represented as a long constant.
\na) L or I
\nb) U or u
\nc) LO
\nd) Lg
\nAnswer:
\na) L or I<\/p>\n
Question 53.
\nThe suffix …………… added with any constant forces that to be represented as an unsigned constant.
\na) L or I
\nb) U or u
\nc) US
\nd) us
\nAnswer:
\nb) U or u<\/p>\n
Question 54.
\nA _______ constant is a numeric constant having a fractional component.
\na) Real
\nb) Floating point
\nc) Real or Floating point
\nd) None of these
\nAnswer:
\nc) Real or Floating point<\/p>\n
<\/p>\n
Question 55.
\n……………. constants may be written in fractional form or in exponent form.
\na) Real
\nb) String
\nc) Character
\nd) Integer constant
\nAnswer:
\na) Real<\/p>\n
Question 56.
\nExponent form of real constants consists of ………….. parts.
\na) three
\nb) two
\nc) four
\nd) five
\nAnswer:
\nb) two<\/p>\n
Question 57.
\nExponent form of real constants consists of ……………. part.
\na) Mantissa
\nb) Exponent
\nc) Both A and B
\nd) None of these
\nAnswer:
\nc) Both A and B<\/p>\n
<\/p>\n
Question 58.
\nThe mantissa must be a(n) …………. constant.
\na) Integer
\nb) Real
\nc) Either A or B
\nd) None of these
\nAnswer:
\nc) Either A or B<\/p>\n
Question 59.
\n58.64 can be written as …………….
\na) 5.864E1
\nb) 0.5864E2
\nc) 5864E-2
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
Question 60.
\nInternally boolean true has value ……………
\na) 0
\nb) 1
\nc) -1
\nd) None of these
\nAnswer:
\nb) 1<\/p>\n
<\/p>\n
Question 61.
\nInternally boolean false has value …………….
\na) 0
\nb) 1
\nc) -1
\nd) None of these
\nAnswer:
\na) 0<\/p>\n
Question 62.
\nA character constant is any valid single character enclosed within ………….. quotes.
\na) Double
\nb) Single
\nc) No
\nd) None of these
\nAnswer:
\nb) Single<\/p>\n
Question 63.
\nIdentify the odd one from the following,
\na) ‘A’
\nb) ‘2’
\nc) ‘$’
\nd) “A”
\nAnswer:
\nd) “A”<\/p>\n
<\/p>\n
Question 64.
\nThe value of a single character constant has an equivalent ………….. value.
\na) BCD
\nb) ASCII
\nc) Nibble
\nd) None of these
\nAnswer:
\nb) ASCII<\/p>\n
Question 65.
\nThe ASCII value of ‘A’ is …………..
\na) 65
\nb) 97
\nc) 42
\nd) 75
\nAnswer:
\na) 65<\/p>\n
Question 66.
\nThe ASCII value of ‘a’ is ……………
\na) 65
\nb) 97
\nc) 42
\nd) 75
\nAnswer:
\nb) 97<\/p>\n
<\/p>\n
Question 67.
\nC++ allows certain non-printable characters represented as ……………. constants.
\na) Integer
\nb) Real
\nc) Character
\nd) String
\nAnswer:
\nc) Character<\/p>\n
Question 68.
\nThe non-printable characters can be represented by using …………………………
\na) Escape sequences
\nb) String
\nc) Boolean
\nd) None of these
\nAnswer:
\na) Escape sequences<\/p>\n
Question 69.
\nAn escape sequence is represented by a backslash followed by …………. character(s).
\na) One
\nb) Two
\nc) One or Two
\nd) None of these
\nAnswer:
\nc) One or Two<\/p>\n
<\/p>\n
Question 70.
\n______ is escape sequence for audible or alert bell.
\na) \\a
\nb)\\b
\nc) \\n
\nd)\\f
\nAnswer:
\na) \\a<\/p>\n
Question 71
\n_______ is escape sequence for backspace.
\na)\\a
\nb)\\b
\nc) \\n
\nd) \\f
\nAnswer:
\nb)\\b<\/p>\n
Question 72.
\n______ is escape sequence for form feed.
\na)\\a
\nb)\\b .
\nc) \\n
\nd) \\f
\nAnswer:
\nd) \\f<\/p>\n
<\/p>\n
Question 73.
\n______ is escape sequence for new line or line feed.
\na) a
\nb)\\b
\nc)\\n
\nd)\\f
\nAnswer:
\nc)\\n<\/p>\n
Question 74.
\n……………. is escape sequence for carriage return.
\na)\\r
\nb)\\c
\nc)\\n
\nd)\\cr
\nAnswer:
\na)\\r<\/p>\n
Question 75.
\n______ is escape sequence for horizontal tab.\u2019
\na)\\a \u2018
\nb)\\b
\nc)\\t
\nd)\\f
\nAnswer:
\nc)\\t<\/p>\n
<\/p>\n
Question 76.
\n_______ is escape sequence for vertical tab.
\na)\\v
\nb)\\b
\nc) \\t
\nd) \\f
\nAnswer:
\na)\\v<\/p>\n
Question 77.
\n………………. is escape sequence for octal number.
\na) \\On
\nb) \\xHn
\nc)\\O
\nd)O
\nAnswer:
\na) \\On<\/p>\n
Question 78.
\n______ is escape sequence for hexadecimal number.
\na) \\On
\nb) \\xHn
\nc)\\O
\nd)\\O
\nAnswer:
\nb) \\xHn<\/p>\n
<\/p>\n
Question 79
\n______ \u00a1s escape sequence for Null character.
\na) \\On
\nb) \\xHn
\nc)\\O
\nd)\\n
\nAnswer:
\nc)\\O<\/p>\n
Question 80.
\n______ \u00a1s escape sequence for Inserting?
\na) \\?
\nb) \\\\
\nc)\\\u2019
\nd)\\\u201d
\nAnswer:
\na) \\?<\/p>\n
Question 81.
\n______ is an escape sequence for inserting a single quote.
\na)\\?
\nb)\\\\
\nc) \\\u2018
\nd) \\\u201c
\nAnswer:
\nc) \\\u2018<\/p>\n
<\/p>\n
Question 82.
\n______ is escape sequence for inserting double quote.
\na)\\?
\nb)\\\\
\nc) \\\u2018
\nd) \\\u201c
\nAnswer:
\nd) \\\u201c<\/p>\n
Question 83.
\n______ is escape sequence for inserting
\na)\\?\u2019
\nb)\\\\
\nc) \\\u2018
\nd) \\\u201c
\nAnswer:
\nb)\\\\<\/p>\n
Question 84.
\nASCII was first developed and published in 1963 by the …………. Committee, a part of the American Standards Association (ASA).
\na) X3
\nb) A3
\nc) ASA
\nd) None of these
\nAnswer:
\na) X3<\/p>\n
<\/p>\n
Question 85.
\nSequence of characters enclosed within ………. quotes are called as String literals,
\na) Single
\nb) Double
\nc) No
\nd) None of these
\nAnswer:
\nb) Double<\/p>\n
Question 86.
\nBy default, string literals are automatically added with a special character………..at the end.
\na) ‘\\0’ (Null)
\nb) ‘\\S’
\nc) V
\nd) None of these
\nAnswer:
\na) ‘\\0’ (Null)<\/p>\n
Question 87.
\nIdentify the valid string constant from the following.
\na) “A”
\nb) “Welcome”
\nc) “1234”
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
<\/p>\n
Question 88.
\nThe symbols which are used, to do some mathematical or logical operations are called as ………………
\nb) Operands
\nd) None of these
\na) Operators
\nc) Expressions
\nAnswer:
\na) Operators<\/p>\n
Question 89.
\nThe data items or values that the operators act upon are called as ……………
\na) Operators
\nb) Operands
\nc) Expressions
\nd) None of these
\nAnswer:
\nb) Operands<\/p>\n
Question 90.
\nIn C++, the operators are classified as ………… types on the basis of the number of operands,
\na) two
\nb) three
\nc) four ,
\nd) five
\nAnswer:
\nb) three<\/p>\n
<\/p>\n
Question 91.
\n………….. operators require only one operand.
\na) Unary
\nb) Binary
\nc) Ternary
\nd) None of these
\nAnswer:
\na) Unary<\/p>\n
Question 92.
\n…………… operators require two operands.
\na) Unary
\nb) Binary
\nc) Ternary
\nd) None of these
\nAnswer:
\nb) Binary<\/p>\n
Question 93.
\n………… operators require three operands.
\na) Unary
\nb) Binary
\nc) Ternary
\nd) None of these
\nAnswer:
\nc) Ternary<\/p>\n
<\/p>\n
Question 94.
\nC++ operators are classified as …………… types
\na) 7
\nb) 3
\nc) 10
\nd) 4
\nAnswer:
\na) 7<\/p>\n
Question 95.
\n…………… operators perform simple operations like addition, subtraction, multiplication, division etc.
\na) Logical
\nb) Relational
\nc) Arithmetic
\nd) Bitwise
\nAnswer:
\nc) Arithmetic<\/p>\n
Question 96.
\n…………… operator is used to find the remainder of a division.
\na) \/
\nb) %
\nc) *
\nd) **
\nAnswer:
\nb) %<\/p>\n
<\/p>\n
Question 97.
\n…………….. operator is called as Modulus operator.
\na) \/
\nb)%
\nc) *
\nd) **
\nAnswer:
\nb)%<\/p>\n
Question 98.
\nAn increment or decrement operator acts upon a …………….. operand and returns a new value,
\na) Single
\nb) Two
\nc) Three
\nd) None of these
\nAnswer:
\na) Single<\/p>\n
Question 99.
\n………….. is a unary operator.
\na) ++
\nb) \u2014
\nc) Both ++ and —
\nd) None of these
\nAnswer:
\nc) Both ++ and —<\/p>\n
<\/p>\n
Question 100.
\nThe increment operator adds …………….. to its operand.
\na) 1
\nb) 0\\
\nc) -1
\nd) None of these
\nAnswer:
\na) 1<\/p>\n
Question 101.
\nThe decrement operator subtracts …………… from its operand.
\na) 1
\nb) 0\\
\nc) -1
\nd) None of these
\nAnswer:
\na) 1<\/p>\n
Question 102.
\nThe …………….. operators can be placed either as prefix (before) or as postfix (after) to a variable.
\na) ++
\nb) –
\nc) ++or–
\nd) None of these
\nAnswer:
\nc) ++or–<\/p>\n
<\/p>\n
Question 103.
\nWith the prefix version, C++ performs the increment\/decrement………….. using the operand.
\na) Before
\nb) After
\nc) When required
\nd) None of these
\nAnswer:
\na) Before<\/p>\n
Question 104.
\nWith the postfix version, C++ performs the increment\/decrement…………….. using the operand.
\na) Before
\nb) After
\nc) When required
\nd) None of these
\nAnswer:
\nb) After<\/p>\n
Question 105.
\nWith the postfix version, C++ uses the value of the operand in evaluating the expression …………… incrementing \/decrementing its present value.
\na) Before
\nb) After
\nc) When required
\nd) None of these
\nAnswer:
\na) Before<\/p>\n
<\/p>\n
Question 106.
\n……………… operators are used to determining the relationship between its operands.
\na) Logical
\nb) Relational
\nc) Arithmetic
\nd) Bitwise
\nAnswer:
\nb) Relational<\/p>\n
Question 107.
\nWhen the relational operators are applied on two operands, the result will be a …………… value.
\na) Boolean
\nb) Numeric
\nc) Character
\nd) String
\nAnswer:
\na) Boolean<\/p>\n
Question 108.
\nC++ provides …………. relational operators.
\na) Seven
\nb) six
\nc) Eight
\nd) Five
\nAnswer:
\nb) six<\/p>\n
<\/p>\n
Question 109.
\nAll six relational operators are ……………
\na) Unary
\nb) Binary
\nc) Ternary
\nd) None of these
\nAnswer:
\nb) Binary<\/p>\n
Question 110.
\nA logical operator is used to evaluate …………… expressions.
\na) Logical and Relational
\nb) Logical
\nc) Relational
\nd) None of these
\nAnswer:
\na) Logical and Relational<\/p>\n
Question 111.
\nWhich logical operator returns 1 (True), if both expressions are true, otherwise it returns 0 (false)?
\na) AND
\nb) OR
\nc) NOT
\nd) All the above
\nAnswer:
\na) AND<\/p>\n
<\/p>\n
Question 112.
\nWhich logical operator returns 1 (True) if either one of the expressions is true. It returns 0 (false) if both the expressions are false?
\na) AND
\nb) OR
\nc) NOT
\nd) All the above
\nAnswer:
\nb) OR<\/p>\n
Question 113.
\nWhich logical operator simply negates or inverts the true value?
\na) AND
\nb) OR
\nc) NOT
\nd) All the above
\nAnswer:
\nc) NOT<\/p>\n
Question 114.
\nAND, OR both are ……………. operators.
\na) Unary
\nb) Binary
\nc) Ternary
\nd) None of these
\nAnswer:
\nb) Binary<\/p>\n
<\/p>\n
Question 115.
\nNOT is a(n) …………… operator.
\na) Unary
\nb) Binary
\nc) Ternary
\nd) None of these
\nAnswer:
\na) Unary<\/p>\n
Question 116.
\nIdentify the correct statement from the following.
\na) The logical operators act upon the operands that are themselves called logical expressions.
\nb) Bitwise operators work on each bit of data and perform the bit-by-bit operations.
\nc) There are two bitwise shift operators in C++, Shift left (<<) & Shift right (>>).
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
Question 117.
\nIn C++, there are …………… kinds of bitwise operator.
\na) Three
\nb) Four
\nc) Two
\nd) Five
\nAnswer:
\na) Three<\/p>\n
Question 118.
\n…………. is a type of bitwise operator.
\na) Logical bitwise operators
\nb) Bitwise shift operators
\nc) One’s compliment operators
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
<\/p>\n
Question 119.
\n______ will return 1 (True) if both the operands are having the value 1 (True); Otherwise, it will return 0 (False).
\na) Bitwise AND (&) .
\nb) Bitwise OR (|)
\nc) Bitwise Exclusive OR(A)
\nd) None of these
\nAnswer:
\na) Bitwise AND (&)<\/p>\n
Question 120.
\n………… will return 1 (True) if any one of the operands is having a value 1 (True); It returns 0 (False) if both the operands are having the value 0 (False)
\na) Bitwise AND (&)
\nb) Bitwise OR (|)
\nc) Bitwise Exclusive OR(A)
\nd) None of these
\nAnswer:
\nb) Bitwise OR (|)<\/p>\n
Question 121.
\n…………. will return 1 (True) if only one of the operand is having a value 1 (True).If both are True or both are False, it will return 0 (False).
\na) Bitwise AND (&)
\nb) Bitwise OR (|)
\nc) Bitwise Exclusive OR(A)
\nd) None of these
\nAnswer:
\nc) Bitwise Exclusive OR(A)<\/p>\n
<\/p>\n
Question 122.
\nThere are …………… bitwise shift operators in C++.
\na) Three
\nb) Two
\nc) Four
\nd) Five
\nAnswer:
\nb) Two<\/p>\n
Question 123.
\n……………. is a type of * .wise shift operator in
\nC++.
\na) Shift left
\nb) Shift right
\nc) Both A and B
\nd) None of these
\nAnswer:
\nc) Both A and B<\/p>\n
Question 124.
\n……………. is a type of bitwise shift left operator in C++.
\na) <<
\nb) >>
\nc) &&
\nd) ||
\nAnswer:
\na) <<<\/p>\n
<\/p>\n
Question 125.
\n…………. is a type of bitwise shift right operator in C++.
\na) <<
\nb) >>
\nc) &&
\nd) ||
\nAnswer:
\nb) >><\/p>\n
Question 126.
\nThe value of the left operand is moved to the left by the number of bits specified by the right operand using …………. operator.
\na) <<
\nb) >>
\nc) &&
\nd) ||
\nAnswer:
\na) <<<\/p>\n
Question 127.
\nThe value of the left operand is moved to right by the number of bits specified by the right operand using …………. operator.
\na) <<
\nb) >>
\nc) &&
\nd) ||
\nAnswer:
\nb) >><\/p>\n
<\/p>\n
Question 128.
\nRight operand should be an unsigned integer for …………… operator.
\na) Arithmetic
\nb) Relational
\nc) Bitwise Shift
\nd) None of these
\nAnswer:
\nc) Bitwise Shift<\/p>\n
Question 129.
\n………… is the bitwise one’s complement operator.
\na) <<
\nb) >>
\nc) &&
\nd) ~
\nAnswer:
\nd) ~<\/p>\n
Question 130.
\nThe bitwise ………….. operator inverts all the bits in a binary pattern, that is, all l’s become 0 and all 0’s become 1.
\na) Shift left
\nb) Shift right
\nc) One’s complement
\nd) None of these
\nAnswer:
\nc) One’s complement<\/p>\n
<\/p>\n
Question 131.
\n…………… is a unary operator.
\na) Shift left
\nb) Shift right
\nc) Bitwise one’s complement
\nd) None of these
\nAnswer:
\nc) Bitwise one’s complement<\/p>\n
Question 132.
\n………….. operator is used to assigning a value to a variable which is on the left-hand side of an assignment statement.
\na) Assignment
\nb) Logical
\nc) Bitwise
\nd) Conditional
\nAnswer:
\na) Assignment<\/p>\n
Question 133.
\n…………. is commonly used as the assignment operator in all computer programming languages.
\na) :=
\nb) ==
\nc) =
\nd) None of these
\nAnswer:
\nc) =<\/p>\n
<\/p>\n
Question 134.
\n…………… operator copies the value at the right side of the operator to the left side variable,
\na) Assignment
\nb) Logical
\nc) Bitwise
\nd) Conditional
\nAnswer:
\na) Assignment<\/p>\n
Question 135.
\nThe assignment operator is a(n) ……………….. operator.
\na) Unary
\nb) Binary
\nc) Ternary
\nd) Conditional
\nAnswer:
\nb) Binary<\/p>\n
Question 136.
\nHow many conditional operators are used in C++?
\na) one
\nb) two
\nc) three
\nd) four
\nAnswer:
\na) one<\/p>\n
<\/p>\n
Question 137.
\n…………….. operator is a Ternary Operator.
\na) Assignment
\nb) Logical
\nc) Bitwise
\nd) Conditional
\nAnswer:
\nd) Conditional<\/p>\n
Question 138.
\n…………… operator is used as an alternative to if … else control statement.
\na) Assignment
\nb) Logical
\nc) Bitwise
\nd) Conditional
\nAnswer:
\nd) Conditional<\/p>\n
Question 139.
\n……………. is a pointer to a variable operator.
\na) &
\nb) *
\nc) \u2192
\nd) \u2192 *
\nAnswer:
\nb) *<\/p>\n
<\/p>\n
Question 140.
\n…………… is an address operator.
\na) &
\nb) *
\nc) \u2192
\nd) \u2192*
\nAnswer:
\na) &<\/p>\n
Question 141.
\n……………. is a direct component selector operator.
\na) .(dot)
\nb) *
\nc) \u2192
\nd) \u2192*
\nAnswer:
\na) .(dot)<\/p>\n
Question 142.
\n…………… is an indirect component selector operator.
\na) .(dot)
\nb) *
\nc) \u2192
\nd) \u2192*
\nAnswer:
\nc) \u2192<\/p>\n
<\/p>\n
Question 143.
\n…………. is a dereference operator.
\na) . (dot)
\nb) .*
\nc) \u2192
\nd) \u2192*
\nAnswer:
\nb) .*<\/p>\n
Question 144.
\n……………… is a dereference pointer to class member operator.
\na) . (dot)
\nb) .*
\nc) \u2192
\nd) \u2192*
\nAnswer:
\nd) \u2192*<\/p>\n
Question 145.
\n……………. is a scope resolution operator.
\na) .(dot)
\nb) .*
\nc) : :
\nd) \u2192*
\nAnswer:
\nc) : :<\/p>\n
<\/p>\n
Question 146.
\nThe operands and the operators are grouped in a specific logical way for evaluation is called as………………
\na) Operator precedence
\nb) Operator association
\nc) Hierarchy
\nd) None of these
\nAnswer:
\nb) Operator association<\/p>\n
Question 147.
\nWhich operator is lower precedence?
\na) Arithmetic
\nb) Logical
\nc) Relational
\nd) None of these
\nAnswer:
\nb) Logical<\/p>\n
Question 148.
\nWhich operator is higher precedence?
\na) Arithmetic
\nb) Logical
\nc) Relational
\nd) None of these
\nAnswer:
\na) Arithmetic<\/p>\n
<\/p>\n
Question 149.
\nWhich operator is the lowest precedence?
\na) Assignment
\nb) Comma
\nc) Conditional
\nd) Arithmetic
\nAnswer:
\nb) Comma<\/p>\n
Question 150.
\nIn C++, asterisk ( * ) is used for ……………… purpose.
\na) Multiplication
\nb) Pointer to a variable
\nc) Both A and B
\nd) None of these
\nAnswer:
\nc) Both A and B<\/p>\n
Question 151.
\n……………. punctuator indicates the start and the end of a block of code.
\na) Curly bracket { }
\nb) Paranthesis ()
\nc) Sqaure bracket [ ]
\nd) Angle bracket < >
\nAnswer:
\na) Curly bracket { }<\/p>\n
<\/p>\n
Question 152.
\n……………. punctuator indicates function calls and function parameters.
\na) Curly bracket { }
\nb) Paranthesis ()
\nc) Square bracket [ ]
\nd) Angle bracket < >
\nAnswer:
\nb) Paranthesis ()<\/p>\n
Question 153.
\n……………. punctuator indicates single and multidimensional arrays.
\na) Curly bracket { }
\nb) Paranthesis ()
\nc) Square bracket [ ]
\nd) Angle bracket < >
\nAnswer:
\nc) Square bracket [ ]<\/p>\n
Question 154.
\n……………… punctuator is used as a separator in an expression.
\na) Comma,
\nb) Semicolon;
\nc) Colon :
\nd) None of these
\nAnswer:
\na) Comma,<\/p>\n
<\/p>\n
Question 155.
\nEvery executable statement in C++ should terminate with a ………..
\na) Comma,
\nb) Semicolon;
\nc) Colon:
\nd) None of these
\nAnswer:
\nb) Semicolon;<\/p>\n
Question 156.
\n……………… punctuator is used to label a statement.
\na) Comma,
\nb) Semicolon;
\nc) Colon:
\nd) None of these
\nAnswer:
\nc) Colon:<\/p>\n
Question 157.
\n………….. is a single line comment.
\na) \/I
\nb) \/* ……..*\/
\nc) \\\\
\nd) None of these
\nAnswer:
\na) \/I<\/p>\n
<\/p>\n
Question 158.
\n……………… is a multi line comment.
\na) \/\/
\nb) \/* *\/
\nc) \\\\
\nd) None of these
\nAnswer:
\nb) \/* *\/<\/p>\n
Question 159.
\nC++ provides the operator to get input. .
\na) >>
\nb) <<
\nc) ||
\nd) &&
\nAnswer:
\na) >><\/p>\n
Question 160.
\n…………….. operator extracts the value through the keyboard and assigns it to the variable on its right.
\na) >>
\nb) <<
\nc) ||
\nd) &&
\nAnswer:
\na) >><\/p>\n
<\/p>\n
Question 161.
\n………………. operator is called as “Stream extraction” or “get from” operator.
\na) >>
\nb) <<
\nc) ||
\nd) &&
\nAnswer:
\na) >><\/p>\n
<\/p>\n
Question 162.
\nGet from operator requires …………….. operands.
\na) three
\nb) two
\nc) four
\nd) five
\nAnswer:
\nb) two<\/p>\n
Question 163.
\n…………….. is the operand of get from the operator.
\na) Predefined identifier cin
\nb) Variable
\nc) Both A and B
\nd) None of these
\nAnswer:
\nc) Both A and B<\/p>\n
Question 164.
\nTo receive or extract more than one value at a time ………… operator should be used for each variable.
\na) >>
\nb) <<
\nc) ||
\nd) &&
\nAnswer:
\na) >><\/p>\n
<\/p>\n
Question 165.
\n……………. is called cascading of operator.
\na) >>
\nb) <<
\nc) 11 .
\nd) Both A and B
\nAnswer:
\nd) Both A and B<\/p>\n
Question 166.
\nC++ provides …………… operator to perform output operation. a) >>
\nb) <<
\nc) ||
\nd) &&
\nAnswer:
\nb) <<<\/p>\n
Question 167.
\nThe operator ………….. is called the “Stream insertion” or “put to” operator.
\na) >>
\nb) <<
\nc) ||
\nd) &&
\nAnswer:
\nb) <<<\/p>\n
<\/p>\n
Question 168.
\n…………… operator is used to send the strings or values of the variables on its right to the object on its left. a) >>
\nb) <<
\nc) ||
\nd) &&
\nAnswer:
\nb) <<<\/p>\n
Question 169.
\nThe second operand of put to operator may be a …………….
\na) Constant
\nb) Variable
\nc) Expression
\nd) Either A or B or C
\nAnswer:
\nd) Either A or B or C<\/p>\n
Question 170.
\nTo send more than one value at a time …………… operator should be used for each constant\/ variable\/expression.
\na) >>
\nb) <<
\nc) ||
\nd) &&
\nAnswer:
\na) >><\/p>\n
<\/p>\n
Question 171.
\nThe compiler ignores …………… statement.
\na) Comment
\nb) Input
\nc) Output
\nd) Assignment
\nAnswer:
\na) Comment<\/p>\n
Question 172.
\nUsually all C++ programs begin with include statements starting with a ……………… symbol.
\na) $
\nb) #
\nc) {
\nd) %
\nAnswer:
\nb) #<\/p>\n
Question 173.
\nThe symbol …………… is a directive for the preprocessor.
\na) $
\nb) #
\nc) {
\nd) %
\nAnswer:
\nb) #<\/p>\n
<\/p>\n
Question 174.
\n_____ means, statements are processed before the compilation process begins.
\na) Preprocessor
\nb) Include
\nc) Header file
\nd) None of these
\nAnswer:
\na) Preprocessor<\/p>\n
Question 175.
\nThe header file ……………… should include in every C++ program to implement input\/output functionalities.
\na) iostream
\nb) stdio
\nc) conio
\nd) math
\nAnswer:
\na) iostream<\/p>\n
Question 176.
\n………….. header file contains the definition of its member objects cin and cout.
\na) iostream
\nb) stdio
\nc) conio
\nd) math
\nAnswer:
\na) iostream<\/p>\n
<\/p>\n
Question 177.
\nNamespace collects identifiers used for …………..
\na) Class
\nb) Object
\nc) Variables
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
Question 178.
\n…………….. provides a method of preventing name conflicts in large projects.
\na) namespace
\nb) header files
\nc) include
\nd) None of these
\nAnswer:
\na) namespace<\/p>\n
Question 179.
\nEvery C++ program must have a …………… function.
\na) user defined
\nb) main( )
\nc) Library .
\nd) None of these
\nAnswer:
\nb) main( )<\/p>\n
<\/p>\n
Question 180.
\nThe …………….. function is the starting point where all C++ programs begin their execution.
\na) user-defined
\nb) main ( )
\nc) Library
\nd) None of these
\nAnswer:
\nb) main ( )<\/p>\n
Question 181.
\nThe executable statements should be inside the ………… function.
\na) user-defined
\nb) main ( )
\nc) Library
\nd) None of these
\nAnswer:
\nb) main ( )<\/p>\n
Question 182.
\nThe statements between the …………… braces are executable statements.
\na) Curly bracket { }
\nb) Paranthesis ()
\nc) Square bracket [ ]
\nd) Angle bracket < >
\nAnswer:
\na) Curly bracket { }<\/p>\n
<\/p>\n
Question 183.
\nFor creating and executing a C++ program, one must follow ……………. important steps.
\na) two
\nb) three
\nc) five
\nd) four
\nAnswer:
\nd) four<\/p>\n
Question 184.
\nFor creating and executing a C++ program, one must follow ……….. step.
\na) Creating source code and save with .cpp extension
\nb) Compilation
\nc) Execution
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
Question 185.
\n………………. links the library files with the source code and verifies each and every line of code.
\na) Interpreter
\nb) Compiler
\nc) Loader
\nd) Assembler
\nAnswer:
\nb) Compiler<\/p>\n
<\/p>\n
Question 186.
\nIf there are no errors in the source code, …………… translates the source code into a machine-readable object file.
\na) Interpreter
\nb) Compiler
\nc) Loader
\nd) Assembler
\nAnswer:
\nb) Compiler<\/p>\n
Question 187.
\nThe compiler translates the source code into machine-readable object file with an extension…………..
\na) .cpp
\nb) .exe
\nc) .obj *
\nd) None of these
\nAnswer:
\nc) .obj *<\/p>\n
Question 188.
\nThe object file becomes an executable file with extension ……………
\na) .cpp
\nb) .exe
\nc) .obj
\nd) None of these
\nAnswer:
\nb) .exe<\/p>\n
<\/p>\n
Question 189.
\n………….. files can run without the help of any compiler or IDE.
\na) Source
\nb) Object
\nc) Executable
\nd) None of these
\nAnswer:
\nc) Executable<\/p>\n
Question 190.
\n…………… makes it easy to create, compile and execute a C++ program.
\na) Editors
\nb) IDE
\nc) Compilers
\nd) None of these
\nAnswer:
\nb) IDE<\/p>\n
Question 191.
\nIDE stands for …………….
\na) Integrated Development Environment
\nb) Integrated Design Environment
\nc) Instant Development Environment
\nd) Integral Development Environment
\nAnswer:
\na) Integrated Development Environment<\/p>\n
<\/p>\n
Question 192.
\n……………. is open-source C++ compiler.
\na) Dev C++ \/ Geany \/ Sky IDE
\nb) Code Lite \/ Code::blocks \/ Eclipse
\nc) Ner Beans \/ Digital Mars
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
Question 193.
\nDev C++ is written in …………
\na) Delphi
\nb) C++
\nc) C
\nd) Pascal
\nAnswer:
\na) Delphi<\/p>\n
Question 194.
\n………….. error is possible in C++.
\na) Syntax
\nb) Semantic
\nc) Run-time
\nd) All the above
\nAnswer:
\nd) All the above<\/p>\n
<\/p>\n
Question 195.
\n………….. error occurs because of some illegal operation that takes place.
\na) Syntax
\nb) Semantic
\nc) Run-time
\nd) All the above
\nAnswer:
\nc) Run-time<\/p>\n
Question 196.
\nSemantic error is called as ……………error.
\na) Syntax
\nb) Logic
\nc) Run-time
\nd) All the above
\nAnswer:
\nb) Logic<\/p>\n
Question 197.
\nIf a program tries to open a file which does not exist, it results in a …………. error.
\na) Syntax
\nb) Logic
\nc) Run-time
\nd) All the above
\nAnswer:
\nc) Run-time<\/p>\n
Question 198.
\n……………. errors occur when grammatical rules of C++are violated.
\na) Syntax
\nb) Logic
\nc) Run-time
\nd) All the above
\nAnswer:
\na) Syntax<\/p>\n
<\/p>\n
Very Short Answers (2 Marks)<\/span><\/p>\nQuestion 1.
\nMention any two benefits of C++.
\nAnswer:<\/p>\n
\n- C++ is a highly portable language and is often the language of choice for multi-device, multi-platform app development.<\/li>\n
- C++ is an object-oriented programming language and includes classes, inheritance, polymorphism, data abstraction, and encapsulation.<\/li>\n<\/ol>\n
Question 2.
\nWhat is a character?
\nAnswer:
\nA character represents any alphabet, number, or any other symbol (special characters) mostly available in the keyboard.<\/p>\n
Question 3.
\nWhat are the types of C++ operators based on the number of operands?
\nAnswer:
\nThe types of C++ operators based on the number of operands are:<\/p>\n
\n- Unary Operators – Require only one operand<\/li>\n
- Binary Operators – Require two operands<\/li>\n
- Ternary Operators – Require three operands<\/li>\n<\/ol>\n
<\/p>\n
Question 4.
\nWhat are the recent keywords included in C++?
\nAnswer:
\nThe recent list of keywords includes: using, namespace, bal, static_cast, const_cast, dynamic_cast, true, false.<\/p>\n
Question 5.
\nWhat is a stream extraction operator?
\nAnswer:
\nC++ provides the operator >> to get input. It extracts the value through the keyboard and assigns it to the variable on its right; hence, it is called as \u201cStream extraction\u201d or \u201cget from\u201d operator.<\/p>\n
Question 6.
\nWhy the following identifiers are invalid?
\na) num-add
\nb) this
\nc) 2myfile
\nAnswer:
\na) num-add – It contains spedal character (-) which \u00a1s not permitted
\nb) this – It is a keyword in C++. Keyword can not be used as identifier
\nc) 2myflle – Name must begin with an alphabet or an underscore.<\/p>\n
<\/p>\n
Question 7.
\nWhat are the main types of C++ datatypes?
\nAnswer:
\nIn C++, the data types are classified into three main categories<\/p>\n
\n- Fundamental data types<\/li>\n
- User-defined data types<\/li>\n
- Derived data types.<\/li>\n<\/ol>\n
Question 8.
\nWhat are Boolean literals?
\nAnswer:
\nBoolean literals are used to represent one of the Boolean values (True or false). Internally true has value 1 and false has value 0.<\/p>\n
Question 9.
\nWhat are string literals?
\nAnswer:
\nThe sequence of characters enclosed within double quotes is called String literals. By default, string literals are automatically added with a special character ‘\\0’ (Null) at the end. Valid string Literals: “A” “Welcome” “1234” Invalid String Literals : ‘Welcome’,’1234′<\/p>\n
<\/p>\n
Question 10.
\nDifferentiate Operators and Operands.
\nAnswer:
\nThe symbols which are used to do some mathematical or logical operations are called as Operators.
\nThe data items or values that the operators act upon are called as Operands.<\/p>\n
Question 11.
\nWhat are the classifications of C++ operators based on operand requirements?
\nAnswer:
\nIn C++, the operators are classified on the basis of the number of operands as follows:
\ni) Unary Operators – Require only one operand
\nii) Binary Operators – Require two operands
\niii) Ternary Operators – Require three operands<\/p>\n
Question 12.
\nList the C++ operators.
\nAnswer:
\nC++ Operators are classified as:<\/p>\n
\n- Arithmetic Operators<\/li>\n
- Relational Operators<\/li>\n
- Logical Operators<\/li>\n
- Bitwise Operators<\/li>\n
- Assignment Operators<\/li>\n
- Conditional Operator<\/li>\n
- Other Operators ,<\/li>\n<\/ul>\n
<\/p>\n
Question 13.
\nWrite note on increment and decrement operators.
\nAnswer:
\n++ (Plus, Plus) Increment operator
\n– (Minus, Minus) Decrement operator
\nAn increment or decrement operator acts upon a single operand and returns a new value. Thus, these operators are unary operators. The increment operator adds 1 to its operand and the decrement operator subtracts 1 from its operand.
\nExample:
\nx++ is the same as x = x+1; It adds 1 to the present value of x.
\nX– is the same as x = x\u20141; It subtracts 1 from the present value of x.<\/p>\n
Question 14.
\nWrite a note on bitwise operators.
\nAnswer:
\nBitwise operators work on each bit of data and perform the bit-by-bit operation.
\nIn C++, there are three kinds of bitwise operators, which are:<\/p>\n
\n- Logical bitwise operators<\/li>\n
- Bitwise shift operators<\/li>\n
- One’s compliment operator<\/li>\n<\/ul>\n
Question 15.
\nWrite about bitwise one’s compliment operator.
\nAnswer:
\nThe Bitwise one’s compliment operator:
\nThe bitwise One’s compliment operator ~(Tilde), inverts all the bits in a binary pattern, that is, all l’s become 0 and all 0’s become 1. This is a unary operator.
\nExample:
\nIf a = 15; Equivalent binary values of a is 0000 1111
\n<\/p>\n
<\/p>\n
Question 16.
\nWrite about assignment operator.
\nAnswer:
\nAssignment Operator:
\nThe assignment operator is used to assigning a value to a variable which is on the left-hand side of an assignment statement. = (equal to) is commonly used as the assignment operator in all computer programming languages. This operator copies the value at the right side of the operator to the left side variable. It is also a binary operator.
\n<\/p>\n
Question 17.
\nWhat are the shorthand assignment operators? Give example.
\nAnswer:<\/p>\n
\n\n\n\n Operator<\/p>\n<\/td>\n | \u00a0 \u00a0 \u00a0 Name of\u00a0 Operator\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0Example<\/td>\n<\/tr>\n |
\n+=<\/td>\n | Addition Assignment<\/td>\n | a = 10; \nc = a+= 5; \n(ie, a = a+5) \nc = 15<\/td>\n<\/tr>\n |
\n-=<\/td>\n | Subtraction Assignment<\/td>\n | a = 10; \nc = a-= 5; \n(ie, a = a-5) \nc = 5<\/td>\n<\/tr>\n |
\n* =<\/td>\n | Multiplication Assignment<\/td>\n | a = 10; \nc = a*= 5; \n(ie, a = a*5) \nc = 50<\/td>\n<\/tr>\n |
\n\/=<\/td>\n | Division Assignment<\/td>\n | a = 10; \nc – a\/= 5; \n(ie, a = a\/5) \nc = 2<\/td>\n<\/tr>\n |
\n%=<\/td>\n | Modulus Assignment<\/td>\n | a = 10; \nc = a%= 5; \n(ie, a = a%5) \nc = 0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/p>\n Question 18. \nWrite note on conditional or ternary operator. \nAnswer: \nIn C++, there is only one conditional operator is used. ?: is a conditional Operator. This is a Ternary Operator. This operator is used as an alternative to if… else control statement.<\/p>\n Question 19. \nWrite note on comma (, ) operator. \nAnswer: \nThe comma (,) is an operator in C++ used to bring together several expressions. The group of expressions separated by a comma is evaluated from left to right.<\/p>\n Question 20. \nWhat are the pointer operators? \nAnswer: \n* – Pointer to a variable operator \n& – Address of operator<\/p>\n Question 21. \nWhat are the component selection operators? \nAnswer: \n. – Direct component selector operator \n-> – Indirect component selector operator<\/p>\n <\/p>\n Question 22. \nWhat are the class member operators? \nAnswer: \n:: – Scope access \/ resolution operator \n.* – Dereference operator \n->* – Dereference pointer to class member operator<\/p>\n Question 23. \nWhat is operator association? \nAnswer: \nThe operands and the operators are grouped in a specific logical way for evaluation. This logical grouping is called as an Association.<\/p>\n Question 24. \nWhat are the cascading operators? \nAnswer: \nGet from (>>) and Put to (<<) operators are cascading operators.<\/p>\n Question 25. \nWhat are the popular C++ Compilers with IDE. \nAnswer:<\/p>\n \n\n\n\n Compiler<\/p>\n<\/td>\n | \n Availability<\/p>\n<\/td>\n<\/tr>\n | \nDev C++<\/td>\n | Open-source<\/td>\n<\/tr>\n | \nGeany<\/td>\n | Open-source<\/td>\n<\/tr>\n | \nCode:: blocks<\/td>\n | Open source<\/td>\n<\/tr>\n | \nCode Lite<\/td>\n | Open-source<\/td>\n<\/tr>\n | \nNet Beans<\/td>\n | Open-source<\/td>\n<\/tr>\n | \nDigital Mars<\/td>\n | Open-source<\/td>\n<\/tr>\n | \nSky IDE<\/td>\n | Open-source<\/td>\n<\/tr>\n | \nEclipse<\/td>\n | Open-source<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n <\/p>\n Short Answers (3 Marks)<\/span><\/p>\nQuestion 1. \nWhat are the benefits of C++? \nAnswer: \nBenefits of learning C++:<\/p>\n \n- c++ \u00a1s a highly portable language and \u00a1s often the language of choice for multi-device, multi- platform app development.<\/li>\n
- C++ is an object-oriented programming language and includes classes, inheritance, polymorphism, data abstraction and encapsulation.<\/li>\n
- C++ has a rich function library.<\/li>\n
- C++ allows exception handling, inheritance and function overloading which are not possible in C.<\/li>\n
- C++ is a powerful, efficient and fast language.<\/li>\n<\/ul>\n
It finds a wide range of applications \u2014 from GUI applications to 3D graphics for games to real-time mathematical simulations.<\/p>\n Question 2. \nWhat are the characters used In C++? \nAnswer: \nC++ accepts the following characters:<\/p>\n \n\n\nAlphabets<\/td>\n | A …. Z, a…. z<\/td>\n<\/tr>\n | \nNumeric<\/td>\n | 0 …. 9<\/td>\n<\/tr>\n | \nSpecial Characters<\/td>\n | + – * \/ ~ ! @ # $ % A<\/sup>& [ ] ( ) {} = ><_\\l?.,:'”;<\/td>\n<\/tr>\n\nWhite space<\/td>\n | Blank space, Horizontal tab (->), Carriage return (), Newline, Form feed<\/td>\n<\/tr>\n | \nOther characters<\/td>\n | C++ can process any of the 256 ASCII characters as data.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n Question 3. \nWhat are Automatic conversion and Type promotion? \nAnswer: \nImplicit type conversion is a conversion performed by the compiler automatically. So, the implicit conversion is also called \u201cAutomatic conversion\u201d. This type of conversion is applied usually whenever different data types are intermixed in an expression. If the type of the operands differs, the compiler converts one of them to match with the other, using the rule that the \u201csmaller\u201d type is converted to the \u201cwider\u201d type, which is called \u201cType Promotion\u201d.<\/p>\n <\/p>\n Question 4. \nWhat are the rules for naming an identifier\/variable? \nAnswer: \nRules for naming an identifier:<\/p>\n \n- The first character of an identifier must be an alphabet or an underscore (-).<\/li>\n
- Only alphabets, digits, and underscore are permitted. Other special characters are not allowed as part of an identifier.<\/li>\n
- c++ is case sensitive as it treats upper and lower-case characters differently.<\/li>\n
- Reserved words or keywords cannot be used as an identifier name.<\/li>\n<\/ul>\n
Question 5. \nList the kinds of literals in C++. \nAnswer: \nC++ has several kinds of literals. They are: \n<\/p>\n Question 6. \nWhat are the types of C++operators? \nAnswer: \nC++ Operators are classified as:<\/p>\n \n- Arithmetic Operators<\/li>\n
- Relational Operators<\/li>\n
- Logical Operators<\/li>\n
- Bitwise Operators<\/li>\n
- Assignment Operators<\/li>\n
- Conditional Operator<\/li>\n
- Other Operators<\/li>\n<\/ol>\n
<\/p>\n Question 7. \nWrite a note on character constants. \nAnswer: \nA character constant is any valid single character enclosed within single quotes. A character constant in C++ must contain one character and must be enclosed within a single quote. \nValid character constants : ‘A’, ‘2\\ ‘$’ \nInvalid character constants : “A” \nThe value of a single character constant has an equivalent ASCII value. For example, the value of’A’ is 65.<\/p>\n Question 8. \nWhat are escape sequences? Explain. \nAnswer: \nEscape sequences (or) Non-graphic characters: \nC++ allows certain non-printable characters represented as character constants. Non-printable characters are also called non-graphical characters. Non-printable characters are those characters that cannot be typed directly from a keyboard during the execution of a program in C++. \nFor example: backspace, tabs etc. These non-printable characters can be represented by using escape sequences. An escape sequence is represented by a backslash followed by one or two characters. \nExample: \\t \\On \\xHn<\/p>\n Question 9. \nTabulate the escape sequence characters. \nAnswer:<\/p>\n \n\n\n\n Escape sequence<\/p>\n<\/td>\n | \n Non-graphical character<\/p>\n<\/td>\n<\/tr>\n | \n\\a<\/td>\n | Audible or alert bell<\/td>\n<\/tr>\n | \n\\b<\/td>\n | Backspace<\/td>\n<\/tr>\n | \n\\f<\/td>\n | Form feed<\/td>\n<\/tr>\n | \n\\n<\/td>\n | Newline or linefeed<\/td>\n<\/tr>\n | \n\\r<\/td>\n | Carriage return<\/td>\n<\/tr>\n | \n\\t<\/td>\n | Horizontal tab<\/td>\n<\/tr>\n | \n\\v<\/td>\n | Vertical tab<\/td>\n<\/tr>\n | \n\\\\<\/td>\n | Backslash<\/td>\n<\/tr>\n | \n\\’<\/td>\n | Single quote<\/td>\n<\/tr>\n | \n\\”<\/td>\n | Double quote<\/td>\n<\/tr>\n | \n\\?<\/td>\n | Question Mark<\/td>\n<\/tr>\n | \n\\On<\/td>\n | Octal number<\/td>\n<\/tr>\n | \n\\xHn<\/td>\n | Hexadecimal number<\/td>\n<\/tr>\n | \n\\o<\/td>\n | Null<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n <\/p>\n Question 10. \nWrite a note on arithmetic operators. \nAnswer: \nArithmetic operators perform simple arithmetic operations like addition, subtraction, multiplication, division etc.<\/p>\n \n\n\n\n Operator<\/p>\n<\/td>\n | \n Operation<\/p>\n<\/td>\n | \n Example<\/p>\n<\/td>\n<\/tr>\n | \n+<\/td>\n | Addition<\/td>\n | 10 + 5 = 15<\/td>\n<\/tr>\n | \n–<\/td>\n | Subtraction<\/td>\n | 10 – 5 = 5<\/td>\n<\/tr>\n | \n*<\/td>\n | Multiplication<\/td>\n | 10 * 5 = 50<\/td>\n<\/tr>\n | \n\/<\/td>\n | Division<\/td>\n | 10 \/ 5 = 2 (Quotient of the division)<\/td>\n<\/tr>\n | \n%<\/td>\n | Modulus (To find the reminder of a division)<\/td>\n | 10 % 3 = 1 (Remainder of the division)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n Question 11. \nWhat are the relational operators in C++? Give examples. \nAnswer: \nRelational operators are used to determining the relationship between its operands. When the relational operators are applied on two operands, the result will be a Boolean value i.e 1 or 0 to represents True or False respectively. C++ provides six relational operators. They are:<\/p>\n \n\n\nOperator<\/td>\n | Operation<\/td>\n | Example<\/td>\n<\/tr>\n | \n><\/td>\n | Greater than<\/td>\n | a > b<\/td>\n<\/tr>\n | \n<<\/td>\n | Less than<\/td>\n | a < b<\/td>\n<\/tr>\n | \n>=<\/td>\n | Greater than or equal to<\/td>\n | a >= b<\/td>\n<\/tr>\n | \n<=<\/td>\n | Less than or equal to<\/td>\n | a <= b<\/td>\n<\/tr>\n | \n==<\/td>\n | Equal to<\/td>\n | a == b<\/td>\n<\/tr>\n | \nj=<\/td>\n | Not equal<\/td>\n | a != b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n | | | | | | |