Multiple Choice: 2 pts each CS-3020 Exam #3 (CH16-CH21) FORM: EX03:P

Size: px
Start display at page:

Download "Multiple Choice: 2 pts each CS-3020 Exam #3 (CH16-CH21) FORM: EX03:P"

Transcription

1 Multiple Choice: 2 pts each CS-3020 Exam #3 (CH16-CH21) FORM: EX03:P Choose the BEST answer of those given and enter your choice on the Answer Sheet. You may choose multiple options, but the point value will be divided by the number of options chosen. #1 Class String and the Char structure are found in the: Strings namespace System.Strings namespace System.Text namespace System namespace System.Chars namespace #2 A string literal: contains letters and punctuation only. is a sequence of characters in double quotation marks. contains exactly its variable name and nothing else. contains only one character. contains numbers rather than letters. #3 To create a string literal that excludes escape sequences, use: #"string" $"string"!"string" #4 The bounds on a string are always: 0 to string.length. 0 to string.length to string.length to string.length. 1 to string.length - 1. #5 string indexers treat strings as: arrays of characters ASCII code a character a string array binary code

2 #6 If an IndexOfAny method is passed an array of characters it: returns the number of occurrences that were found withing the string. generates an error. searches for the first occurrence in the string of any of the characters in the array. finds the first occurrence of each letter in the string. will search for the first occurrence of the sequence of characters. #7 Concatenating with strings is done with: operator overloading. method calls. reserved words. operator overloading and method calls. extension methods. #8 The proper way to convert a string to all lowercase is: STRING = string; string.tolower( string ); string.tolower(); ToLower( string ); (lower) string; #9 Which of the following is not an example of a struct: a char an int a byte a double a string #10 What is the efficiency of linear search? O(n). O(log n). O(n^2). O(1). O(n log n). 2

3 #11 What is the term used for binary search's run time? Polynomial run time. Logarithmic run time. Quadratic run time. Constant run time. Linear run time. #12 What does the first pass of quicksort sort do? Orders the first two elements of the array. Places the largest item at the end of the array. Splits the array into two approximately equal pieces. Partitions the array into two unequal pieces depending on whether each element in the array is greater or less that some pivot element. Locates the smallest element in the array and swaps it into the zeroth position. #13 Which of the following sorting algorithms is, on average, the fastest when sorting a large array? Selection sort They all run at roughly the same speed Quick sort Merge sort Insertion sort #14 Dynamic data structures grow and shrink at time. creation run link load compile #15 Every simple type struct inherits from class. Primitive ValueType SimpleType Struct Number 3

4 #16 A(n) conversion is when an object is cast into another type. wrapping converting boxing unboxing implicit #17 A class contains a reference member that refers to an object of the same class type. self-pointing self-determining self-referential self-reflective self-linking #18 Usually a indicates to a program the end of a data structure. null reference forward slash character null pointer backslash character space character #19 An IsEmpty method you write to test whether a linked list is empty is called a method. predefined preferred preemption preorder predicate #20 A stack is a data structure. LOFI One-way FILO FOLI LIFO 4

5 #21 A queue is a data structure. FOFI FIFO IFOF OFIF One-way #22 enable you to specify, with a single class declaration, a set of related classes. Collections Generic classes Generics Overriden classes Overloaded classes #23 Generics provide that allows the compiler to catch invalid types. run-time type safety compile-time error checking compile-time exception checking link-time type safety compile-time type safety #24 When a method is called, the compiler tries to find a method that matches the of the method call. name, argument types, and return type name and argument types argument types return type name #25 All generic method declarations have a type parameter section delimited by. pipes (' ') square brackets ( '[' and ']' ) angle brackets ( '<' and '>' ) parenthesis ( '(' and ')' ) curly brackets ( '{' and '}' ) 5

6 #26 The clause specifies the type constraint for type parameter T. when where constraint cnstr types #27 A(n) provides a means for describing a class in a type-independent manner. parameterized class generic class concrete class abstract class subclass #28 Prepackaged data-structure classes provided by the.net Framework are called. data structural classes data classes DS classes collection classes abstract data type classes #29 Which of the following is not a collection class in C#? File SortedDictionary HashTable ArrayList BitArray #30 One should use the collections from the namespace to help specify the exact type that will be stored in a collection. System.Collections.Specialized System.Collections System.Collections.Typed System.GenericCollections System.Collections.Generics 6

7 #31 Which of the following is not a method provided by an array? Index BinarySearch Copy Sort Reverse #32 Classes which implement the IEnumerator interface must contain which of the following methods? MoveNext, Reset, Reverse MoveNext, Current, Reverse MoveNext, Reset, Current Reset, Current, Reverse Enumerate, First, Current #33 How is an ArrayList different from a regular array? Both are the same; however one is a naming convention of C# the size is dynamic it can hold objects of various types and has a dynamic size arrays can only hold primitive data types it can hold objects of various types #34 Peek throws a(n) if the stack is empty. EmptyException StackEmptyException InvalidMethodOrPropertyException InvalidOperationException PeekException #35 When two different keys "hash into" the same cell in an array, this is known as a(n). collision conjunction crash problem error 7

8 #36 The is the ratio of the number of objects stored in the hash table to the total number of cells of the hash table. packing factor density proportion share load factor #37 The enumerator of a HashTable uses the structure to store key-value pairs. Connection Relationship KeyValue Bond DictionaryEntry #38 A(n) performs a calculation that determines where to place data in the hash table. indexer calculator converter definition hash function #39 A is the general term for a collection of key-value pairs. codebook book dictionary glossary lexicon #40 All arrays implicitly inherit from which generic interface? IComparable IEnumerator IList IEnumerable Both IList and IEnumerable 8

9 #41 To determine if the string object mystring begins with the "Four" you might use mystring.startswith("four") String.StartsWith(myString, "Four") mystring.beginswith("four") mystring[0:4] == "Four" mystring.starts("four") #42 The expression: mystring.toupper() does not change the contents of the object mystring. is a syntax error. returns the Boolean value True if mystring consists only of uppercase characters. throws an exception if mystring contains any characters that are not letters. converts the contents of mystring to all upper case. #43 To perform file processing, which namespace must be imported? System.FileIO System.Directory System.IO System.File System.System #44 A dialog box that prevents you from interacting with any other window until you have closed it is termed a(n) preemptive dialog. modal dialog. priority dialog. blocking dialog. assertive dialog. #45 Quicksort's worst-case performance is O(n^2) O(n log(n)) O(n) O(log(n)) O(n^3) 9

10 #46 Which of the following sorting routines runs in O(log(n)) time? Binary Sort Quick Sort Insertion Sort No sorting routine can run in log(n) time Merge Sort #47 Which of the follow describes the defining rule for a minimum heap? Each parent must be greater than the left child and smaller than the right child. Each parent must be larger than its left child and no larger than its right child. Each parent must be smaller than either of its children. Each parent must be larger than either of its children. Each parent can be no larger than either of its children. #48 Which type of traversal will print out the elements of a binary tree in order? Pre-order traversal Bottom-up level traversal Top-down level traversal Post-order traversal In-order traversal #49 A generic type without any specified type constraints must work for any and all data types that ever have and ever will be defined. will through runtime exceptions if an incompatible type is used. will only work with classes that implement the IComparable interface. will downcast types to a compatible type if needed. will only work with classes that implement the IGeneric interface. #50 What type of objects can be used as keys in a hash table? Only objects that implement the IComparable interface. Only objects that inherit from the class Hashable. Only objects that implement the IHashable interface. Any object. Only objects that inherit from the class Hashtable. 10

11 Multiple Choice: 2 pts each CS-3020 Exam #3 (CH16-CH21) FORM: EX03:Q Choose the BEST answer of those given and enter your choice on the Answer Sheet. You may choose multiple options, but the point value will be divided by the number of options chosen. #1 Class String and the Char structure are found in the: Strings namespace System.Chars namespace System.Text namespace System.Strings namespace System namespace #2 A string literal: contains exactly its variable name and nothing else. contains letters and punctuation only. contains numbers rather than letters. contains only one character. is a sequence of characters in double quotation marks. #3 To create a string literal that excludes escape sequences, use: #"string" $"string" #4 The bounds on a string are always: 0 to string.length. 1 to string.length. 0 to string.length to string.length to string.length - 1. #5 string indexers treat strings as: a string array ASCII code arrays of characters a character binary code

12 #6 If an IndexOfAny method is passed an array of characters it: finds the first occurrence of each letter in the string. generates an error. returns the number of occurrences that were found withing the string. will search for the first occurrence of the sequence of characters. searches for the first occurrence in the string of any of the characters in the array. #7 Concatenating with strings is done with: method calls. reserved words. extension methods. operator overloading. operator overloading and method calls. #8 The proper way to convert a string to all lowercase is: STRING = string; (lower) string; string.tolower( string ); ToLower( string ); string.tolower(); #9 Which of the following is not an example of a struct: an int a double a char a byte a string #10 What is the efficiency of linear search? O(n^2). O(n). O(1). O(log n). O(n log n). 2

13 #11 What is the term used for binary search's run time? Quadratic run time. Constant run time. Logarithmic run time. Polynomial run time. Linear run time. #12 What does the first pass of quicksort sort do? Orders the first two elements of the array. Locates the smallest element in the array and swaps it into the zeroth position. Partitions the array into two unequal pieces depending on whether each element in the array is greater or less that some pivot element. Splits the array into two approximately equal pieces. Places the largest item at the end of the array. #13 Which of the following sorting algorithms is, on average, the fastest when sorting a large array? Quick sort Insertion sort They all run at roughly the same speed Selection sort Merge sort #14 Dynamic data structures grow and shrink at time. link compile load run creation #15 Every simple type struct inherits from class. Primitive Struct ValueType Number SimpleType 3

14 #16 A(n) conversion is when an object is cast into another type. unboxing wrapping boxing converting implicit #17 A class contains a reference member that refers to an object of the same class type. self-linking self-reflective self-referential self-determining self-pointing #18 Usually a indicates to a program the end of a data structure. space character backslash character null reference null pointer forward slash character #19 An IsEmpty method you write to test whether a linked list is empty is called a method. preemption predicate preferred predefined preorder #20 A stack is a data structure. FOLI One-way LOFI LIFO FILO 4

15 #21 A queue is a data structure. FOFI One-way FIFO OFIF IFOF #22 enable you to specify, with a single class declaration, a set of related classes. Generics Generic classes Collections Overloaded classes Overriden classes #23 Generics provide that allows the compiler to catch invalid types. compile-time exception checking compile-time error checking compile-time type safety link-time type safety run-time type safety #24 When a method is called, the compiler tries to find a method that matches the of the method call. name argument types name, argument types, and return type return type name and argument types #25 All generic method declarations have a type parameter section delimited by. pipes (' ') angle brackets ( '<' and '>' ) parenthesis ( '(' and ')' ) square brackets ( '[' and ']' ) curly brackets ( '{' and '}' ) 5

16 #26 The clause specifies the type constraint for type parameter T. when where types constraint cnstr #27 A(n) provides a means for describing a class in a type-independent manner. subclass generic class abstract class concrete class parameterized class #28 Prepackaged data-structure classes provided by the.net Framework are called. data structural classes collection classes DS classes abstract data type classes data classes #29 Which of the following is not a collection class in C#? HashTable File BitArray SortedDictionary ArrayList #30 One should use the collections from the namespace to help specify the exact type that will be stored in a collection. System.Collections System.Collections.Typed System.GenericCollections System.Collections.Generics System.Collections.Specialized 6

17 #31 Which of the following is not a method provided by an array? BinarySearch Index Copy Reverse Sort #32 Classes which implement the IEnumerator interface must contain which of the following methods? MoveNext, Reset, Reverse MoveNext, Current, Reverse Enumerate, First, Current MoveNext, Reset, Current Reset, Current, Reverse #33 How is an ArrayList different from a regular array? arrays can only hold primitive data types it can hold objects of various types and has a dynamic size the size is dynamic it can hold objects of various types Both are the same; however one is a naming convention of C# #34 Peek throws a(n) if the stack is empty. EmptyException InvalidOperationException PeekException StackEmptyException InvalidMethodOrPropertyException #35 When two different keys "hash into" the same cell in an array, this is known as a(n). error crash collision conjunction problem 7

18 #36 The is the ratio of the number of objects stored in the hash table to the total number of cells of the hash table. proportion packing factor density load factor share #37 The enumerator of a HashTable uses the structure to store key-value pairs. KeyValue DictionaryEntry Bond Connection Relationship #38 A(n) performs a calculation that determines where to place data in the hash table. converter hash function calculator definition indexer #39 A is the general term for a collection of key-value pairs. dictionary codebook lexicon glossary book #40 All arrays implicitly inherit from which generic interface? IEnumerable IList IComparable IEnumerator Both IList and IEnumerable 8

19 #41 To determine if the string object mystring begins with the "Four" you might use mystring[0:4] == "Four" mystring.startswith("four") mystring.beginswith("four") String.StartsWith(myString, "Four") mystring.starts("four") #42 The expression: mystring.toupper() throws an exception if mystring contains any characters that are not letters. returns the Boolean value True if mystring consists only of uppercase characters. does not change the contents of the object mystring. converts the contents of mystring to all upper case. is a syntax error. #43 To perform file processing, which namespace must be imported? System.IO System.System System.Directory System.FileIO System.File #44 A dialog box that prevents you from interacting with any other window until you have closed it is termed a(n) blocking dialog. assertive dialog. priority dialog. modal dialog. preemptive dialog. #45 Quicksort's worst-case performance is O(log(n)) O(n log(n)) O(n) O(n^2) O(n^3) 9

20 #46 Which of the following sorting routines runs in O(log(n)) time? Insertion Sort Quick Sort Merge Sort Binary Sort No sorting routine can run in log(n) time #47 Which of the follow describes the defining rule for a minimum heap? Each parent must be larger than its left child and no larger than its right child. Each parent must be smaller than either of its children. Each parent can be no larger than either of its children. Each parent must be larger than either of its children. Each parent must be greater than the left child and smaller than the right child. #48 Which type of traversal will print out the elements of a binary tree in order? In-order traversal Pre-order traversal Bottom-up level traversal Post-order traversal Top-down level traversal #49 A generic type without any specified type constraints will downcast types to a compatible type if needed. will through runtime exceptions if an incompatible type is used. will only work with classes that implement the IGeneric interface. will only work with classes that implement the IComparable interface. must work for any and all data types that ever have and ever will be defined. #50 What type of objects can be used as keys in a hash table? Only objects that implement the IComparable interface. Only objects that inherit from the class Hashable. Only objects that inherit from the class Hashtable. Any object. Only objects that implement the IHashable interface. 10

21 Multiple Choice: 2 pts each CS-3020 Exam #3 (CH16-CH21) FORM: EX03:R Choose the BEST answer of those given and enter your choice on the Answer Sheet. You may choose multiple options, but the point value will be divided by the number of options chosen. #1 Class String and the Char structure are found in the: System.Chars namespace System.Text namespace System namespace System.Strings namespace Strings namespace #2 A string literal: contains only one character. contains exactly its variable name and nothing else. contains letters and punctuation only. contains numbers rather than letters. is a sequence of characters in double quotation marks. #3 To create a string literal that excludes escape sequences, use: \"string" $"string" #4 The bounds on a string are always: 0 to string.length to string.length to string.length to string.length. 1 to string.length. #5 string indexers treat strings as: a character a string array arrays of characters binary code ASCII code

22 #6 If an IndexOfAny method is passed an array of characters it: returns the number of occurrences that were found withing the string. will search for the first occurrence of the sequence of characters. searches for the first occurrence in the string of any of the characters in the array. finds the first occurrence of each letter in the string. generates an error. #7 Concatenating with strings is done with: extension methods. operator overloading. operator overloading and method calls. method calls. reserved words. #8 The proper way to convert a string to all lowercase is: (lower) string; string.tolower( string ); string.tolower(); ToLower( string ); STRING = string; #9 Which of the following is not an example of a struct: a byte a char an int a double a string #10 What is the efficiency of linear search? O(n^2). O(n). O(log n). O(1). O(n log n). 2

23 #11 What is the term used for binary search's run time? Quadratic run time. Linear run time. Constant run time. Polynomial run time. Logarithmic run time. #12 What does the first pass of quicksort sort do? Locates the smallest element in the array and swaps it into the zeroth position. Splits the array into two approximately equal pieces. Partitions the array into two unequal pieces depending on whether each element in the array is greater or less that some pivot element. Orders the first two elements of the array. Places the largest item at the end of the array. #13 Which of the following sorting algorithms is, on average, the fastest when sorting a large array? Insertion sort Selection sort They all run at roughly the same speed Quick sort Merge sort #14 Dynamic data structures grow and shrink at time. link run load compile creation #15 Every simple type struct inherits from class. Number ValueType Struct Primitive SimpleType 3

24 #16 A(n) conversion is when an object is cast into another type. boxing unboxing implicit converting wrapping #17 A class contains a reference member that refers to an object of the same class type. self-linking self-referential self-determining self-reflective self-pointing #18 Usually a indicates to a program the end of a data structure. forward slash character space character null pointer backslash character null reference #19 An IsEmpty method you write to test whether a linked list is empty is called a method. predefined predicate preferred preemption preorder #20 A stack is a data structure. FOLI LOFI FILO One-way LIFO 4

25 #21 A queue is a data structure. FOFI IFOF FIFO One-way OFIF #22 enable you to specify, with a single class declaration, a set of related classes. Overloaded classes Collections Overriden classes Generic classes Generics #23 Generics provide that allows the compiler to catch invalid types. compile-time exception checking compile-time error checking link-time type safety run-time type safety compile-time type safety #24 When a method is called, the compiler tries to find a method that matches the of the method call. name and argument types name argument types return type name, argument types, and return type #25 All generic method declarations have a type parameter section delimited by. curly brackets ( '{' and '}' ) pipes (' ') square brackets ( '[' and ']' ) parenthesis ( '(' and ')' ) angle brackets ( '<' and '>' ) 5

26 #26 The clause specifies the type constraint for type parameter T. where constraint when cnstr types #27 A(n) provides a means for describing a class in a type-independent manner. concrete class generic class parameterized class abstract class subclass #28 Prepackaged data-structure classes provided by the.net Framework are called. data classes DS classes data structural classes collection classes abstract data type classes #29 Which of the following is not a collection class in C#? File HashTable SortedDictionary ArrayList BitArray #30 One should use the collections from the namespace to help specify the exact type that will be stored in a collection. System.GenericCollections System.Collections.Generics System.Collections System.Collections.Typed System.Collections.Specialized 6

27 #31 Which of the following is not a method provided by an array? Index BinarySearch Copy Reverse Sort #32 Classes which implement the IEnumerator interface must contain which of the following methods? MoveNext, Reset, Reverse Enumerate, First, Current MoveNext, Current, Reverse MoveNext, Reset, Current Reset, Current, Reverse #33 How is an ArrayList different from a regular array? it can hold objects of various types and has a dynamic size the size is dynamic it can hold objects of various types arrays can only hold primitive data types Both are the same; however one is a naming convention of C# #34 Peek throws a(n) if the stack is empty. StackEmptyException InvalidMethodOrPropertyException PeekException EmptyException InvalidOperationException #35 When two different keys "hash into" the same cell in an array, this is known as a(n). crash collision error conjunction problem 7

28 #36 The is the ratio of the number of objects stored in the hash table to the total number of cells of the hash table. proportion share load factor density packing factor #37 The enumerator of a HashTable uses the structure to store key-value pairs. DictionaryEntry Connection Relationship Bond KeyValue #38 A(n) performs a calculation that determines where to place data in the hash table. calculator indexer definition hash function converter #39 A is the general term for a collection of key-value pairs. codebook lexicon dictionary glossary book #40 All arrays implicitly inherit from which generic interface? IComparable IEnumerable Both IList and IEnumerable IEnumerator IList 8

29 #41 To determine if the string object mystring begins with the "Four" you might use mystring.startswith("four") String.StartsWith(myString, "Four") mystring.beginswith("four") mystring[0:4] == "Four" mystring.starts("four") #42 The expression: mystring.toupper() throws an exception if mystring contains any characters that are not letters. returns the Boolean value True if mystring consists only of uppercase characters. converts the contents of mystring to all upper case. does not change the contents of the object mystring. is a syntax error. #43 To perform file processing, which namespace must be imported? System.System System.File System.IO System.FileIO System.Directory #44 A dialog box that prevents you from interacting with any other window until you have closed it is termed a(n) priority dialog. modal dialog. blocking dialog. assertive dialog. preemptive dialog. #45 Quicksort's worst-case performance is O(n^3) O(log(n)) O(n^2) O(n) O(n log(n)) 9

30 #46 Which of the following sorting routines runs in O(log(n)) time? No sorting routine can run in log(n) time Merge Sort Binary Sort Quick Sort Insertion Sort #47 Which of the follow describes the defining rule for a minimum heap? Each parent must be greater than the left child and smaller than the right child. Each parent must be larger than either of its children. Each parent can be no larger than either of its children. Each parent must be larger than its left child and no larger than its right child. Each parent must be smaller than either of its children. #48 Which type of traversal will print out the elements of a binary tree in order? In-order traversal Top-down level traversal Bottom-up level traversal Post-order traversal Pre-order traversal #49 A generic type without any specified type constraints will through runtime exceptions if an incompatible type is used. will only work with classes that implement the IComparable interface. will downcast types to a compatible type if needed. will only work with classes that implement the IGeneric interface. must work for any and all data types that ever have and ever will be defined. #50 What type of objects can be used as keys in a hash table? Only objects that implement the IHashable interface. Any object. Only objects that inherit from the class Hashtable. Only objects that implement the IComparable interface. Only objects that inherit from the class Hashable. 10

31 Multiple Choice: 2 pts each CS-3020 Exam #3 (CH16-CH21) FORM: EX03:S Choose the BEST answer of those given and enter your choice on the Answer Sheet. You may choose multiple options, but the point value will be divided by the number of options chosen. #1 Class String and the Char structure are found in the: System namespace System.Strings namespace System.Text namespace Strings namespace System.Chars namespace #2 A string literal: contains letters and punctuation only. contains numbers rather than letters. contains only one character. is a sequence of characters in double quotation marks. contains exactly its variable name and nothing else. #3 To create a string literal that excludes escape sequences, $"string" \"string" #"string"!"string" #4 The bounds on a string are always: 0 to string.length to string.length to string.length. 0 to string.length to string.length. #5 string indexers treat strings as: a character binary code a string array ASCII code arrays of characters

32 #6 If an IndexOfAny method is passed an array of characters it: returns the number of occurrences that were found withing the string. finds the first occurrence of each letter in the string. generates an error. searches for the first occurrence in the string of any of the characters in the array. will search for the first occurrence of the sequence of characters. #7 Concatenating with strings is done with: operator overloading. operator overloading and method calls. reserved words. method calls. extension methods. #8 The proper way to convert a string to all lowercase is: string.tolower(); STRING = string; string.tolower( string ); (lower) string; ToLower( string ); #9 Which of the following is not an example of a struct: a double an int a string a byte a char #10 What is the efficiency of linear search? O(n log n). O(log n). O(1). O(n). O(n^2). 2

33 #11 What is the term used for binary search's run time? Logarithmic run time. Polynomial run time. Constant run time. Quadratic run time. Linear run time. #12 What does the first pass of quicksort sort do? Orders the first two elements of the array. Splits the array into two approximately equal pieces. Locates the smallest element in the array and swaps it into the zeroth position. Partitions the array into two unequal pieces depending on whether each element in the array is greater or less that some pivot element. Places the largest item at the end of the array. #13 Which of the following sorting algorithms is, on average, the fastest when sorting a large array? Insertion sort They all run at roughly the same speed Quick sort Selection sort Merge sort #14 Dynamic data structures grow and shrink at time. link load compile creation run #15 Every simple type struct inherits from class. Struct SimpleType Number Primitive ValueType 3

34 #16 A(n) conversion is when an object is cast into another type. converting implicit boxing unboxing wrapping #17 A class contains a reference member that refers to an object of the same class type. self-linking self-pointing self-reflective self-referential self-determining #18 Usually a indicates to a program the end of a data structure. null reference forward slash character space character backslash character null pointer #19 An IsEmpty method you write to test whether a linked list is empty is called a method. preemption preferred predefined preorder predicate #20 A stack is a data structure. LIFO FOLI FILO One-way LOFI 4

35 #21 A queue is a data structure. IFOF One-way OFIF FIFO FOFI #22 enable you to specify, with a single class declaration, a set of related classes. Generics Overriden classes Generic classes Overloaded classes Collections #23 Generics provide that allows the compiler to catch invalid types. compile-time exception checking compile-time type safety run-time type safety compile-time error checking link-time type safety #24 When a method is called, the compiler tries to find a method that matches the of the method call. name argument types return type name and argument types name, argument types, and return type #25 All generic method declarations have a type parameter section delimited by. parenthesis ( '(' and ')' ) square brackets ( '[' and ']' ) angle brackets ( '<' and '>' ) pipes (' ') curly brackets ( '{' and '}' ) 5

36 #26 The clause specifies the type constraint for type parameter T. types cnstr where constraint when #27 A(n) provides a means for describing a class in a type-independent manner. parameterized class generic class concrete class abstract class subclass #28 Prepackaged data-structure classes provided by the.net Framework are called. data structural classes collection classes data classes DS classes abstract data type classes #29 Which of the following is not a collection class in C#? ArrayList File BitArray HashTable SortedDictionary #30 One should use the collections from the namespace to help specify the exact type that will be stored in a collection. System.Collections.Specialized System.GenericCollections System.Collections System.Collections.Typed System.Collections.Generics 6

37 #31 Which of the following is not a method provided by an array? Sort BinarySearch Reverse Index Copy #32 Classes which implement the IEnumerator interface must contain which of the following methods? MoveNext, Reset, Current MoveNext, Reset, Reverse Reset, Current, Reverse Enumerate, First, Current MoveNext, Current, Reverse #33 How is an ArrayList different from a regular array? Both are the same; however one is a naming convention of C# it can hold objects of various types arrays can only hold primitive data types it can hold objects of various types and has a dynamic size the size is dynamic #34 Peek throws a(n) if the stack is empty. InvalidMethodOrPropertyException InvalidOperationException EmptyException PeekException StackEmptyException #35 When two different keys "hash into" the same cell in an array, this is known as a(n). problem crash collision error conjunction 7

38 #36 The is the ratio of the number of objects stored in the hash table to the total number of cells of the hash table. share density packing factor load factor proportion #37 The enumerator of a HashTable uses the structure to store key-value pairs. KeyValue Bond Relationship DictionaryEntry Connection #38 A(n) performs a calculation that determines where to place data in the hash table. hash function indexer calculator converter definition #39 A is the general term for a collection of key-value pairs. codebook book glossary dictionary lexicon #40 All arrays implicitly inherit from which generic interface? IEnumerable IEnumerator IComparable IList Both IList and IEnumerable 8

39 #41 To determine if the string object mystring begins with the "Four" you might use String.StartsWith(myString, "Four") mystring.beginswith("four") mystring[0:4] == "Four" mystring.starts("four") mystring.startswith("four") #42 The expression: mystring.toupper() converts the contents of mystring to all upper case. returns the Boolean value True if mystring consists only of uppercase characters. throws an exception if mystring contains any characters that are not letters. does not change the contents of the object mystring. is a syntax error. #43 To perform file processing, which namespace must be imported? System.File System.FileIO System.System System.Directory System.IO #44 A dialog box that prevents you from interacting with any other window until you have closed it is termed a(n) priority dialog. blocking dialog. preemptive dialog. modal dialog. assertive dialog. #45 Quicksort's worst-case performance is O(n^2) O(log(n)) O(n) O(n^3) O(n log(n)) 9

40 #46 Which of the following sorting routines runs in O(log(n)) time? Binary Sort Merge Sort Quick Sort Insertion Sort No sorting routine can run in log(n) time #47 Which of the follow describes the defining rule for a minimum heap? Each parent must be smaller than either of its children. Each parent can be no larger than either of its children. Each parent must be larger than either of its children. Each parent must be larger than its left child and no larger than its right child. Each parent must be greater than the left child and smaller than the right child. #48 Which type of traversal will print out the elements of a binary tree in order? In-order traversal Bottom-up level traversal Pre-order traversal Top-down level traversal Post-order traversal #49 A generic type without any specified type constraints will only work with classes that implement the IComparable interface. must work for any and all data types that ever have and ever will be defined. will only work with classes that implement the IGeneric interface. will downcast types to a compatible type if needed. will through runtime exceptions if an incompatible type is used. #50 What type of objects can be used as keys in a hash table? Only objects that implement the IHashable interface. Only objects that implement the IComparable interface. Any object. Only objects that inherit from the class Hashtable. Only objects that inherit from the class Hashable. 10

41 Multiple Choice: 2 pts each CS-3020 Exam #3 (CH16-CH21) FORM: EX03:T Choose the BEST answer of those given and enter your choice on the Answer Sheet. You may choose multiple options, but the point value will be divided by the number of options chosen. #1 Class String and the Char structure are found in the: System.Text namespace System.Chars namespace System namespace System.Strings namespace Strings namespace #2 A string literal: contains numbers rather than letters. contains exactly its variable name and nothing else. is a sequence of characters in double quotation marks. contains letters and punctuation only. contains only one character. #3 To create a string literal that excludes escape sequences, use: \"string" #"string" #4 The bounds on a string are always: 0 to string.length. 1 to string.length to string.length to string.length to string.length. #5 string indexers treat strings as: a character ASCII code arrays of characters a string array binary code

42 #6 If an IndexOfAny method is passed an array of characters it: finds the first occurrence of each letter in the string. generates an error. returns the number of occurrences that were found withing the string. searches for the first occurrence in the string of any of the characters in the array. will search for the first occurrence of the sequence of characters. #7 Concatenating with strings is done with: reserved words. operator overloading. operator overloading and method calls. extension methods. method calls. #8 The proper way to convert a string to all lowercase is: string.tolower( string ); ToLower( string ); STRING = string; string.tolower(); (lower) string; #9 Which of the following is not an example of a struct: a string a byte a char a double an int #10 What is the efficiency of linear search? O(n^2). O(log n). O(n log n). O(n). O(1). 2

43 #11 What is the term used for binary search's run time? Logarithmic run time. Polynomial run time. Constant run time. Quadratic run time. Linear run time. #12 What does the first pass of quicksort sort do? Locates the smallest element in the array and swaps it into the zeroth position. Splits the array into two approximately equal pieces. Partitions the array into two unequal pieces depending on whether each element in the array is greater or less that some pivot element. Orders the first two elements of the array. Places the largest item at the end of the array. #13 Which of the following sorting algorithms is, on average, the fastest when sorting a large array? Selection sort They all run at roughly the same speed Merge sort Insertion sort Quick sort #14 Dynamic data structures grow and shrink at time. compile link creation run load #15 Every simple type struct inherits from class. Primitive ValueType Struct SimpleType Number 3

44 #16 A(n) conversion is when an object is cast into another type. unboxing wrapping converting implicit boxing #17 A class contains a reference member that refers to an object of the same class type. self-referential self-linking self-pointing self-determining self-reflective #18 Usually a indicates to a program the end of a data structure. null reference forward slash character space character null pointer backslash character #19 An IsEmpty method you write to test whether a linked list is empty is called a method. preferred preemption preorder predefined predicate #20 A stack is a data structure. FILO FOLI LOFI One-way LIFO 4

45 #21 A queue is a data structure. IFOF One-way FOFI OFIF FIFO #22 enable you to specify, with a single class declaration, a set of related classes. Overriden classes Generic classes Overloaded classes Generics Collections #23 Generics provide that allows the compiler to catch invalid types. link-time type safety compile-time exception checking compile-time type safety compile-time error checking run-time type safety #24 When a method is called, the compiler tries to find a method that matches the of the method call. name name and argument types return type argument types name, argument types, and return type #25 All generic method declarations have a type parameter section delimited by. angle brackets ( '<' and '>' ) curly brackets ( '{' and '}' ) pipes (' ') parenthesis ( '(' and ')' ) square brackets ( '[' and ']' ) 5

46 #26 The clause specifies the type constraint for type parameter T. when cnstr types where constraint #27 A(n) provides a means for describing a class in a type-independent manner. parameterized class abstract class subclass concrete class generic class #28 Prepackaged data-structure classes provided by the.net Framework are called. DS classes abstract data type classes data structural classes data classes collection classes #29 Which of the following is not a collection class in C#? ArrayList HashTable SortedDictionary File BitArray #30 One should use the collections from the namespace to help specify the exact type that will be stored in a collection. System.Collections.Specialized System.GenericCollections System.Collections.Generics System.Collections System.Collections.Typed 6

47 #31 Which of the following is not a method provided by an array? Sort BinarySearch Index Copy Reverse #32 Classes which implement the IEnumerator interface must contain which of the following methods? Reset, Current, Reverse MoveNext, Current, Reverse MoveNext, Reset, Reverse MoveNext, Reset, Current Enumerate, First, Current #33 How is an ArrayList different from a regular array? it can hold objects of various types and has a dynamic size arrays can only hold primitive data types Both are the same; however one is a naming convention of C# the size is dynamic it can hold objects of various types #34 Peek throws a(n) if the stack is empty. InvalidOperationException InvalidMethodOrPropertyException StackEmptyException EmptyException PeekException #35 When two different keys "hash into" the same cell in an array, this is known as a(n). conjunction crash error collision problem 7

48 #36 The is the ratio of the number of objects stored in the hash table to the total number of cells of the hash table. share proportion packing factor load factor density #37 The enumerator of a HashTable uses the structure to store key-value pairs. Relationship Connection KeyValue Bond DictionaryEntry #38 A(n) performs a calculation that determines where to place data in the hash table. calculator hash function indexer converter definition #39 A is the general term for a collection of key-value pairs. dictionary book codebook glossary lexicon #40 All arrays implicitly inherit from which generic interface? IComparable IList IEnumerable IEnumerator Both IList and IEnumerable 8

49 #41 To determine if the string object mystring begins with the "Four" you might use String.StartsWith(myString, "Four") mystring.startswith("four") mystring.beginswith("four") mystring[0:4] == "Four" mystring.starts("four") #42 The expression: mystring.toupper() throws an exception if mystring contains any characters that are not letters. converts the contents of mystring to all upper case. returns the Boolean value True if mystring consists only of uppercase characters. does not change the contents of the object mystring. is a syntax error. #43 To perform file processing, which namespace must be imported? System.IO System.FileIO System.System System.File System.Directory #44 A dialog box that prevents you from interacting with any other window until you have closed it is termed a(n) preemptive dialog. priority dialog. assertive dialog. modal dialog. blocking dialog. #45 Quicksort's worst-case performance is O(n) O(n^3) O(log(n)) O(n^2) O(n log(n)) 9

50 #46 Which of the following sorting routines runs in O(log(n)) time? Merge Sort No sorting routine can run in log(n) time Insertion Sort Quick Sort Binary Sort #47 Which of the follow describes the defining rule for a minimum heap? Each parent must be larger than either of its children. Each parent can be no larger than either of its children. Each parent must be larger than its left child and no larger than its right child. Each parent must be smaller than either of its children. Each parent must be greater than the left child and smaller than the right child. #48 Which type of traversal will print out the elements of a binary tree in order? In-order traversal Pre-order traversal Post-order traversal Bottom-up level traversal Top-down level traversal #49 A generic type without any specified type constraints will through runtime exceptions if an incompatible type is used. will only work with classes that implement the IGeneric interface. will only work with classes that implement the IComparable interface. must work for any and all data types that ever have and ever will be defined. will downcast types to a compatible type if needed. #50 What type of objects can be used as keys in a hash table? Only objects that inherit from the class Hashable. Only objects that implement the IHashable interface. Only objects that inherit from the class Hashtable. Only objects that implement the IComparable interface. Any object. 10

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 7 : Collections Lecture Contents 2 Why collections? What is a collection? Non-generic collections: Array & ArrayList Stack HashTable

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 8 : Collections Lecture Contents 2 Why collections? What is a collection? Non-generic collections: Array & ArrayList Stack HashTable

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 9: Generics & generic Collections Lecture Contents 2 Introduction Why generics? Generic methods Overloading generic methods Generic

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 8 : Collections Lecture Contents 2 Why collections? What is a collection? Non-generic collections: Array & ArrayList Stack HashTable

More information

Arrays, Strings and Collections

Arrays, Strings and Collections Arrays Arrays can be informally defined as a group of variables containing values of the same type and that in some way or another they are related. An array has a fixed size that is defined before the

More information

Summer Final Exam Review Session August 5, 2009

Summer Final Exam Review Session August 5, 2009 15-111 Summer 2 2009 Final Exam Review Session August 5, 2009 Exam Notes The exam is from 10:30 to 1:30 PM in Wean Hall 5419A. The exam will be primarily conceptual. The major emphasis is on understanding

More information

Test iz programskog jezika C# - ASP Izaberite tačan odgovor. Student's name : Programiranje ASP C# 1) A local variable

Test iz programskog jezika C# - ASP Izaberite tačan odgovor. Student's name :   Programiranje ASP C# 1) A local variable Student's name : E-mail: Test štampajte i skeniranog ga vratite na e-mail office@e-univerzitet.com U slučaju da nemate tehničke mogućnosti, prihvata se i da na datu e-mail adresu pošaljete odgovore sa

More information

FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard

FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 The data of the problem is of 2GB and the hard disk is of 1GB capacity, to solve this problem we should Use better data structures

More information

Data Structure. Recitation IV

Data Structure. Recitation IV Data Structure Recitation IV Topic Java Generics Java error handling Stack Lab 2 Java Generics The following code snippet without generics requires casting: List list = new ArrayList(); list.add("hello");

More information

Cpt S 122 Data Structures. Course Review Midterm Exam # 1

Cpt S 122 Data Structures. Course Review Midterm Exam # 1 Cpt S 122 Data Structures Course Review Midterm Exam # 1 Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Midterm Exam 1 When: Friday (09/28) 12:10-1pm Where:

More information

Multiple choice questions. Answer on Scantron Form. 4 points each (100 points) Which is NOT a reasonable conclusion to this sentence:

Multiple choice questions. Answer on Scantron Form. 4 points each (100 points) Which is NOT a reasonable conclusion to this sentence: Multiple choice questions Answer on Scantron Form 4 points each (100 points) 1. Which is NOT a reasonable conclusion to this sentence: Multiple constructors for a class... A. are distinguished by the number

More information

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17 List of Programs xxv List of Figures xxix List of Tables xxxiii Preface to second version xxxv PART 1 Structured Programming 1 1 Getting started 3 1.1 Programming 3 1.2 Editing source code 5 Source code

More information

Data Structures Question Bank Multiple Choice

Data Structures Question Bank Multiple Choice Section 1. Fundamentals: Complexity, Algorthm Analysis 1. An algorithm solves A single problem or function Multiple problems or functions Has a single programming language implementation 2. A solution

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming 1. What is object-oriented programming (OOP)? OOP is a technique to develop logical modules, such as classes that contain properties, methods, fields, and events. An object

More information

COS 226 Midterm Exam, Spring 2009

COS 226 Midterm Exam, Spring 2009 NAME: login ID: precept: COS 226 Midterm Exam, Spring 2009 This test is 10 questions, weighted as indicated. The exam is closed book, except that you are allowed to use a one page cheatsheet. No calculators

More information

MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct.

MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct. MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct. In linked list the elements are necessarily to be contiguous In linked list the elements may locate at far positions

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Selection, Bubble, Insertion, Merge, Heap, Quick Bucket, Radix

Selection, Bubble, Insertion, Merge, Heap, Quick Bucket, Radix Spring 2010 Review Topics Big O Notation Heaps Sorting Selection, Bubble, Insertion, Merge, Heap, Quick Bucket, Radix Hashtables Tree Balancing: AVL trees and DSW algorithm Graphs: Basic terminology and

More information

Priority Queues (Heaps)

Priority Queues (Heaps) Priority Queues (Heaps) 1 Priority Queues Many applications require that we process records with keys in order, but not necessarily in full sorted order. Often we collect a set of items and process the

More information

Lecture Notes on Tries

Lecture Notes on Tries Lecture Notes on Tries 15-122: Principles of Imperative Computation Thomas Cortina Notes by Frank Pfenning Lecture 24 April 19, 2011 1 Introduction In the data structures implementing associative arrays

More information

Suppose that the following is from a correct C++ program:

Suppose that the following is from a correct C++ program: All multiple choice questions are equally weighted. You can generally assume that code shown in the questions is intended to be syntactically correct, unless something in the question or one of the answers

More information

Java Overview An introduction to the Java Programming Language

Java Overview An introduction to the Java Programming Language Java Overview An introduction to the Java Programming Language Produced by: Eamonn de Leastar (edeleastar@wit.ie) Dr. Siobhan Drohan (sdrohan@wit.ie) Department of Computing and Mathematics http://www.wit.ie/

More information

COSC 2007 Data Structures II Final Exam. Part 1: multiple choice (1 mark each, total 30 marks, circle the correct answer)

COSC 2007 Data Structures II Final Exam. Part 1: multiple choice (1 mark each, total 30 marks, circle the correct answer) COSC 2007 Data Structures II Final Exam Thursday, April 13 th, 2006 This is a closed book and closed notes exam. There are total 3 parts. Please answer the questions in the provided space and use back

More information

BINARY HEAP cs2420 Introduction to Algorithms and Data Structures Spring 2015

BINARY HEAP cs2420 Introduction to Algorithms and Data Structures Spring 2015 BINARY HEAP cs2420 Introduction to Algorithms and Data Structures Spring 2015 1 administrivia 2 -assignment 10 is due on Thursday -midterm grades out tomorrow 3 last time 4 -a hash table is a general storage

More information

Dictionaries. Priority Queues

Dictionaries. Priority Queues Red-Black-Trees.1 Dictionaries Sets and Multisets; Opers: (Ins., Del., Mem.) Sequential sorted or unsorted lists. Linked sorted or unsorted lists. Tries and Hash Tables. Binary Search Trees. Priority Queues

More information

CS 221 Review. Mason Vail

CS 221 Review. Mason Vail CS 221 Review Mason Vail Inheritance (1) Every class - except the Object class - directly inherits from one parent class. Object is the only class with no parent. If a class does not declare a parent using

More information

CS2223: Algorithms Sorting Algorithms, Heap Sort, Linear-time sort, Median and Order Statistics

CS2223: Algorithms Sorting Algorithms, Heap Sort, Linear-time sort, Median and Order Statistics CS2223: Algorithms Sorting Algorithms, Heap Sort, Linear-time sort, Median and Order Statistics 1 Sorting 1.1 Problem Statement You are given a sequence of n numbers < a 1, a 2,..., a n >. You need to

More information

1) What is the primary purpose of template functions? 2) Suppose bag is a template class, what is the syntax for declaring a bag b of integers?

1) What is the primary purpose of template functions? 2) Suppose bag is a template class, what is the syntax for declaring a bag b of integers? Review for Final (Chapter 6 13, 15) 6. Template functions & classes 1) What is the primary purpose of template functions? A. To allow a single function to be used with varying types of arguments B. To

More information

Priority queues. Priority queues. Priority queue operations

Priority queues. Priority queues. Priority queue operations Priority queues March 30, 018 1 Priority queues The ADT priority queue stores arbitrary objects with priorities. An object with the highest priority gets served first. Objects with priorities are defined

More information

! Tree: set of nodes and directed edges. ! Parent: source node of directed edge. ! Child: terminal node of directed edge

! Tree: set of nodes and directed edges. ! Parent: source node of directed edge. ! Child: terminal node of directed edge Trees & Heaps Week 12 Gaddis: 20 Weiss: 21.1-3 CS 5301 Fall 2018 Jill Seaman!1 Tree: non-recursive definition! Tree: set of nodes and directed edges - root: one node is distinguished as the root - Every

More information

About this exam review

About this exam review Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review

More information

COMP 103 Introduction to Data Structures and Algorithms

COMP 103 Introduction to Data Structures and Algorithms T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I VUW V I C T O R I A UNIVERSITY OF WELLINGTON Student ID:..................... EXAMINATIONS 2005 END-YEAR COMP 103 Introduction to Data

More information

CS102 Binary Search Trees

CS102 Binary Search Trees CS102 Binary Search Trees Prof Tejada 1 To speed up insertion, removal and search, modify the idea of a Binary Tree to create a Binary Search Tree (BST) Binary Search Trees Binary Search Trees have one

More information

CSCE 2014 Final Exam Spring Version A

CSCE 2014 Final Exam Spring Version A CSCE 2014 Final Exam Spring 2017 Version A Student Name: Student UAID: Instructions: This is a two-hour exam. Students are allowed one 8.5 by 11 page of study notes. Calculators, cell phones and computers

More information

DUKE UNIVERSITY Department of Computer Science. Test 2: CompSci 100

DUKE UNIVERSITY Department of Computer Science. Test 2: CompSci 100 DUKE UNIVERSITY Department of Computer Science Test 2: CompSci 100 Name (print): Community Standard acknowledgment (signature): Problem 1 value 14 pts. grade Problem 2 9 pts. Problem 3 7 pts. Problem 4

More information

Algorithms and Data Structures

Algorithms and Data Structures Algorithms and Data Structures Dr. Malek Mouhoub Department of Computer Science University of Regina Fall 2002 Malek Mouhoub, CS3620 Fall 2002 1 6. Priority Queues 6. Priority Queues ffl ADT Stack : LIFO.

More information

EXAMINATIONS 2005 END-YEAR. COMP 103 Introduction to Data Structures and Algorithms

EXAMINATIONS 2005 END-YEAR. COMP 103 Introduction to Data Structures and Algorithms T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I ÎÍÏ V I C T O R I A UNIVERSITY OF WELLINGTON EXAMINATIONS 2005 END-YEAR COMP 103 Introduction to Data Structures and Algorithms Time Allowed:

More information

CSE 332 Autumn 2013: Midterm Exam (closed book, closed notes, no calculators)

CSE 332 Autumn 2013: Midterm Exam (closed book, closed notes, no calculators) Name: Email address: Quiz Section: CSE 332 Autumn 2013: Midterm Exam (closed book, closed notes, no calculators) Instructions: Read the directions for each question carefully before answering. We will

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS Contents Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS 1.1. INTRODUCTION TO COMPUTERS... 1 1.2. HISTORY OF C & C++... 3 1.3. DESIGN, DEVELOPMENT AND EXECUTION OF A PROGRAM... 3 1.4 TESTING OF PROGRAMS...

More information

CS301 - Data Structures Glossary By

CS301 - Data Structures Glossary By CS301 - Data Structures Glossary By Abstract Data Type : A set of data values and associated operations that are precisely specified independent of any particular implementation. Also known as ADT Algorithm

More information

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language 1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC

More information

PRIORITY QUEUES AND HEAPS

PRIORITY QUEUES AND HEAPS 10//1 Readings and Homework Read Chapter A Heap Implementation to learn about heaps PRIORITY QUEUES AND HEAPS Lecture 17 CS10 Fall 01 Exercise: Salespeople often make matrices that show all the great features

More information

CS251-SE1. Midterm 2. Tuesday 11/1 8:00pm 9:00pm. There are 16 multiple-choice questions and 6 essay questions.

CS251-SE1. Midterm 2. Tuesday 11/1 8:00pm 9:00pm. There are 16 multiple-choice questions and 6 essay questions. CS251-SE1 Midterm 2 Tuesday 11/1 8:00pm 9:00pm There are 16 multiple-choice questions and 6 essay questions. Answer the multiple choice questions on your bubble sheet. Answer the essay questions in the

More information

EXAMINATIONS 2015 COMP103 INTRODUCTION TO DATA STRUCTURES AND ALGORITHMS

EXAMINATIONS 2015 COMP103 INTRODUCTION TO DATA STRUCTURES AND ALGORITHMS T E W H A R E W Ā N A N G A O T E Student ID:....................... Ū P O K O O T E I K A A M Ā U I VUW VICTORIA U N I V E R S I T Y O F W E L L I N G T O N EXAMINATIONS 2015 TRIMESTER 2 COMP103 INTRODUCTION

More information

CSE 332 Winter 2015: Midterm Exam (closed book, closed notes, no calculators)

CSE 332 Winter 2015: Midterm Exam (closed book, closed notes, no calculators) _ UWNetID: Lecture Section: A CSE 332 Winter 2015: Midterm Exam (closed book, closed notes, no calculators) Instructions: Read the directions for each question carefully before answering. We will give

More information

Balanced Binary Search Trees. Victor Gao

Balanced Binary Search Trees. Victor Gao Balanced Binary Search Trees Victor Gao OUTLINE Binary Heap Revisited BST Revisited Balanced Binary Search Trees Rotation Treap Splay Tree BINARY HEAP: REVIEW A binary heap is a complete binary tree such

More information

Data Structure. A way to store and organize data in order to support efficient insertions, queries, searches, updates, and deletions.

Data Structure. A way to store and organize data in order to support efficient insertions, queries, searches, updates, and deletions. DATA STRUCTURES COMP 321 McGill University These slides are mainly compiled from the following resources. - Professor Jaehyun Park slides CS 97SI - Top-coder tutorials. - Programming Challenges book. Data

More information

Introduce C# as Object Oriented programming language. Explain, tokens,

Introduce C# as Object Oriented programming language. Explain, tokens, Module 2 98 Assignment 1 Introduce C# as Object Oriented programming language. Explain, tokens, lexicals and control flow constructs. 99 The C# Family Tree C Platform Independence C++ Object Orientation

More information

Chapter 2: Basic Data Structures

Chapter 2: Basic Data Structures Chapter 2: Basic Data Structures Basic Data Structures Stacks Queues Vectors, Linked Lists Trees (Including Balanced Trees) Priority Queues and Heaps Dictionaries and Hash Tables Spring 2014 CS 315 2 Two

More information

3. Priority Queues. ADT Stack : LIFO. ADT Queue : FIFO. ADT Priority Queue : pick the element with the lowest (or highest) priority.

3. Priority Queues. ADT Stack : LIFO. ADT Queue : FIFO. ADT Priority Queue : pick the element with the lowest (or highest) priority. 3. Priority Queues 3. Priority Queues ADT Stack : LIFO. ADT Queue : FIFO. ADT Priority Queue : pick the element with the lowest (or highest) priority. Malek Mouhoub, CS340 Winter 2007 1 3. Priority Queues

More information

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8 Epic Test Review 1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4 Write a line of code that outputs the phase Hello World to the console without creating a new line character. System.out.print(

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

Tree: non-recursive definition. Trees, Binary Search Trees, and Heaps. Tree: recursive definition. Tree: example.

Tree: non-recursive definition. Trees, Binary Search Trees, and Heaps. Tree: recursive definition. Tree: example. Trees, Binary Search Trees, and Heaps CS 5301 Fall 2013 Jill Seaman Tree: non-recursive definition Tree: set of nodes and directed edges - root: one node is distinguished as the root - Every node (except

More information

CS-141 Exam 2 Review April 4, 2015 Presented by the RIT Computer Science Community

CS-141 Exam 2 Review April 4, 2015 Presented by the RIT Computer Science Community CS-141 Exam 2 Review April 4, 2015 Presented by the RIT Computer Science Community http://csc.cs.rit.edu Linked Lists 1. You are given the linked list: 1 2 3. You may assume that each node has one field

More information

CS200 Spring 2004 Midterm Exam II April 14, Value Points a. 5 3b. 16 3c. 8 3d Total 100

CS200 Spring 2004 Midterm Exam II April 14, Value Points a. 5 3b. 16 3c. 8 3d Total 100 CS200 Spring 2004 Midterm Exam II April 14, 2004 Value Points 1. 12 2. 26 3a. 5 3b. 16 3c. 8 3d. 8 4. 25 Total 100 Name StudentID# 1. [12 pts] Short Answer from recitations: a) [3 pts] What is the first

More information

CSE 12 Week Eight, Lecture One

CSE 12 Week Eight, Lecture One CSE 12 Week Eight, Lecture One Heap: (The data structure, not the memory area) - A binary tree with properties: - 1. Parent s are greater than s. o the heap order - 2. Nodes are inserted so that tree is

More information

Babu Madhav Institute of Information Technology, UTU 2015

Babu Madhav Institute of Information Technology, UTU 2015 Five years Integrated M.Sc.(IT)(Semester 5) Question Bank 060010502:Programming in Python Unit-1:Introduction To Python Q-1 Answer the following Questions in short. 1. Which operator is used for slicing?

More information

CS 104 (Spring 2014) Final Exam 05/09/2014

CS 104 (Spring 2014) Final Exam 05/09/2014 CS 104 (Spring 2014) Final Exam 05/09/2014 G o o d L u c k Your Name, USC username, and Student ID: This exam has 8 pages and 8 questions. If yours does not, please contact us immediately. Please read

More information

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix PGJC4_JSE8_OCA.book Page ix Monday, June 20, 2016 2:31 PM Contents Figures Tables Examples Foreword Preface xix xxi xxiii xxvii xxix 1 Basics of Java Programming 1 1.1 Introduction 2 1.2 Classes 2 Declaring

More information

Week 6. Data structures

Week 6. Data structures 1 2 3 4 5 n Week 6 Data structures 6 7 n 8 General remarks We start considering Part III Data Structures from CLRS. As a first example we consider two special of buffers, namely stacks and queues. Reading

More information

! Tree: set of nodes and directed edges. ! Parent: source node of directed edge. ! Child: terminal node of directed edge

! Tree: set of nodes and directed edges. ! Parent: source node of directed edge. ! Child: terminal node of directed edge Trees (& Heaps) Week 12 Gaddis: 20 Weiss: 21.1-3 CS 5301 Spring 2015 Jill Seaman 1 Tree: non-recursive definition! Tree: set of nodes and directed edges - root: one node is distinguished as the root -

More information

Data Structures and Abstractions with Java

Data Structures and Abstractions with Java Global edition Data Structures and Abstractions with Java Fourth edition Frank M. Carrano Timothy M. Henry Data Structures and Abstractions with Java TM Fourth Edition Global Edition Frank M. Carrano University

More information

Lec 17 April 8. Topics: binary Trees expression trees. (Chapter 5 of text)

Lec 17 April 8. Topics: binary Trees expression trees. (Chapter 5 of text) Lec 17 April 8 Topics: binary Trees expression trees Binary Search Trees (Chapter 5 of text) Trees Linear access time of linked lists is prohibitive Heap can t support search in O(log N) time. (takes O(N)

More information

Binary Heaps. COL 106 Shweta Agrawal and Amit Kumar

Binary Heaps. COL 106 Shweta Agrawal and Amit Kumar Binary Heaps COL Shweta Agrawal and Amit Kumar Revisiting FindMin Application: Find the smallest ( or highest priority) item quickly Operating system needs to schedule jobs according to priority instead

More information

Cpt S 122 Data Structures. Course Review FINAL. Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University

Cpt S 122 Data Structures. Course Review FINAL. Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 Data Structures Course Review FINAL Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Final When: Wednesday (12/12) 1:00 pm -3:00 pm Where: In Class

More information

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE A6-R3: DATA STRUCTURE THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered in the TEAR-OFF

More information

PRIORITY QUEUES AND HEAPS

PRIORITY QUEUES AND HEAPS PRIORITY QUEUES AND HEAPS Lecture 17 CS2110 Spring 201 Readings and Homework 2 Read Chapter 2 A Heap Implementation to learn about heaps Exercise: Salespeople often make matrices that show all the great

More information

Java Primer 1: Types, Classes and Operators

Java Primer 1: Types, Classes and Operators Java Primer 1 3/18/14 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Java Primer 1: Types,

More information

CS-301 Data Structure. Tariq Hanif

CS-301 Data Structure. Tariq Hanif 1. The tree data structure is a Linear data structure Non-linear data structure Graphical data structure Data structure like queue FINALTERM EXAMINATION Spring 2012 CS301- Data Structure 25-07-2012 2.

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

CS-141 Final Exam Review May 16, 2015 Presented by the RIT Computer Science Community

CS-141 Final Exam Review May 16, 2015 Presented by the RIT Computer Science Community CS-141 Final Exam Review May 16, 2015 Presented by the RIT Computer Science Community http://csc.cs.rit.edu Python Basics 1. Although most in the industry will be reasonably forgiving when it comes to

More information

A Short Summary of Javali

A Short Summary of Javali A Short Summary of Javali October 15, 2015 1 Introduction Javali is a simple language based on ideas found in languages like C++ or Java. Its purpose is to serve as the source language for a simple compiler

More information

CSE 431S Type Checking. Washington University Spring 2013

CSE 431S Type Checking. Washington University Spring 2013 CSE 431S Type Checking Washington University Spring 2013 Type Checking When are types checked? Statically at compile time Compiler does type checking during compilation Ideally eliminate runtime checks

More information

Computer Science Foundation Exam

Computer Science Foundation Exam Computer Science Foundation Exam August 26, 2017 Section I A DATA STRUCTURES NO books, notes, or calculators may be used, and you must work entirely on your own. Name: UCFID: NID: Question # Max Pts Category

More information

Heaps. Heaps. A heap is a complete binary tree.

Heaps. Heaps. A heap is a complete binary tree. A heap is a complete binary tree. 1 A max-heap is a complete binary tree in which the value in each internal node is greater than or equal to the values in the children of that node. A min-heap is defined

More information

Index COPYRIGHTED MATERIAL

Index COPYRIGHTED MATERIAL Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes

More information

EXAMINATIONS 2006 SUMMER TRIMESTER. COMP103 Introduction to Data Structures and Algorithms

EXAMINATIONS 2006 SUMMER TRIMESTER. COMP103 Introduction to Data Structures and Algorithms T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I ÎÍÏ V I C T O R I A UNIVERSITY OF WELLINGTON EXAMINATIONS 2006 SUMMER TRIMESTER COMP103 Introduction to Data Structures and Algorithms

More information

CSE030 Fall 2012 Final Exam Friday, December 14, PM

CSE030 Fall 2012 Final Exam Friday, December 14, PM CSE030 Fall 2012 Final Exam Friday, December 14, 2012 3-6PM Write your name here and at the top of each page! Name: Select your lab session: Tuesdays Thursdays Paper. If you have any questions or need

More information

36. Collections. Java. Summer 2008 Instructor: Dr. Masoud Yaghini

36. Collections. Java. Summer 2008 Instructor: Dr. Masoud Yaghini 36. Collections Java Summer 2008 Instructor: Dr. Masoud Yaghini Outline Introduction Arrays Class Interface Collection and Class Collections ArrayList Class Generics LinkedList Class Collections Algorithms

More information

Lecture 23: Priority Queues 10:00 AM, Mar 19, 2018

Lecture 23: Priority Queues 10:00 AM, Mar 19, 2018 CS18 Integrated Introduction to Computer Science Fisler, Nelson Lecture 23: Priority Queues 10:00 AM, Mar 19, 2018 Contents 1 Priority Queues 1 2 Binary Heaps 2 3 Heaps 4 4 Aside: The Ordered Trait 5 5

More information

6. Pointers, Structs, and Arrays. 1. Juli 2011

6. Pointers, Structs, and Arrays. 1. Juli 2011 1. Juli 2011 Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 1 of 50 Outline Recapitulation Pointers Dynamic Memory Allocation Structs Arrays Bubble Sort Strings Einführung

More information

The Warhol Language Reference Manual

The Warhol Language Reference Manual The Warhol Language Reference Manual Martina Atabong maa2247 Charvinia Neblett cdn2118 Samuel Nnodim son2105 Catherine Wes ciw2109 Sarina Xie sx2166 Introduction Warhol is a functional and imperative programming

More information

Absolute C++ Walter Savitch

Absolute C++ Walter Savitch Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents

More information

CSE 373 NOVEMBER 8 TH COMPARISON SORTS

CSE 373 NOVEMBER 8 TH COMPARISON SORTS CSE 373 NOVEMBER 8 TH COMPARISON SORTS ASSORTED MINUTIAE Bug in Project 3 files--reuploaded at midnight on Monday Project 2 scores Canvas groups is garbage updated tonight Extra credit P1 done and feedback

More information

CS-141 Final Exam Review December 16, 2015 Presented by the RIT Computer Science Community

CS-141 Final Exam Review December 16, 2015 Presented by the RIT Computer Science Community CS-141 Final Exam Review December 16, 2015 Presented by the RIT Computer Science Community http://csc.cs.rit.edu Python Basics 1. Although most in the industry will be reasonably forgiving when it comes

More information

The SPL Programming Language Reference Manual

The SPL Programming Language Reference Manual The SPL Programming Language Reference Manual Leonidas Fegaras University of Texas at Arlington Arlington, TX 76019 fegaras@cse.uta.edu February 27, 2018 1 Introduction The SPL language is a Small Programming

More information

EC8393FUNDAMENTALS OF DATA STRUCTURES IN C Unit 3

EC8393FUNDAMENTALS OF DATA STRUCTURES IN C Unit 3 UNIT 3 LINEAR DATA STRUCTURES 1. Define Data Structures Data Structures is defined as the way of organizing all data items that consider not only the elements stored but also stores the relationship between

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 12: Sorting Algorithms MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Outline 2 Last week Implementation of the three tree depth-traversal algorithms Implementation of the BinarySearchTree

More information

CS 61B Summer 2005 (Porter) Midterm 2 July 21, SOLUTIONS. Do not open until told to begin

CS 61B Summer 2005 (Porter) Midterm 2 July 21, SOLUTIONS. Do not open until told to begin CS 61B Summer 2005 (Porter) Midterm 2 July 21, 2005 - SOLUTIONS Do not open until told to begin This exam is CLOSED BOOK, but you may use 1 letter-sized page of notes that you have created. Problem 0:

More information

CSC 307 DATA STRUCTURES AND ALGORITHM ANALYSIS IN C++ SPRING 2011

CSC 307 DATA STRUCTURES AND ALGORITHM ANALYSIS IN C++ SPRING 2011 CSC 307 DATA STRUCTURES AND ALGORITHM ANALYSIS IN C++ SPRING 2011 Date: 01/18/2011 (Due date: 01/20/2011) Name and ID (print): CHAPTER 6 USER-DEFINED FUNCTIONS I 1. The C++ function pow has parameters.

More information

Priority Queues (Heaps)

Priority Queues (Heaps) Priority Queues (Heaps) October 11, 2016 CMPE 250 Priority Queues October 11, 2016 1 / 29 Priority Queues Many applications require that we process records with keys in order, but not necessarily in full

More information

Topics for CSCI 151 Final Exam Wednesday, May 10

Topics for CSCI 151 Final Exam Wednesday, May 10 Topics for CSCI 151 Final Exam Wednesday, May 10 Java and Programming Techniques Types Inheritance Generics Abstract classes and interfaces Exceptions Recursion Writing recursive methods Dynamic Programming

More information

6: Arrays and Collections

6: Arrays and Collections 6: Arrays and Collections Andrew Cumming, SoC Bill Buchanan, SoC W.Buchanan (1) Course Outline Day 1: Morning Introduction to Object-Orientation, Introduction to.net, Overview of.net Framework,.NET Components.

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 10: Search and Heaps MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Search and Heaps 2 Linear Search Binary Search Introduction to trees Priority Queues Heaps Linear Search

More information

Standard ADTs. Lecture 19 CS2110 Summer 2009

Standard ADTs. Lecture 19 CS2110 Summer 2009 Standard ADTs Lecture 19 CS2110 Summer 2009 Past Java Collections Framework How to use a few interfaces and implementations of abstract data types: Collection List Set Iterator Comparable Comparator 2

More information

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR STUDENT IDENTIFICATION NO MULTIMEDIA COLLEGE JALAN GURNEY KIRI 54100 KUALA LUMPUR FIFTH SEMESTER FINAL EXAMINATION, 2014/2015 SESSION PSD2023 ALGORITHM & DATA STRUCTURE DSEW-E-F-2/13 25 MAY 2015 9.00 AM

More information

Java Bytecode (binary file)

Java Bytecode (binary file) Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

Last Time. Arrays. Arrays. Jagged Arrays. foreach. We began looking at GUI Programming Completed talking about exception handling

Last Time. Arrays. Arrays. Jagged Arrays. foreach. We began looking at GUI Programming Completed talking about exception handling Last Time We began looking at GUI Programming Completed talking about exception handling Arrays, Collections, Hash Tables, 9/22/05 CS360 Windows Programming 1 9/22/05 CS360 Windows Programming 2 Arrays

More information