- Which one of the following is an ANSI C keyword?
- public
- operator
export
- volatile
Which one of the following is not a C++ keyword?
- constant
- false
- explicit
- throw
- Which of the following statements is TRUE with regard to naming C++ identifiers?
A name can start with any letter or digit.
- No special characters are permitted.
- Uppercase and lowercase letters are distinct.
- A name cannot have more than 32 characters
- Which of the following is a valid C++ identifier?
- Total value
2 x
- _string1
- template
- Which of the following is not a valid literal constant in C++?
- “ANSI C++”
0X5
- 12, 345
- 9.234L
- Which of the following is a user-defined data type in C++?
array
- enumeration
- void
- function
Which of the following is not a built-in data type in C++?
- structure
- void
- char
- long double
- Which of the following program segments is valid in C++?
- a) void *p1; char *p2; p2 = p1;
- b) void *p1; int *p2; *p2 = *p1;
- C) void *p1; char *p2; p2 =(char*)p1;
- d) enum colour {red, blue}; colour background; background = 1;
- Assuming that we are working an a 16-bit word machine, which of the following takes a size of 8 bytes
- signed long int
- long int
long double
- double
- Which of the following declaration statements is illegal?
const int m = 10;
- const int count;
- const m = 100;
- int const *p = &x;
- Which of the following statements is FALSE?
- All variables must be declared before they are used
- All variables must be given a type when they are declared
A variable can be declared anywhere in the scope
- A variable must be initialized at the time of its declaration
- Identify the error, if any, in the statement: long sum = m1 + m2;
- Declaration cannot contain any expression
Initialization at the time of declaration is not valid.
- Type specification is incomplete.
- No error
Which of the following statements is invalid?
- int p = new int ;
- int *p = new int ;
- int *p = new int [10] ;
- int *p = new int [m] [10] ;
- For using the manipulator setw(), we must include the header file:
- <iostream>
<cstdio>
- <iomanip>
- <cstdlib>
- The following statements implement type cast operation. Which one of them is illegal?
- x = y/(float)m;
- x = y/float(m);
x = float(y)/(float)m;
- x = y/float m;
- The statement a=(b=10) – 5; is an example of
Chained assignment
- Embedded assignment
- Compound assignment
- None of the above
- Which one of the following expressions is an example of bitwise expression?
- x>=y
- x==10 && y<5
- x << 10
- x + = 10
- Which of the following operators in C++ can be overloaded?
Conditional operator (?:)
- Scope resolution operator (::)
- Member access operator (.*)
- Relational Operator (<=)
In which of the following groups all the operators are in the same level of precedence?
- <<, < =, = =, << =
- new, sizeaf, typeid, !
- new, delete, ->, ::
- %, *, ->*, /=
Which of the following loop structures is known as an exit-controlled loop?
- do… while loop
- while loop
- for loop
- None of the above
Answers:
- volatile
- constant
- No special characters are permitted.
- _string1
- 12, 345
- enumeration
- structure
- void *p1; char *p2; p2 =(char*)p1;
- double
- const int count;
- A variable must be initialized at the time of its declaration
- Type specification is incomplete.
- int p = new int ;
- <iomanip>
- x = y/float m;
- Embedded assignment
- x << 10
- Scope resolution operator (::)
- <<, < =, = =, << =
- do… while loop
You must log in to post a comment.