1/34
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
C. Main Thread
This is the first thread to be performed in a process.
A. Parent Thread
B. Child Thread
C. Main Thread
D. Start Thread
B. ApplicationException
Which basic type of exception is user program-
generated?
A. ArithmeticException
B. ApplicationException
C. SystemException
D. ThreadException
B. Unstarted
In this thread state, the thread is created within the
CLR but is not in progress.
A. Ready
B. Unstarted
C. WaitSleepJoin
D. Blocked
B. ThreadState
What property is used to get the value that contains
the states of the recent thread?
A. Priority
B. ThreadState
C. CurrentThread
D. IsAlive
B. System.Threading
Which namespace Includes the Thread class?
A. System.Multithread
B. System.Threading
C. System.Multithread.Thread
D. System.Threaded
D. OutOfMemoryException
Which exception is thrown when the available
memory is too low to accommodate?
A. LowMemoryException
B. OverflowException
C. IndexOutOfRangeException
D. OutOfMemoryException
B. Running
This thread state indicates that a thread is at the
time of execution after invoking its Start method.
A. Ready
B. Running
C. Started
D. WaitSleepJoin
B. Common Language Runtime
What does CLR stand for?
A. Computer Language Running
B. Common Language Runtime
C. Common Languages Running
D. Computer Languages Runtime
D. Stopped
This is the state when the thread has completed its
task.
A. Blocked
B. Started
C. Unstarted
D. Stopped
C. FormatException
This exception occurs when the format of the
argument is invalid.
A. InvalidFormatException
B. StackOverflowException
C. FormatException
D. OutOfFormatException
B. ArgumentException
Which of the following exceptions is thrown when an
argument inside the method is invalid?
A. InvalidException
B. ArgumentException
C. InvalidMethodException
D. InvalidArgumentException
A. IndexOutOfRangeException
This exception occurs when attempting to index an
array through an index that is greater than the
maximum length of the index.
A. IndexOutOfRangeException
B. IndexRangeException
C. ArgumentRangeException
D. FormatRangeException
C. Name
This property is used to set the name of the thread.
A. IsName
B. ThreadName
C. Name
D. SetName
C. StackOverflowException
This exception occurs when the execution stack is
exhausted by having too many pending method
calls.
A. OutOfMemoryException
B. IndexOutOfRangeException
C. StackOverflowException
D. ArgumentException
A. CurrentThread
This is used to retum the currently executing thread.
A. CurrentThread
B. Running
C. IsBackground
D. Name
B.
try
{
Console.Write(x + " ");
Thread.Sleep(1000);
}
catch(ThreadAbortException ex)
{
if((int)ex.ExceptionState == 0)
{
Thread.ResetAbort();
}
}
A. ThreadStart ts = new
ThreadStart(methodName);
Which of the following syntax is used in instantiating
a ThreadStart?
A. ThreadStart ts = new
ThreadStart(methodName);
B. ThreadStart ts = new Thread(methodName);
C. ThreadStart ts = Thread(methodName);
D. ThreadStart ts = CurrentThread();
A. It inherits the Exception class
Which of the following statements is TRUE about
customized exception?
A. It inherits the Exception class
B. It uses a method to set the string message.
C. It cannot be thrown but can be called in the
catch keyword.
D. It contains a child thread for its process.
D. throw new FormatException();
Which of the following is the correct format when
manually throwing an exception?
A. throw new FormatException;
B. throw FormatException();
C. throw FormatException{};
D. throw new FormatException();
D. Value
What is the output of the following code?
try
{
Console.WriteLine("Value:" + “ “);
}
catch(Exception ex)
{
Console.WriteLine("Null Error"):
}
A. Null Error
B. ArgumentNullException
C. “ “
D. Value
B. Thread_myThread = new Thread(new
ThreadStart(Method1));
_myThread.Start();
Which of the following is the correct syntax to begin
a thread?
A. Thread_myThread = new Thread(new
ThreadStart(Method1));
_myThread.Begin();
B. Thread_myThread = new Thread(new
ThreadStart(Method1));
_myThread.Start();
C. Thread_myThread = new Thread(new
ThreadStart(Method1));
_myThread.Initialize();
D. Thread_myThread = new Thread(new
ThreadStart(Method1)):
_myThread.Interrupt();
C. Total: 4
End!
What is the output of the following code?
try
{
int x = 20; int y = x/ 5;
Console.WriteLine("Total: " + y);
}
finally
{
Console.WriteLine(" End! ");
}
A. Total: 4
B. End!
C. Total: 4
End!
D. 20
D. None of the above
What is the output of the following code?
int zero = 0;
try
{
int result = 5 / 3;
}
catch(Exception ex)
{
Console.WriteLine("\nException: {0}”,ex.Message);
}
A. Result: 1
B. Exception: DivideByZeroException
C. ExceptionArgumentException
D. None of the above
C. Thread.CurrentThread.Name = "Main Thread";
Which of the following is the correct syntax for
setting the name of the current thread?
A. Thread.GetCurrentThread = threadName;
B. Thread.Name = threadName;
C. Thread.CurrentThread.Name = "Main Thread";
D. None of the above.
A.
_threadA.Start():
_threadB.Start():
_threadA.Join();
_threadB.Join();
Which of the following is the correct syntax to stop
calling another thread unless the current thread
terminates?
A.
_threadA.Start():
_threadB.Start():
_threadA.Join();
_threadB.Join();
B.
_threadA.Start();
_threadB.Start();
_threadA.Terminat;
_threadB.Terminate();
C.
_threadA.Start();
_threadB.Start():
_threadA.Stop();
_threadB.Stop();
D.
_threadA.Start();
_threadB.Start();
_threadA.Wait();
_threadB.Wait()
A. Thread_threadA = new Thread(new
ThreadStart(methodA));
Thread.Sleep(200);
This method is used to pause a thread for the stated
number in milliseconds.
A. ThreadthreadA = new Thread(new
ThreadStart(methodA));
Thread.Sleep(200);
B. ThreadthreadA = new Thread(new
ThreadStart(methodA));
Thread.Snooze(200);
C. ThreadthreadA = new Thread(new
ThreadStart(methodA));
Thread.Pause(200);
D. ThreadthreadA = new Thread(new
ThreadStart(methodA));
Thread.Timer(200);
D. thread1.Name = "My First Thread";
Which of the following statements assigns a name
to a thread?
A. thread1 ="My First Thread";
B. Name = "My First Thread";
C. thread1.Name("My First Thread");
D. thread1.Name = "My First Thread";
B. Total: 15
What is the output of the following code?
public int GetSum(int num1, int num2)
{
return num1 + num2;
}
public void ValidateSum()
{
try
{
Console.WriteLine("Total: " + GetSum(10,5));
}
catch(Exception ex)
{
Console.WriteLine("Error");
}
}
A. Error
B. Total: 15
C. Invalid Input
D. ArithmeticException
A. It is an independent execution unit containing a
piece of code.
Which of the following statements is TRUE when
using a Thread class?
A. It is an independent execution unit containing a
piece of code.
B. The first thread in a process to be performed is
known as the parent thread, which is followed
by main thread.
C. It can only be paused and destroyed.
D. It uses a class named ThreadStarted.Name to
run the program.
D. All exception types are subclasses in the built-in
class, Exception.
Which of the following statements is TRUE about
exceptions?
A. These are used to create and control threads in
a system.
B. These contain child exception.
C. The finally keyword can transfer control using
break in handling exceptions.
D. All exception types are subclasses in the built-in
class, Exception.
C. FormatExceptionX
What is the output of the following code?
try
{
int x,y; y = Convert.Tolnt32("p1"); x= 5/y;
Console.WriteLine("Correct");
}
catch(FormatException ex)
{
Console.Write("FormatException");
}
finally
{
Console.Write("X");
}
A. FormatException
B. CorrectX
C. FormatExceptionX
D. CorrectFormatExceptionX
A. class NumberFormatException: Exception
{
public NumberFormatException(){}
}
Which of the following syntax is correct in creating a
custom exception?
A. class NumberFormatException: Exception
{
public NumberFormatException(){}
}
B. class NumberFormatException
{
NumberFormatException(){}
}
C. class Exception
{
public void NumberFormatException(){}
}
D. class Exception: NumberFormatException
{
}
C. A sleeping thread returns to the Started state
when the specified sleep duration expires.
Which of the following statements is TRUE about
the life cycle of a thread?
A. The lowest priority Started thread enters the
Stopped state.
B. In life cycle of a thread, the Blocked thread
returns to the Unstarted state after the I/O
operations are complete so it can resume
execution.
C. A sleeping thread returns to the Started state
when the specified sleep duration expires.
D. A new thread begins its life cycle in the Started
state.
A. Invalid Format
What is the output of the following code?
try
{
string num = “ “;
int getNumVal = Convert.Tolnt32(num);
Console.WriteLine("Value: " + getNumVal);
}
catch(DivideByZeroException ex)
{
Console.WriteLine("Null Value");
}
catch(FormatException fe)
{
Console.WriteLine("Invalid Format");
}
A. Invalid Format
B. Null Value
C. Value: "“
D. Null Value
Invalid Format
A. Runtime Error
What is the output of the following code?
try
{
throw new StackOverflowException("Ex");
Console.WriteLine("Exception Error");
}
catch(ArithmeticException ex);
{
Console.WriteLine("Exception Caught");
}
A. Runtime Error
B. Exception Error
C. Exception Caught
D. E