Event Driven Programming (03 & 04 Midterm)

0.0(0)
studied byStudied by 9 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/52

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

53 Terms

1
New cards

Exception

Is represented by classes. All the exceptions are subclasses in the built-in exception

2
New cards

ApplicationException (Type of Exceptions)

These exceptions are user program-generated

3
New cards

SystemException (Type of Exceptions)

These exceptions are generated by Common Language Runtime (CLR)

4
New cards

System.Exception

This is at the top of the standards’ exceptions hierarchy. The runtime system in C# generates all the exceptions.

5
New cards

System.ArithmeticException

Errors in arithmetic or conversion operation will be thrown in this exception.

6
New cards

System.OverflowException

When an overflow occurs in a checked operation, it will be thrown in this exception

7
New cards

System.ArgumentException

Any invalid argument in a method will be thrown in this exception.

8
New cards

System.ArgumentNullException

If there is an unacceptable argument passed to a method, it will be thrown in this exception

9
New cards

System.IndexOutOfRangeException

Throw in this exception when attempting to index an array through an index that is either less than zero or greater than the maximum length of index

10
New cards

System.OutOfMemoryException

If the available memory becomes too low to accommodate a memory allocation request, it will be thrown in this exception

11
New cards

System.StackOverflowException

Called when the execution stack is exhausted by having too many pending method callsSystem.FormatException

12
New cards

System.FormatException

Checks format of the string or argument if it is invalid

13
New cards

Try

This keyword is used to check for the occurrence of any exceptions enclosed to it

14
New cards

Catch

This keyword catches the exception that is thrown on the occurrence of exception in a try block

15
New cards

Throw

It is used to throw an exception manually

16
New cards

Finally

This keyword executes a given statement even if the exception is thrown or not thrown. This block cannot transfer control by using break, continue, return, or goto.

17
New cards

Create a try-catch-finally block

try{
//code
}
catch(typeOfException varName){
//code
}
finally{
//code
}

18
New cards

Create a throw exception

throw new exception_Object;

19
New cards

Create own exception

public class customizeException: Exception{
//code
}

20
New cards

Thread (Life Cycle of a Thread)

Can be found in the System.Threading namespace

21
New cards

Main Thread (Life Cycle of a Thread)

When using the Thread class, the first thread to be performed in a process is known as the main thread.

22
New cards

Child Thread (Life Cycle of a Thread)

Creating a child thread for the main thread should write or create a delegate object

23
New cards

Create a main thread

Thread mainThread = Thread.CurrentThread;
mainThread.Name = “Main Thread"

24
New cards

Create a Child Thread

ThreadStart delThread = new ThreadStart(ChildThreadMethod);
Thread childThread = new Thread(delThread);

25
New cards

Unstarted (Life Cycle of a Thread Harwani 2015)

A new thread begins its life cycle

26
New cards

Start (Life Cycle of a Thread Harwani 2015)

The thread remains in the Unstarted state until the Thread method _____ is called

27
New cards

Running (Life Cycle of a Thread Harwani 2015)

The Highest priority Started thread enters the ____ state

28
New cards

Abort (Life Cycle of a Thread Harwani 2015)

A Running thread enters the Stopped state when its job or task is over. Also, a running thread can be forced to the Stopped state by calling the ____ method.

29
New cards

Blocked (Life Cycle of a Thread Harwani 2015)

A thread enters _____ state when the thread issues an input/output request

30
New cards

Started (Life Cycle of a Thread Harwani 2015)

After I/O operations are complete, the Blocked thread returns to the ____ state

31
New cards

WaitSleepJoin (Life Cycle of a Thread Harwani 2015)

A Running thread may enter the ____ state either when it is asked to sleep for the specified number of milliseconds

32
New cards

Pulse (Life Cycle of a Thread Harwani 2015)

The ____ method moves the next waiting thread back to the Started state.

33
New cards

PulseAll (Life Cycle of a Thread Harwani 2015)

The _____ method moves all waiting threads back to the Started state.

34
New cards

Unstarted (List of Thread States)

A thread is created within the Common Language Runtime (CLR) but has not started

35
New cards

Ready (List of Thread States)

A thread is ready to run and is waiting for the CPU time

36
New cards

Running (List of Thread States)

A thread is in running mode after invoking its Start method.

37
New cards

WaitSleepJoin (List of Thread States)

A running thread is suspended temporarily by invoking either the Sleep method or the monitor’s Wait method

38
New cards

Started (List of Thread States)

A suspended thread resumes to Started state when the conditions for which is it was suspended are no longer valid.

39
New cards

Blocked (List of Thread States)

A thread is blocked when it is waiting for a resource or I/O operations

40
New cards

Stopped (List of Thread States)

A thread has finished its task.

41
New cards

CurrentThread (Properties of Thread Class)

It returns the current thread that is running

42
New cards

IsAlive (Properties of Thread Class)

It returns a Boolean value indicating the execution status of the recent thread.

43
New cards

IsBackground (Properties of Thread Class)

It is used to get or set a value that indicates whether the thread is a background thread

44
New cards

Name (Properties of Thread Class)

It is used to get or set the name of the thread

45
New cards

Priority (Properties of Thread Class)

It is used to get or set a value that represents the priority of a thread

46
New cards

ThreadState (Properties of Thread Class)

It is used to get the value that contains the states of the recent thread

47
New cards

public void Abort() (Methods of Thread Class)

It terminates the thread when calling this method and raises ThreadAbortException in the Thread

48
New cards

public void Interrupt() (Methods of Thread Class)

It interrupts the thread that is in the state of WaitSleepJoin

49
New cards

public void Join() (Methods of Thread Class)

It is used to stop the calling thread until a thread terminates

50
New cards

public static void ResetAbort() (Methods of Thread Class)

It is used to withdraw an abort request for the ongoing thread

51
New cards

public void Start() (Methods of Thread Class)

It is used to start a thread

52
New cards

public static void Sleep() (Methods of Thread Class)

It is used to pause a thread for the stated number of milliseconds

53
New cards

Multithreading

The CPU is assigned to each thread for a time slice before moving to the next thread.