Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

51.

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 lThe question was posed to me in an interview.Enquiry is from Floating Point Types topic in section Types, Pointers, Arrays & Structures in C++ of C++

Answer»

Correct ANSWER is (a) F or f

Easy explanation - Either F or f can be USED to INDICATE single precision values.

52.

Which of the following belongs to the set of character types?(a) char(b) wchar_t(c) only a(d) both wchar_t and charThe question was posed to me in an international level competition.My question is based upon Character Types topic in portion Types, Pointers, Arrays & Structures in C++ of C++

Answer»

The correct choice is (d) both wchar_t and CHAR

Explanation: wchar_t and char are used to REPRESENT wide CHARACTER and character.

53.

Which function is used to check whether a character is an alphabet?(a) isalpha()(b) isalnum()(c) isdigit()(d) isblank()I had been asked this question by my school principal while I was bunking the class.My doubt is from Character Classification topic in chapter Types, Pointers, Arrays & Structures in C++ of C++

Answer»

Correct option is (a) ISALPHA()

The explanation: CHARACTER CLASSIFICATION provides isalpha() FUNCTION to check whether a character in C++ is an alphabet or not.

54.

When does the void pointer can be dereferenced?(a) when it doesn’t point to any value(b) when it cast to another type of object(c) using delete keyword(d) using shift keywordThis question was posed to me in exam.I would like to ask this question from Pointer to Void topic in division Types, Pointers, Arrays & Structures in C++ of C++

Answer»

Right ANSWER is (B) when it cast to another type of object

The best EXPLANATION: By casting the pointer to another data type, it can be dereferenced from the VOID pointer.

55.

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 semicolonThis question was posed to me by my college director while I was bunking the class.This interesting question is from Constants topic in chapter Types, Pointers, Arrays & Structures in C++ of C++

Answer» RIGHT OPTION is (d) They end with a semicolon

The explanation is: No TERMINATING character required for PREPROCESSOR directives STATEMENTS.
56.

How are the constants declared?(a) const keyword(b) #define preprocessor(c) both const keyword and #define preprocessor(d) $defineThis question was addressed to me during an online interview.My doubt is from Constants in chapter Types, Pointers, Arrays & Structures in C++ of C++

Answer» CORRECT choice is (C) both const keyword and #define preprocessor

The explanation: The const will declare with a SPECIFIC TYPE value and #define is used to declare user-defined CONSTANTS.
57.

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 typeThe question was asked during an internship interview.This intriguing question comes from Arrays in section Types, Pointers, Arrays & Structures in C++ of C++

Answer»

The correct CHOICE is (a) An ARRAY is a series of elements of the same TYPE in CONTIGUOUS memory locations

Best EXPLANATION: Correct definition of an array is An array is a series of elements of the same type in contiguous memory locations.

58.

In which type do the enumerators are stored by the compiler?(a) string(b) integer(c) float(d) string & floatThe question was posed to me in my homework.The doubt is from Enumerations in division Types, Pointers, Arrays & Structures in C++ of C++

Answer» RIGHT answer is (b) integer

The best I can EXPLAIN: In C++, enumerations are STORED as integers by the compiler STARTING with 0.
59.

How many characters are specified in the ASCII scheme?(a) 64(b) 128(c) 256(d) 24I had been asked this question in unit test.This key question is from Character Types topic in section Types, Pointers, Arrays & Structures in C++ of C++

Answer» RIGHT OPTION is (b) 128

The EXPLANATION: There are 128 CHARACTERS defined in the C++ ASCII list.
60.

Which type is best suited to represent the logical values?(a) integer(b) boolean(c) character(d) floatThis question was addressed to me by my school teacher while I was bunking the class.My query is from Types in chapter Types, Pointers, Arrays & Structures in C++ of C++

Answer» CORRECT ANSWER is (b) boolean

The best EXPLANATION: LOGICAL values can be either true or false, so the boolean TYPE is suited for it.
61.

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 objectThis question was posed to me by my college director while I was bunking the class.My doubt is from References in section Types, Pointers, Arrays & Structures in C++ of C++

Answer»

The CORRECT OPTION is (b) Alternate name for the variable

To EXPLAIN: Because we are pointing memory ADDRESS using the temp variable.

62.

The operator used for dereferencing or indirection is ____(a) *(b) &(c) ->(d) –>>This question was posed to me in final exam.My doubt stems from Pointers in section Types, Pointers, Arrays & Structures in C++ of C++

Answer»

Correct answer is (a) *

The best I can explain: * is used as dereferencing OPERATOR, used to READ value stored at the POINTED address.

63.

Identify the user-defined types from the following?(a) enumeration(b) classes(c) both enumeration and classes(d) intI got this question by my school principal while I was bunking the class.The query is from Types topic in chapter Types, Pointers, Arrays & Structures in C++ of C++

Answer»

Correct ANSWER is (c) both enumeration and classes

Explanation: They MUST be DEFINED by the users before use, UNLIKE the other types which are READILY available.

64.

Which of these expressions will isolate the rightmost set bit?(a) x = x & (~x)(b) x = x ^ (~x)(c) x = x & (-x)(d) x = x ^ (-x)The question was posed to me in examination.My doubt is from Integer Types topic in division Types, Pointers, Arrays & Structures in C++ of C++

Answer»

Correct option is (C) x = x & (-x)

The best explanation: NEGATIVE of a NUMBER is stores as 2;s complement in C++, so when you will take AND of x and (-x) the rightmost digit will be preserved.

65.

Suppose in a hypothetical machine, the size of char is 32 bits. What would sizeof(char) return?(a) 4(b) 1(c) Implementation dependent(d) Machine dependentI got this question in unit test.My query is from Character Types topic in chapter Types, Pointers, Arrays & Structures in C++ of C++

Answer»

Correct option is (b) 1

The BEST I can EXPLAIN: The STANDARD does NOT require a char to be 8-bits, but does require that sizeof(char) RETURN 1.

66.

What happens when a null pointer is converted into bool?(a) an error is flagged(b) bool value evaluates to true(c) bool value evaluates to false(d) the statement is ignoredThis question was posed to me in an internship interview.The query is from Booleans topic in division Types, Pointers, Arrays & Structures in C++ of C++

Answer» CORRECT choice is (C) bool value EVALUATES to false

Easy explanation - A pointer can be implicitly converted to a bool. A nonzero pointer converts to TRUE and zero VALUED pointer converts to false.
67.

What does ‘\a’ escape code represent?(a) alert(b) backslash(c) tab(d) form feedI got this question in exam.This intriguing question comes from Types in section Types, Pointers, Arrays & Structures in C++ of C++

Answer»

Correct choice is (a) alert

Best explanation: Because \a is used to PRODUCE a BEEP SOUND.