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.

1.

Type of Conversion in which compiler is unable to convert the data type implicitly is?(a) ushort to long(b) int to uint(c) ushort to long(d) byte to decimalThis question was posed to me in my homework.I would like to ask this question from Type Conversion in Expressions in chapter Data Types, Variables and Operators of C#

Answer»

The CORRECT CHOICE is (b) INT to uint

For explanation: ‘int’ is 32 bit signed integer whereas ‘uint’ is 32 bit unsigned integer. RANGE of int is larger than uint. So, the compiler cannot implicitly convert from larger data type to smaller data type.

2.

The subset of ‘int’ data type is __________(a) long, ulong, ushort(b) long, ulong, uint(c) long, float, double(d) long, float, ushortThis question was addressed to me during an interview for a job.I would like to ask this question from Type Conversion in Expressions in division Data Types, Variables and Operators of C#

Answer»

The CORRECT answer is (C) long, FLOAT, double

Explanation: By DEFINITION.

3.

‘Implicit Conversion’ follows the order of conversion as per compatibility of data type as:(a) float < char < int(b) char < int < float(c) int < char < float(d) float < int < charI had been asked this question in examination.The above asked question is from Type Conversion in Expressions topic in portion Data Types, Variables and Operators of C#

Answer»

The CORRECT choice is (B) char < int < float

To explain I would say: NONE.

4.

Types of ‘Data Conversion’ in C#?(a) Implicit Conversion(b) Explicit Conversion(c) Implicit Conversion and Explicit Conversion(d) None of the mentionedThe question was posed to me in unit test.Query is from Type Conversion in Expressions in chapter Data Types, Variables and Operators of C#

Answer»

The CORRECT OPTION is (B) EXPLICIT Conversion

Explanation: By DEFINITION.

5.

What is the need for ‘Conversion of data type’ in C#?(a) To store a value of one data type into a variable of another data type(b) To get desired data(c) To prevent situations of runtime error during change or conversion of data type(d) None of the mentionedThe question was asked during a job interview.This intriguing question originated from Type Conversion in Expressions topic in division Data Types, Variables and Operators of C#

Answer» RIGHT option is (c) To prevent SITUATIONS of RUNTIME error during change or conversion of DATA type

The best I can explain: By DEFINITION.
6.

Choose effective differences between ‘Boxing’ and ‘Unboxing’.(a) ‘Boxing’ is the process of converting a value type to the reference type and ‘Unboxing’ is the process of converting reference to value type(b) ‘Boxing’ is the process of converting a reference type to value typeand ‘Unboxing’ is the process of converting value type to reference type(c) In ‘Boxing’ we need explicit conversion and in ‘Unboxing’ we need implicit conversion(d) Both ‘Boxing’ and ‘Unboxing’ we need implicit conversionThe question was posed to me by my college director while I was bunking the class.The doubt is from Scope and Lifetime of Variables topic in chapter Data Types, Variables and Operators of C#

Answer» RIGHT OPTION is (a) ‘BOXING’ is the PROCESS of converting a value type to the reference type and ‘Unboxing’ is the process of converting reference to value type

To explain I would say: By definition.
7.

Syntax for declaration and initialization of data variable is?(a) = ;(b) ;(c) ;(d) = ;The question was asked in quiz.This interesting question is from Scope and Lifetime of Variables in chapter Data Types, Variables and Operators of C#

Answer»

Correct option is (a) = ;

To EXPLAIN I WOULD SAY: By definition.

8.

Which of the following format specifiers is used to print hexadecimal values and return value of output as Octal equivalent in C#?(a) %hx for small case letters and %HX for capital letters(b) %x for small case letters and %X for capital letters(c) No ease of doing it. C# don’t provides specifier like %x or %O to be used with ReadLine() OR WriteLine(). We have to write our own function(d) %Ox for small case letters and %OX for capital lettersI have been asked this question during a job interview.Query is from Floating and Decimal Data Types topic in chapter Data Types, Variables and Operators of C#

Answer»

Correct answer is (c) No ease of doing it. C# don’t provides specifier LIKE %X or %O to be used with ReadLine() OR WriteLine(). We have to WRITE our own FUNCTION

To explain: No ease of doing it. C# don’t provides specifier like %x or %O to be used with ReadLine() OR WriteLine(). We have to write our own function.

9.

The Default value of Boolean Data Type is?(a) 0(b) True(c) False(d) 1This question was addressed to me during an interview.My question is taken from Floating and Decimal Data Types topic in section Data Types, Variables and Operators of C#

Answer»

Right ANSWER is (C) False

To EXPLAIN I would say: By Definition.

10.

How many Bytes are stored by ‘Long’ Data type in C# .net?(a) 8(b) 4(c) 2(d) 1The question was posed to me during an online interview.My question is from Integer Data Types in chapter Data Types, Variables and Operators of C#

Answer»

Correct CHOICE is (a) 8

Best EXPLANATION: ‘Long’ is the data type keyword used for STORING data of unlimited LENGTH so by definition its size is always maximum i.e 8.