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

Similar documents
CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE

Arrays, Strings and Collections

Summer Final Exam Review Session August 5, 2009

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

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

Data Structure. Recitation IV

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

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

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

Data Structures Question Bank Multiple Choice

Object-Oriented Programming

COS 226 Midterm Exam, Spring 2009

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

Introduction to Programming Using Java (98-388)

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

Priority Queues (Heaps)

Lecture Notes on Tries

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

Java Overview An introduction to the Java Programming Language

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

BINARY HEAP cs2420 Introduction to Algorithms and Data Structures Spring 2015

Dictionaries. Priority Queues

CS 221 Review. Mason Vail

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

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?

Priority queues. Priority queues. Priority queue operations

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

About this exam review

COMP 103 Introduction to Data Structures and Algorithms

CS102 Binary Search Trees

CSCE 2014 Final Exam Spring Version A

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

Algorithms and Data Structures

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

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

CS201 - Introduction to Programming Glossary By

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

CS301 - Data Structures Glossary By

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

PRIORITY QUEUES AND HEAPS

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

EXAMINATIONS 2015 COMP103 INTRODUCTION TO DATA STRUCTURES AND ALGORITHMS

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

Balanced Binary Search Trees. Victor Gao

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

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

Chapter 2: Basic Data Structures

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

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

Short Notes of CS201

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

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

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

CSE 12 Week Eight, Lecture One

Babu Madhav Institute of Information Technology, UTU 2015

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

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

Week 6. Data structures

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

Data Structures and Abstractions with Java

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

Binary Heaps. COL 106 Shweta Agrawal and Amit Kumar

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

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

PRIORITY QUEUES AND HEAPS

Java Primer 1: Types, Classes and Operators

CS-301 Data Structure. Tariq Hanif

Pace University. Fundamental Concepts of CS121 1

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

A Short Summary of Javali

CSE 431S Type Checking. Washington University Spring 2013

Computer Science Foundation Exam

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

Index COPYRIGHTED MATERIAL

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

CSE030 Fall 2012 Final Exam Friday, December 14, PM

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

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

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

The Warhol Language Reference Manual

Absolute C++ Walter Savitch

CSE 373 NOVEMBER 8 TH COMPARISON SORTS

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

The SPL Programming Language Reference Manual

EC8393FUNDAMENTALS OF DATA STRUCTURES IN C Unit 3

Programming II (CS300)

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

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

Priority Queues (Heaps)

Topics for CSCI 151 Final Exam Wednesday, May 10

6: Arrays and Collections

Programming II (CS300)

Standard ADTs. Lecture 19 CS2110 Summer 2009

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

Java Bytecode (binary file)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

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

Transcription:

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" \"string" @"string" #4 The bounds on a string are always: 0 to string.length. 0 to string.length - 1. 0 to string.length + 1. 1 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

#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

#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

#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

#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

#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

#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

#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

#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

#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

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" @"string" #"string" $"string" #4 The bounds on a string are always: 0 to string.length. 1 to string.length. 0 to string.length + 1. 1 to string.length - 1. 0 to string.length - 1. #5 string indexers treat strings as: a string array ASCII code arrays of characters a character binary code

#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

#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

#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

#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

#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

#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

#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

#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

#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

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" #"string"!"string" @"string" #4 The bounds on a string are always: 0 to string.length + 1. 0 to string.length - 1. 1 to string.length - 1. 0 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

#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

#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

#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

#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 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

#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

#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

#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

#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

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, use: @"string" $"string" \"string" #"string"!"string" #4 The bounds on a string are always: 0 to string.length - 1. 1 to string.length - 1. 1 to string.length. 0 to string.length + 1. 0 to string.length. #5 string indexers treat strings as: a character binary code a string array ASCII code arrays of characters

#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

#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

#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

#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

#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

#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

#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

#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

#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

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"!"string" \"string" #"string" #4 The bounds on a string are always: 0 to string.length. 1 to string.length - 1. 0 to string.length + 1. 0 to string.length - 1. 1 to string.length. #5 string indexers treat strings as: a character ASCII code arrays of characters a string array binary code

#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

#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

#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

#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

#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

#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

#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

#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

#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