Que- Which of these expressions will make the rightmost set bit zero in an input integer x?
a. x = x
b. (x-1)
c. x = x & (x-1)
d. x = x
Answer- (x+1)
Que- 0946, 786427373824, 'x' and 0X2f are _____ _____ ____ and _____ literals respectively.
a. decimal, character, octal, hexadecimal
b. octal, hexadecimal, character, decimal
c. hexadecimal, octal, decimal, character
d. octal, decimal, character, hexadecimal
Answer- octal, decimal, character, hexadecimal
Que- Which of the following is not one of the sizes of the floating point types?
a. short float
b. float
c. long double
d. double
Answer- short float
Que- Which of the following is a valid floating-point literal?
a. f287.333
b. F287.333
c. 2.87E+04
d. 287.3.e2
Answer- 2.87E+04
Que- What is the range of the floating point numbers?
a. -3.4E+38 to +3.4E+38
b. -3.4E+38 to +3.4E+34
c. -3.4E+38 to +3.4E+36
d. -3.4E+38 to +3.4E+32
Answer- -3.4E+38 to +3.4E+38
Que- Which of three sizes of floating point types should be used when extended precision is required?
a. float
b. double
c. long double
d. extended float
Answer- long double
Que- Which is used to indicate single precision value?
a. F or f
b. L or l
c. Either F or for L or l
d. Neither F or for L or l
Answer- F or f
Que- Which is correct with respect to the size of the data types?
a. char > int < float
b. int < char > float
c. char < int < float
d. char < int < double
Answer- char < int < double
Que- The size of an object or a type can be determined using which operator?
a. malloc
b. sizeof
c. malloc
d. calloc
Answer- sizeof
Que- It is guaranteed that a ____ has at least 8 bits and a ____ has at least 16 bits.
a. int, float
b. char, int
c. bool, char
d. char, short
Answer- char, short
Que- Implementation dependent aspects about an implementation can be found in ____
a. <implementation>
b. <limits>
c. <limit>
d. <numeric>
Answer- <limits>
Que- Size of C++ objects are expressed in terms of multiples of the size of a ____ and the size of a char is _______
a. char, 1
b. int, 1
c. float, 8
d. char, 4
Answer- char, 1
Que- Identify the incorrect option.
a. 1 <= sizeof(bool) <= sizeof(long)
b. sizeof(float) <= sizeof(double) <= sizeof(long double)
c. sizeof(char) <= sizeof(long) <=sizeof(wchar_t)
d. sizeof(N) = sizeof(signed N) = sizeof(unsigned N)
Answer- sizeof(char) <= sizeof(long) <=sizeof(wchar_t)
Que- Which of the following will not return a value?
a. null
b. void
c. empty
d. free
Answer- void
Que- ______________ have the return type void.
a. all functions
b. constructors
c. destructors
d. none of the mentioned
Answer- none of the mentioned
Que- What does the following statement mean? void a;
a. variable a is of type void
b. a is an object of type void
c. declares a variable with value a
d. flags an error
Answer- flags an error
Que- Choose the incorrect option.
a. void is used when the function does not return a value
b. void is also used when the value of a pointer is null
c. void is used as the base type for pointers to objects of unknown type
d. void is a special fundamental type
Answer- void is also used when the value of a pointer is null
Que- Identify the incorrect option.
a. enumerators are constants
b. enumerators are user-defined types
c. enumerators are same as macros
d. enumerator values start from 0 by default
Answer- enumerators are same as macros
Que- In which type do the enumerators are stored by the compiler?
a. string
b. integer
c. float
d. string & float
Answer- integer
Que- To which of these enumerators can be assigned?
a. integer
b. negative
c. enumerator
d. all of the mentioned
Answer- all of the mentioned
Que- What will happen when defining the enumerated type?
a. it will not allocate memory
b. it will allocate memory
c. it will not allocate memory to its variables
d. allocate memory to objects
Answer- it will not allocate memory
Que- Which variable does equals in size with enum variable?
a. int variable
b. float variable
c. string variable
d. float & string variable
Answer- int variable
Que- Choose the correct option. extern int i; int i;
a. both 1 and 2 declare i
b. 1 declares the variable i and 2 defines i
c. 1 declares and defines i, 2 declares i
d. 1 declares i,2 declares and defines i
Answer- 1 declares i,2 declares and defines i
Que- Pick the right option. Statement 1: A definition is also a declaration. Statement 2: An identifier can be declared just once.
a. Statement 1 is true, Statement 2 is false
b. Statement 2 is true, Statement 1 is false
c. Both are false
d. Both are true
Answer- Statement 2 is true, Statement 1 is false
Que- Which of the given statements are false? i. extern int func; ii. extern int func2(int,int); iii. int func2(int,int); iv. extern class foo;
a. iii and iv only
b. ii and iii only
c. only iv
d. ii, iii and iv
Answer- only iv
Que- Pick the right option. Statement 1: Global values are not initialized by the stream. Statement 2: Local values are implicitly initialised to 0.
a. Statement 1 is true, Statement 2 is false
b. Statement 2 is true, Statement 1 is false
c. Both are false
d. Both are true
Answer- Both are false
Que- What does the following statement mean? int (*fp)(char*)
a. pointer to a pointer
b. pointer to an array of chars
c. pointer to function taking a char* argument and returns an int
d. function taking a char* argument and returning a pointer to int
Answer- pointer to function taking a char* argument and returns an int
Que- The operator used for dereferencing or indirection is ____
a. *
b. &
c. ->
d. –>>
Answer- *
Que- Choose the right option.string* x, y;
a. x is a pointer to a string, y is a string
b. y is a pointer to a string, x is a string
c. both x and y are pointers to string types
d. y is a pointer to a string
Answer- x is a pointer to a string, y is a string
Que- Which one of the following is not a possible state for a pointer.
a. hold the address of the specific object
b. point one past the end of an object
c. zero
d. point to a type
Answer- point to a type
Que- Which of the following is illegal?
a. int *ip;
b. string s, *sp = 0;
c. int i; double* dp = &i;
d. int *pi = 0;
Answer- int i; double* dp = &i;
Que- What will happen in the following C++ code snippet? int a = 100, b = 200; int *p = &a, *q = &b; p = q;
a. b is assigned to a
b. p now points to b
c. a is assigned to b
d. q now points to a
Answer- p now points to b
Que- The correct statement for a function that takes pointer to a float, a pointer to a pointer to a char and returns a pointer to a pointer to a integer is ____________
a. int **fun(float**, char**)
b. int *fun(float*, char*)
c. int **fun(float*, char**)
d. int ***fun(*float, **char)
Answer- int **fun(float*, char**)
Que- Which of the following correctly declares an array?
a. int array[10];
b. int array;
c. array{10};
d. array array[10];
Answer- int array[10];
Que- What is the index number of the last element of an array with 9 elements?
a. 9
b. 8
c. 0
d. Programmer-defined
Answer- 8
Que- What is the correct definition of an array?
a. An array is a series of elements of the same type in contiguous memory locations
b. An array is a series of element
c. An array is a series of elements of the same type placed in non-contiguous memory locations
d. An array is an element of the different type
Answer- An array is a series of elements of the same type in contiguous memory locations
Que- Which of the following accesses the seventh element stored in array?
a. array[6];
b. array[7];
c. array(7);
d. array;
Answer- array[6];
Que- Which of the following gives the memory address of the first element in array?
a. array[0];
b. array[1];
c. array(2);
d. array;
Answer- array;
Que- What is the meaning of the following declaration? int(*p[5])();
a. p is pointer to function
b. p is array of pointer to function
c. p is pointer to such function which return type is the array
d. p is pointer to array of function
Answer- p is array of pointer to function
Que- What is size of generic pointer in C++ (in 32-bit platform)?
a. 2
b. 4
c. 8
d. 0
Answer- 4
Que- The constants are also called as _____________
a. const
b. preprocessor
c. literals
d. variables
Answer- literals
Que- What are the parts of the literal constants?
a. integer numerals
b. floating-point numerals
c. strings and boolean values
d. all of the mentioned
Answer- all of the mentioned
Que- How are the constants declared?
a. const keyword
b. #define preprocessor
c. both const keyword and #define preprocessor
d. $define
Answer- both const keyword and #define preprocessor
Que- Which of the following statement is not true about preprocessor directives?
a. These are lines read and processed by the preprocessor
b. They do not produce any code by themselves
c. These must be written on their own line
d. They end with a semicolon
Answer- They end with a semicolon
Que- Regarding the following statement which of the statements is true? const int a = 100;
a. Declares a variable a with 100 as its initial value
b. Declares a construction a with 100 as its initial value
c. Declares a constant a whose value will be 100
d. Constructs an integer type variable with an as identifier and 100 as the value
Answer- Declares a constant a whose value will be 100
Que- The difference between x and 'x' is?
a. The first one refers to a variable whose identifier is x and the second one refers to the character constant x
b. The first one is a character constant x and the second one is the string literal x
c. Both are same
d. Both are string literal
Answer- The first one refers to a variable whose identifier is x and the second one refers to the character constant x
Que- How to declare a wide character in the string literal?
a. L prefix
b. l prefix
c. W prefix
d. Z prefix
Answer- L prefix
Que- Which value can we not assign to reference?
a. integer
b. floating
c. unsigned
d. null
Answer- null
Que- Identify the incorrect statement.
a. Reference is the alternate name of the object
b. A reference value once defined can be reassigned
c. A reference value once defined cannot be reassigned
d. Reference is the alternate name of the variable
Answer- A reference value once defined can be reassigned
Que- Which reference modifier is used to define the reference variable?
a. &
b. $
c. #
d. @
Answer- &
Que- What does a reference provide?
a. Alternate name for the class
b. Alternate name for the variable
c. Alternate name for the pointer
d. Alternate name for the object
Answer- Alternate name for the variable
Que- Identify the correct sentence regarding inequality between reference and pointer.
a. we can not create the array of reference
b. we can create the Array of reference
c. we can use reference to reference
d. we can use variable
Answer- we can not create the array of reference
Que- What are the references in C++?
a. An alternative name for already existing variables
b. A pointer to a variable
c. A new type of variables
d. A new type of constant variable
Answer- An alternative name for already existing variables
Que- What is the difference between references and pointers?
a. References are an alias for a variable whereas pointer stores the address of a variable
b. References and pointers are similar
c. References stores address of variables whereas pointer points to variables
d. Pointers are an alias for a variable whereas references stores the address of a variable
Answer- References are an alias for a variable whereas pointer stores the address of a variable
Que- Pick the correct statement about references in C++.
a. References stores the address of variables
b. References and variables both have the same address
c. References use dereferencing operator(*) to access the value of variable its referencing
d. References were also available in C
Answer- References and variables both have the same address
Que- Pick the correct statement about references.
a. References can be assigned value NULL
b. References once assigned cannot be changed to refer another variable
c. Reference should not be initialized when created
d. Reference is the same as pointers
Answer- References once assigned cannot be changed to refer another variable
Que- Which of the following is incorrect?
a. References cannot be NULL
b. A reference must be initialized when declared
c. Once a reference is declared, it cannot be modified later to reference another object i.e. it cannot be reset
d. References cannot refer to a constant value
Answer- References cannot refer to a constant value
Que- Which of the following function must use reference.
a. Assignment operator function
b. Copy Constructor
c. Destructor
d. Parameterized constructor
Answer- Copy Constructor