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.

Select the correct methodS provided by Console.In?(a) Read(), ReadLine()(b) ReadKey(), ReadLine()(c) Read(), ReadLine(), ReadKey()(d) ReadKey(), ReadLine()

Answer» Right option is (c) Read(), ReadLine(), ReadKey()

For explanation: The two method Read() and ReadLine() available in .NET Framework 1.0 and Third method ReadKey() was added by .NET Framework 2.0.
2.

Choose the output returned when read() reads the character from the console?(a) String(b) Char(c) Integer(d) Boolean

Answer» The correct option is (c) Integer

The best explanation: Read() returns the character read from the console. It returns the result. The character is returned as an int, which should be cast to char.
3.

Choose the output returned when an error condition is generated while read() reads from the console.(a) False(b) 0(c) -1(d) All of the mentioned

Answer» Right option is (c) -1

To explain I would say: Read() returns –1 on error. This method also throws an IOException on failure.
4.

Choose the object of TextReader class.(a) Console.In(b) Console.Out(c) Console.Error(d) None of the mentioned

Answer» Correct choice is (a) Console.In

The best I can explain: Console.In is an instance(object) of TextReader class and we can use the methods and properties defined by TextReader to invoke the object console.in.
5.

Attributes could be applied to ___________(a) Method(b) Class(c) Assembly(d) All of the mentioned

Answer» Right choice is (d) All of the mentioned

The best explanation: None.
6.

Which among the following cannot be a target for a custom attribute?(a) Enum(b) Event(c) Interface(d) Namespace

Answer» Correct answer is (d) Namespace

Explanation: None.
7.

Which of the following is the correct statement about inspecting an attribute in C#.NET?(a) An attribute can be inspected at link time(b) An attribute can be inspected at design time(c) An attribute can be inspected at run time(d) None of the mentioned

Answer» Right choice is (a) An attribute can be inspected at link time

Easiest explanation - None.
8.

Select the correct statement about Attributes used in C#.NET?(a) The CLR can change the behaviour of the code depending on attributes applied to it(b) If a bugFixAttribute is to receive three parameters, then the BugFixAttribute class should implement a zero argument constructor(c) To create a custom attribute we need to create a custom attribute structure and derive it from System.Attribute(d) None of the mentioned

Answer» Correct answer is (a) The CLR can change the behaviour of the code depending on attributes applied to it

Easy explanation - None.
9.

Which of the following cannot further inspect the attribute that is once applied?(a) Linker(b) ASP.NET Runtime(c) Language compilers(d) CLR

Answer» Right option is (a) Linker

The best I can explain: None.
10.

Which of these classes are used by Byte streams for input and output operation?(a) InputStream(b) InputOutputStream(c) Reader(d) All of the mentioned

Answer» Right answer is (b) InputOutputStream

For explanation: Byte stream uses InputStream and OutputStream classes for input and output operation.
11.

What is the output returned by Console if ReadLine() stores I/O error?(a) 1(b) 0(c) False(d) I/O EXCEPTION ERROR

Answer» The correct answer is (d) I/O EXCEPTION ERROR

The best I can explain: None.
12.

Choose the namespace which consists of classes that are part of .NET Reflection API?(a) System.Text(b) System.Name(c) System.Reflection(d) None of the mentioned

Answer» The correct answer is (c) System.Reflection

Best explanation: Many of the classes that support reflection are part of the .NET Reflection API, which is in the System.Reflection namespace.

eg : using System.Reflection;
13.

Choose the correct statement about System.Type namespace.(a) Core of the reflection subsystem as it encapsulates a type(b) Consists of many methods and properties that can be used to obtain information about a type at runtime(c) Both Core of the reflection subsystem as it encapsulates a type & Consists of many methods and properties that can be used to obtain information about a type at runtime(d) Only Consists of many methods and properties that can be used to obtain information about a type at runtime

Answer» Right answer is (c) Both Core of the reflection subsystem as it encapsulates a type & Consists of many methods and properties that can be used to obtain information about a type at runtime

To explain I would say: System.Type is at the core of the reflection subsystem because it encapsulates a type. It contains many properties and methods that you will use to obtain information about a type at runtime.
14.

Name the method/methods used to read byte streams from the file?(a) ReadByte()(b) Read(c) Readkey()(d) None of the mentioned

Answer» The correct answer is (a) ReadByte()

Easiest explanation - None.
15.

Which of these methods are used to read single character from the console?(a) get()(b) getline()(c) read()(d) readLine()

Answer» Right answer is (c) read()

Easy explanation - None.
16.

What does URL stand for?(a) Uniform Resource Locator(b) Uniform Resource Latch(c) Universal Resource Locator(d) Universal Resource Latch

Answer» Right choice is (a) Uniform Resource Locator

For explanation: None.
17.

Which of these exceptions is thrown by the URL class’s constructors?(a) URLNotFound(b) URLSourceNotFound(c) MalformedURLException(d) URLNotFoundException

Answer» Correct answer is (c) MalformedURLException

The best I can explain: None.
18.

Which of these classes is used to encapsulate IP address and DNS?(a) DatagramPacket(b) URL(c) InetAddress(d) ContentHandler

Answer» Right answer is (c) InetAddress

Explanation: InetAddress class encapsulates both IP address and DNS, we can interact with this class by using the name of an IP host.
19.

On call of which type of method the new created thread will not start executing?(a) Begin()(b) Start()(c) New()(d) All of the mentioned

Answer» The correct option is (b) Start()

Explanation: Once created, the new thread will not start running until you call its Start() method, which is defined by Thread.
20.

What is synchronization in reference to a thread?(a) It’s a process of handling situations when two or more threads need access to a shared resource(b) It’s a process by which many threads are able to access the same shared resource simultaneously(c) It’s a process by which a method is able to access many different threads simultaneously(d) It’s a method that allows too many threads to access any information they require

Answer» The correct answer is (a) It’s a process of handling situations when two or more threads need access to a shared resource

The best explanation: When two or more threads need to access the same shared resource, they need some way to ensure that the resource will be used by only one thread at a time, the process by which this is achieved is called synchronization.
21.

The property signifies “Obtains a Module object that represents the module (an executable file) in which the reflected type resides”. Choose the property which specifies the following statement?(a) Type DeclaringType(b) int MetadataToken(c) Module Module(d) Type ReflectedType

Answer» The correct option is (c) Module Module

Easiest explanation - By definition.
22.

Which of these classes is used to make a thread?(a) String(b) System(c) Thread(d) Runnable

Answer» The correct option is (c) Thread

Easiest explanation - The multithreading system is built upon the Thread class, which encapsulates a thread of execution. The Thread class is sealed, which means that it cannot be inherited. Thread defines several methods and properties that help manage threads.
23.

What kind of exception is being thrown if Wait(), Pulse() or PulseAll() is called from code that is not within synchronized code?(a) System I/O Exception(b) DivideByZero Exception(c) SynchronizationLockException(d) All of the mentioned

Answer» Correct answer is (c) SynchronizationLockException

The explanation: A SynchronizationLockException will be thrown if Wait(), Pulse(), or PulseAll() is called from code that is not within synchronized code, such as a lock block.
24.

Which of these keywords are used to implement synchronization?(a) synchronize(b) syn(c) synch(d) synchronized

Answer» Correct choice is (d) synchronized

The explanation is: None.
25.

Choose the method defined by MemberInfo.(a) GetCustomAttributes()(b) IsDefined()(c) GetCustomeAttributesData()(d) All of the mentioned

Answer» The correct option is (d) All of the mentioned

Best explanation: MemberInfo includes two abstract methods: GetCustomAttributes( ) and IsDefined( ). These both relate to attributes. The first obtains a list of the custom attributes associated with the invoking object. The second determines if an attribute is defined for the invoking object. The .NET Framework Version 4.0 adds a method called GetCustomAttributesData(), which returns information about custom attributes.
26.

Choose the class from which the namespace ‘System.Type’ is derived?(a) System.Reflection(b) System.Reflection.MemberInfo(c) Both System.Reflection & System.Reflection.MemberInfo(d) None of the mentioned

Answer» Correct option is (b) System.Reflection.MemberInfo

Explanation: Type is derived from an abstract class called System.Reflection.MemberInfo
27.

Which method is called when a thread is blocked from running temporarily?(a) Pulse()(b) PulseAll()(c) Wait()(d) Both Pulse() & Wait()

Answer» Correct option is (c) Wait()

Explanation: When a thread is temporarily blocked from running, it calls Wait( ). This causes the thread to go to sleep and the lock for that object to be released, allowing another thread to acquire the lock.
28.

Which of the following statement is correct?(a) reverse() method reverses some characters(b) reverseall() method reverses all characters(c) replace() method replaces all instances of  a character with new character(d) replace() method replaces first occurrence of a character in invoking string with another character

Answer» The correct option is (c) replace() method replaces all instances of  a character with new character

Explanation: reverse() and replace() are by definition.
29.

Which of these classes is used to create an object whose character sequence is mutable?(a) String()(b) StringBuilder()(c) String() & StringBuilder()(d) None of the mentioned

Answer» Right answer is (b) StringBuilder()

Easiest explanation - Mutable strings are dynamic strings. They can grow dynamically as characters are added to them. stringbuilder class supports those methods that are useful for manipulating dynamic strings.
30.

Which of these method returns a smallest whole number greater than or equal to variable X?(a) double Ciel(double X)(b) double Floor(double X)(c) double Max(double X)(d) double Min(double X)

Answer» Correct answer is (a) double Ciel(double X)

The best I can explain: Ciel(double X) returns the smallest whole number greater than or equal to variable X.
31.

Which of these methods return a largest whole number less than or equal to variable X?(a) double Ciel(double X)(b) double Floor(double X)(c) double Max(double X)(d) double Min(double X)

Answer» The correct answer is (b) double Floor(double X)

To explain I would say: double Floor(double X) returns a largest whole number less than or equal to variable X.
32.

What is mutex?(a) a mutually exclusive synchronization object(b) can be acquired by more than one thread at a time(c) helps in sharing of resource which can be used by one thread(d) all of the mentioned

Answer» The correct answer is (a) a mutually exclusive synchronization object

The best explanation: A mutex is a mutually exclusive synchronization object. This means it can be acquired by one and only one thread at a time. The mutex is designed for those situations in which a shared resource can be used by only one thread at a time.
33.

Number of threads that exists for each of the processes that occurs in the program:(a) at most 1(b) atleast 1(c) only 1(d) both at most 1 & atleast 1

Answer» Correct answer is (d) both at most 1 & atleast 1

To explain I would say: All processes have at least one thread for execution, which is usually called the main thread because it is the primary thread that is executed when our program begins. From the main thread, we can create other threads.
34.

What is multithreaded programming?(a) It’s a process in which two different processes run simultaneously(b) It’s a process in which two or more parts of same process run simultaneously(c) It’s a process in which many different process are able to access same information(d) It’s a process in which a single process can access information from many sources

Answer» The correct option is (b) It’s a process in which two or more parts of same process run simultaneously

Explanation: Multithreaded programming a process in which two or more parts of same process run simultaneously.
35.

Which of these statements is incorrect?(a) By multithreading CPU idle time is minimized, and we can take maximum use of it(b) By multitasking CPU idle time is minimized, and we can take maximum use of it(c) Two thread in Csharp can have same priority(d) A thread can exist only in two states, running and blocked

Answer» The correct choice is (d) A thread can exist only in two states, running and blocked

Explanation: Thread exists in several states, a thread can be running, suspended, blocked, terminated & ready to run.
36.

Which method is used to abort thread prior to it’s normal execution?(a) sleep()(b) terminate()(c) suspend()(d) Abort()

Answer» Right choice is (d) Abort()

For explanation: To terminate a thread prior to its normal conclusion, use Thread.Abort( ). Its simplest form is shown here:
37.

What is the advantage of the multithreading program?(a) Enables to utilize the idle and executing time present in most programs(b) Enables to utilize the idle time present in most programs(c) Both Enables to utilize the idle and executing time present in most programs & Enables to utilize the idle time present in most programs(d) Only Enables to utilize the idle time present in most programs

Answer» Right option is (d) Only Enables to utilize the idle time present in most programs

The explanation is: The principal advantage of multithreading is that it enables us to write very efficient programs because it lets us utilize the idle time that is present in most programs.
38.

Choose the statements which indicate the differences between the thread based multitasking and process based multitasking.(a) Process-based multitasking handles the concurrent execution of programs(b) Process-based multitasking handles the concurrent execution of pieces of the same program(c) Thread-based multitasking handles the concurrent execution of programs(d) Thread-based multitasking deals with the concurrent execution of pieces of the same program

Answer» The correct answer is (a) Process-based multitasking handles the concurrent execution of programs

Easy explanation - The differences between process-based and thread-based multitasking can be summarized like this:Process-based multitasking handles the concurrent execution of programs. Thread-based multitasking deals with the concurrent execution of pieces of the same program.
39.

Select the two type of threads mentioned in the concept of multithreading:(a) foreground(b) background(c) only foreground(d) both foreground & background

Answer» Right option is (d) both foreground & background

Easy explanation - None.
40.

Select the type of multitasking methods that exist:(a) process based(b) thread based(c) only process(d) both process & thread based

Answer» The correct answer is (d) both process & thread based

The best I can explain: There are two distinct types of multitasking: process-based and thread-based.
41.

Choose the correct statement about process-based multitasking.(a) A feature that allows our computer to run two or more programs concurrently(b) A program that acts as a small unit of code that can be dispatched by the scheduler(c) Only A program that acts as a small unit of code that can be dispatched by the scheduler(d) Both A feature that allows our computer to run two or more programs concurrently & A program that acts as a small unit of code that can be dispatched by the scheduler

Answer» Right answer is (d) Both A feature that allows our computer to run two or more programs concurrently & A program that acts as a small unit of code that can be dispatched by the scheduler

Easiest explanation - The process-based multitasking is the feature that allows your computer to run two or more programs concurrently. For example, process-based multitasking allows you to run a word processor at the same time you are using a spreadsheet or browsing the Internet. In process-based multitasking, a program is the smallest unit of code that can be dispatched by the scheduler.
42.

Which of these classes contains only floating point functions?(a) Math(b) Process(c) System(d) Object

Answer» The correct answer is (a) Math

Explanation: Math class contains all the floating point functions that are used for geometry, trigonometry, as well as several general purpose methods. Example : sin(), cos(), exp(), sqrt() etc.
43.

Choose the namespace which supports multithreading programming?(a) System.net(b) System.Linq(c) System.Threading(d) All of the mentioned

Answer» Correct answer is (c) System.Threading

Easy explanation - The classes that support multithreaded programming are defined in the System.Threading namespace. Thus, you will usually include this statement at the start of any multithreaded program.
44.

Which among the given classes provides types of rounding functions?(a) Math(b) Process(c) System(d) Object

Answer» Correct option is (a) Math

To explain: None.
45.

Which of these methods is a rounding function of Math class?(a) Max()(b) Min()(c) Abs()(d) Round()

Answer» Right choice is (d) Round()

Explanation: Round() rounds up a variable to nearest integer.
46.

Choose the correct statement about the WriteLine()?(a) Can display one or more value to the screen(b) Adds a newline character at the end of the each new output(c) Allows to output data in as many different formats(d) All of the mentioned

Answer» Correct choice is (d) All of the mentioned

Easiest explanation - By the definition of writeline().
47.

Name the exception thrown by read() on failure.(a) InterruptedException(b) SystemException(c) SystemInputException(d) I/O Exception

Answer» Correct answer is (d) I/O Exception

Explanation: read() throws I/O exception on failure.
48.

Which feature enables to obtain information about the use and capabilities of types at runtime?(a) Runtime type ID(b) Reflection(c) Attributes(d) None of the mentioned

Answer» Right option is (b) Reflection

Explanation: Reflection is the feature that enables you to obtain information about a type. The term reflection comes from the way the process works: A Type object mirrors the underlying type that it represents. Reflection is a powerful mechanism because it allows us to learn and use the capabilities of types that are known only at runtime.
49.

Which method in Console enables to read individual inputs directly from the keyboard in a non line buffered manner?(a) Read()(b) ReadKey()(c) ReadLine()(d) All of the mentioned

Answer» The correct option is (b) ReadKey()

To explain I would say: The .NET Framework includes a method in Console that enables you to read individual keystrokes directly from the keyboard, in a non-line-buffered manner. This method is called ReadKey(). When it is called, it waits until a key is pressed. When the key is pressed, ReadKey( ) returns the keystroke immediately.
50.

Which among the following methods are used to write characters to a string?(a) StreamWriter(b) StreamReader(c) StringWriter(d) None of the mentioned

Answer» The correct choice is (c) StringWriter

Best explanation: The stream class method writes characters to the string.