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.

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 sourcesI have been asked this question in an online quiz.My question is based upon Multithreaded Programming in section Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

2.

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 blockedI had been asked this question in my homework.The query is from Multithreaded Programming in portion Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

3.

Which method is used to abort thread prior to it’s normal execution?(a) sleep()(b) terminate()(c) suspend()(d) Abort()The question was posed to me by my school teacher while I was bunking the class.This interesting question is from Multithreaded Programming in section Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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:
4.

What is Semaphore?(a) Grant more than one thread access to a shared resource at the same time(b) Useful when a collection of resources is being synchronized(c) Make use of a counter to control access to a shared resource(d) All of the mentionedI had been asked this question in an international level competition.Question is taken from Multithreaded Programming topic in division Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

Answer»

Correct answer is (d) All of the mentioned

To explain: A semaphore is SIMILAR to a mutex except that it can grant more than one thread access to a shared RESOURCE at the same time. Thus, the semaphore is useful when a collection of resources is being SYNCHRONIZED. A semaphore controls access to a shared resource through the USE of a counter. If the counter is greater than zero, then access is allowed. If it is zero, access is DENIED.

5.

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 mentionedThe question was posed to me in examination.My question comes from Multithreaded Programming topic in division Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

6.

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 mentionedThis question was addressed to me in an interview for internship.Query is from Multithreaded Programming topic in portion Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

7.

Which method is called when a thread is blocked from running temporarily?(a) Pulse()(b) PulseAll()(c) Wait()(d) Both Pulse() & Wait()This question was addressed to me in exam.Enquiry is from Multithreaded Programming in portion Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

8.

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 requireThe question was posed to me in unit test.Query is from Multithreaded Programming in portion Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

9.

Which keyword is used for using the synchronization features defined by the Monitor class?(a) lock(b) synchronized(c) monitor(d) lockedThe question was asked during an online exam.My question is taken from Multithreaded Programming topic in division Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

Answer»

Correct option is (a) LOCK

Best explanation: The C# keyword lock is really just shorthand for USING the synchronization features defined by the MONITOR CLASS, which is defined in the System.Threading namespace.

10.

Which of these keywords are used to implement synchronization?(a) synchronize(b) syn(c) synch(d) synchronizedI got this question in homework.My query is from Multithreaded Programming topic in section Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

Answer» CORRECT CHOICE is (d) synchronized

The EXPLANATION is: NONE.
11.

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 mentionedThe question was posed to me by my school teacher while I was bunking the class.My enquiry is from Multithreaded Programming in section Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

12.

Which of these classes is used to make a thread?(a) String(b) System(c) Thread(d) RunnableThis question was addressed to me in homework.I want to ask this question from Multithreaded Programming topic in portion Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

13.

Choose the namespace which supports multithreading programming?(a) System.net(b) System.Linq(c) System.Threading(d) All of the mentionedI got this question during an interview.The above asked question is from Multithreaded Programming in chapter Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.
14.

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 1I had been asked this question during an interview.Query is from Multithreaded Programming in portion Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

15.

Select the two type of threads mentioned in the concept of multithreading:(a) foreground(b) background(c) only foreground(d) both foreground & backgroundThe question was asked in an interview for internship.My question comes from Multithreaded Programming topic in section Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

Answer» RIGHT OPTION is (d) both FOREGROUND & background

Easy explanation - None.
16.

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 programsI had been asked this question in an interview for job.This interesting question is from Multithreaded Programming in portion Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

17.

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 programI have been asked this question in an interview for internship.The question is from Multithreaded Programming in division Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

18.

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 schedulerThis question was posed to me in an online interview.The query is from Multithreaded Programming in chapter Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

19.

Select the type of multitasking methods that exist:(a) process based(b) thread based(c) only process(d) both process & thread basedThe question was posed to me at a job interview.This is a very interesting question from Multithreaded Programming topic in chapter Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

20.

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)I had been asked this question in an interview for internship.My doubt is from Rounding Functions topic in division Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

21.

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)I had been asked this question in class test.The query is from Rounding Functions in portion Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

22.

Which of these classes contains only floating point functions?(a) Math(b) Process(c) System(d) ObjectI got this question at a job interview.Question is taken from Rounding Functions topic in chapter Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

Answer»

The CORRECT choice is (a) MATH

The explanation: Math class contains all the floating point functions that are USED for general PURPOSE mathematics methods. Example : sin(), cos(), EXP(), sqrt() etc.

23.

Which of these methods is a rounding function of Math class?(a) Max()(b) Min()(c) Abs()(d) Round()I got this question in unit test.This interesting question is from Rounding Functions topic in division Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

Answer» RIGHT choice is (d) Round()

EXPLANATION: Round() ROUNDS up a VARIABLE to NEAREST integer.
24.

Which among the given classes provides types of rounding functions?(a) Math(b) Process(c) System(d) ObjectI had been asked this question by my college professor while I was bunking the class.My query is from Rounding Functions topic in chapter Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

Answer» CORRECT OPTION is (a) Math

To EXPLAIN: NONE.
25.

Which of these classes contains only floating point functions?(a) Math(b) Process(c) System(d) ObjectI got this question in a national level competition.Origin of the question is Maths Class topic in section Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

26.

Choose the method defined by MemberInfo.(a) GetCustomAttributes()(b) IsDefined()(c) GetCustomeAttributesData()(d) All of the mentionedThis question was addressed to me in an online interview.I would like to ask this question from Introduction of Reflections topic in division Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

27.

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 ReflectedTypeThis question was addressed to me in exam.My question is taken from Introduction of Reflections topic in chapter Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

Answer»

The correct OPTION is (c) MODULE Module

Easiest explanation - By DEFINITION.

28.

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 mentionedI got this question in an online quiz.Question is from Introduction of Reflections topic in division Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

Answer»

Correct OPTION is (b) System.Reflection.MemberInfo

Explanation: TYPE is DERIVED from an abstract CLASS called System.Reflection.MemberInfo

29.

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 runtimeI got this question in an international level competition.Question is taken from Introduction of Reflections topic in chapter Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.

30.

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 mentionedI got this question in semester exam.This interesting question is from Introduction of Reflections topic in division Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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;

31.

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 mentionedThis question was addressed to me in an interview for internship.Origin of the question is Introduction of Reflections in portion Reflections, Multithreaded Programming, Collection Classes and Mathematical Functions of C#

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.