C# final review

Ace your homework & exams now with Quizwiz!

Ch 10 Inheritance A child class is also called a(n) ____________________ . a. extended class b. base class c. superclass d. delineated class

a. extended class

Chapter 13 Handling Events The Control that causes an event is the _____________________________ argument to an event method. a. first b. second c. third d. fourth

a. first

Ch 10 Inheritance When a parent class contains a private data field, the field is ____________________ the child class. a. hidden in b. not a member of c. directly accessible in d. public in

a. hidden in

Chapter 14 Files and Streams Which of the following is not considered to be permanent storage? a. a USB drive b. a hard disk c. RAM d. None of these is permanent storage

c. RAM

Chapter 11 and 14 Quiz ____________ is the process of converting objects into streams of bytes. Select one: a. Deserialization b. Streaming c. Serialization d. Normalization

c. Serialization

Ch 9 Classes A class's default constructor ________________________. a. sets numeric fields to 0 b. is parameterless c. is both of these d. is none of these

c. is both of these

Chapter 12 & 13 - Controls and Events Quiz In a MenuStrip, placing what character in front of a unique letter allows the user to press Alt and then the given letter to activate the menu choice as an alternative to clicking it with the mouse? Select one: a. & b. $ c. % d. >

a. &

Ch 8. Advanced Methods Assume that you declare a variable as int x = 100; and correctly pass it to a method with the declaration private static void IncreaseValue(int x). There is a single statement within the IncreaseValue() method: x = x + 25;. Back in the Main() method, after the method call, what is the value of x? a. 100 b. 125 c. It is impossible to tell. d. The program will not run.

a. 100

Chapter 12 Understanding Controls ListBox, ComboBox, and CheckedListBox objects all descend from which family? a. ListControl b. List c. ButtonBase d. ListBase

a. ListControl

Ch 8. Advanced Methods Assume you have declared a method as follows: private static double CalculateDiscount(int acct = 0, double price = 0, double discount = 0) Which of the following is a legal method call? a. CalculateDiscount(); b. CalculateDiscount(200.00); c. CalculateDiscount(3000.00, 0.02); d. None of the above is legal.

a. CalculateDiscount();

Chapter 13 Handling Events The EventArgs class contains a static field named _____________________________. a. Empty b. Text c. Location d. Source

a. Empty

Chapter 12 Understanding Controls Which of the following correctly creates a Font? a. Font myFont = new Font("Arial", 14F, FontStyle.Bold); b. Font myFont = new Font("Courier", 13.6); c. myFont = Font new Font("TimesRoman", FontStyle.Italic); d. Font myFont = Font(20, "Helvetica", Underlined);

a. Font myFont = new Font("Arial", 14F, FontStyle.Bold);

Chapter 12 Understanding Controls The Control you frequently use to provide descriptive text for another Control object is a ________________________. a. Label b. Form c. CheckBox d. MessageBox

a. Label

Ch 8 Advanced Methods Quiz Which of the following is not a valid method call for the following method: private static void Method(double x, int y, string s="string", double z=10.5) Select one: a. Method(1.5, z:2.5, 2); b. Method(1.5,2); c. Method(1.5, 2, z: 2.5); d. Method(1.5, 2,s:"name", z:2.5);

a. Method(1.5, z:2.5, 2);

Chapter 12 & 13 - Controls and Events Quiz Mouse events can be handled for any control through an object of what class? Select one: a. MouseEventArgs b. MousePressEventArgs c. MousePressArgs d. EventArgs

a. MouseEventArgs

Ch 9 Classes Assume that you have created a class named TermPaper that contains a character field named letterGrade. You also have created a property for the field. Which of the following cannot be true? a. The property name is letterGrade. b. The property is read-only. c. The property contains a set accessor that does not allow a grade lower than 'C'. d. The property does not contain a get accessor.

a. The property name is letterGrade.

Ch 10 Inheritance Which of the following is not a benefit of using inheritance when creating a new class? a. You save computer memory because when you create objects of the new class, storage is not required for parent class fields b. You reduce the chance of errors, because the parent class methods have already been used and tested. c. You make it easier for anyone who has used the parent class to understand the new class because the programmer can concentrate on the new features. d. You save time, because you need not create fields and methods that already exist in a parent class.

a. You save computer memory because when you create objects of the new class, storage is not required for parent class fields

Ch 9 Classes A collection of methods that can be used by any class, as long as the class provides a definition to override the collection's abstract definitions, is ________________________. a. an interface b. a polymorph c. a perimeter d. a superclass

a. an interface

Ch 10 Inheritance In a program that declares a derived class object, you ____________________ assign it to an object of its base class type. a. can b. cannot c. must d. should not

a. can

Ch 9 Classes Quiz A ____ is a clause that indicates another instance of a class constructor should be executed before any statements in the current constructor body Select one: a. constructor initializer b. value constructor c. default constructor d. parameterless constructor

a. constructor initializer

Chapter 14 Files and Streams When a file's mode is Create, a new file will be created ________________________. a. even if one with the same name already exists b. only if one with the same name does not already exist c. only if one with the same name already exists d. only if the access is Read

a. even if one with the same name already exists

Chapter 13 Handling Events In C#, a(n) _____________________________ is triggered when specific changes to an object occur. a. event b. delegate c. notification d. instantiation

a. event

Ch 9 Classes A this reference is ________________________. a. implicitly passed to nonstatic methods b. implicitly passed to static methods c. explicitly passed to nonstatic methods d. explicitly passed to static methods

a. implicitly passed to nonstatic methods

Ch 9 Classes An object is a(n) ________________________ of a class. a. instantiation b. institution c. child d. relative

a. instantiation

Chapter 13 Handling Events The TabIndex property of a Control is a(n) _____________________________. a. integer value indicating the tab order b. Boolean value indicating whether the Control has a position in the tab sequence c. string value indicating the name of the method executed when the Control raises an event

a. integer value indicating the tab order

Ch 10 Inheritance A derived class usually contains ____________________ than its parent. a. more fields and methods b. the same number of fields but fewer methods c. fewer fields but more methods d. fewer fields and methods

a. more fields and methods

Ch 10 Inheritance When a base class constructor requires arguments, then each derived class ____________________. a. must include a constructor b. must include a constructor that requires arguments c. must include two or more constructors d. must not include a constructor

a. must include a constructor

Ch 9 Classes Most methods in a class are created with the ________________________ modifier. a. public b. private c. new d. protected

a. public

Ch 8. Advanced Methods A mandatory parameter ______________________. a. requires an argument to be sent from a method call b. is any argument sent to a method c. is preceded by the keyword man d. All of the above are true.

a. requires an argument to be sent from a method call

Chapter 14 Files and Streams After a StreamReader has been created, the ReadLine() method can be used to ________________________. a. retrieve one line at a time from the file b. retrieve one character at a time from the file c. store one line at a time in a file d. split a string into tokens

a. retrieve one line at a time from the file

Chapter 13 Handling Events C# delegates provide a way for a program to _____________________________ . a. take alternative courses that are not determined until runtime b. include multiple methods c. include methods from other classes d. include multiple Controls that use the same method

a. take alternative courses that are not determined until runtime

Chapter 14 Files and Streams Which of the following is not part of a FileStream constructor? a. the file size b. the file mode c. the filename d. the type of access

a. the file size

Ch 10 Inheritance When you create an abstract method, you provide ____________________. a. the keyword abstract b. curly braces c. method statements d. all of these

a. the keyword abstract

Chapter 11 Exception Handling In object-oriented terminology, a method that detects an error condition ______________________ an exception. a. throws b. catches c. tries d. unearths

a. throws

Chapter 12 Understanding Controls The Checked property of a RadioButton can hold the values ________________________ . a. true and false b. Checked and Unchecked c. 0 and 1 d. Yes, No, and Undetermined

a. true and false

Chapter 14 Files and Streams Random access memory is ________________________. a. volatile b. persistent c. permanent d. sequential

a. volatile

Ch 10 Inheritance When you create an abstract class, ____________________ . a. you can inherit from it b. you can create concrete objects from it c. Both of these are true. d. None of these is true.

a. you can inherit from it

Chapter 11 Exception Handling If you do not use object-oriented techniques, ______________________. a. you can still manage error situations b. you cannot manage error situations c. you can manage error situations but with great difficulty d. error situations will seldom occur

a. you can still manage error situations

Chapter 11 Exception Handling Consider the following catch blocks. The variable b has been initialized to 0. If a DivideByZeroException occurs in a try block just before this catch block, what is the value of b when this code completes? catch(DivideByZeroException e) { ++b; } catch(Exception e) { ++b; } a. 0 b. 1 c. 2 d. 3

b. 1

Ch 8. Advanced Methods Assume that you declare a variable as int x = 100; and correctly pass it to a method with the declaration private static void IncreaseValue(ref int x). There is a single statement within the IncreaseValue() method: x = x + 25;. Back in the Main() method, after the method call, what is the value of x? a. 100 b. 125 c. It is impossible to tell. d. The program will not run

b. 125

Chapter 13 Handling Events The TabStop property of a Control is a(n) _____________________________. a. integer value indicating the tab order b. Boolean value indicating whether the Control has a position in the tab sequence c. string value indicating the name of the method executed when the Control raises an event d. delegate name indicating the event raised when the user tabs to the Control

b. Boolean value indicating whether the Control has a position in the tab sequence

Chapter 14 Files and Streams Which of the following is not a FileStream property? a. CanRead b. CanExist c. CanSeek d. CanWrite

b. CanExist

Ch 9 Classes Assume that you have created a class named Chair with a constructor defined as Chair(int height). Which of the following overloaded constructors could coexist with the Chair constructor without ambiguity? a. Chair(int legs) b. Chair(int height, int legs) c. Both of these d. None of these

b. Chair(int height, int legs)

Chapter 12 Understanding Controls All Control objects descend from ________________________ . a. Form b. Component c. ButtonBase d. all of these

b. Component

Chapter 13 Handling Events When creating events, you can use a predefined delegate type named _____________________________ that is provided automatically by the .NET Framework. a. EventArgs b. EventHandler c. EventType d. Event

b. EventHandler

Chapter 11 and 14 Quiz In C#, all exceptions are objects that are members or derived members of what specific class? Select one: a. ApplicationException b. Exception c. SystemException d. RuntimeException

b. Exception

Chapter 11 Exception Handling Most exceptions you will use derive from three classes: ______________________. a. Object, ObjectException, and ObjectApplicationException b. Exception, SystemException, and ApplicationException c. FormatException, ApplicationException, and IOException d. SystemException, IOException, and FormatException

b. Exception, SystemException, and ApplicationException

Ch 8. Advanced Methods When you declare a value parameter, you precede its name with ______________________. a. nothing b. a data type c. the keyword val and a data type d. the keyword ref and its data type

b. a data type

Chapter 12 & 13 - Controls and Events Quiz Depending on the event, the delegate used to create the keyboard event handler is either KeyEventHandler or what other event handler? Select one: a. EventHandler b. KeyPressEventHandler c. PressEventHandler d. KeyPressHandler

b. KeyPressEventHandler

Chapter 12 & 13 - Controls and Events Quiz What Control allows you to retrieve date information? Select one: a. CalendarPicker b. MonthCalendar c. Calendar d. DateCalendar

b. MonthCalendar

Chapter 12 Understanding Controls What is one difference between CheckBox and RadioButton objects? a. RadioButtons descend from ButtonBase; CheckBoxes do not. b. Only one RadioButton can be selected at a time. c. Only one CheckBox can appear on a Form at a time. d. RadioButtons cannot be placed in a GroupBox; CheckBoxes can.

b. Only one RadioButton can be selected at a time.

Chapter 11 and 14 Quiz A catch block can catch how any types of Exception? Select one: a. An unlimited number of Exception types. IncorrectIncorrect b. Only one can be caught. c. Two, after which the program ends. d. As many as can be matched.

b. Only one can be caught.

Chapter 12 Understanding Controls The Control in which you can display a bitmap or JPEG image is a(n) ________________________ . a. DisplayModule b. PictureBox c. BitmapControl d. ImageHolder

b. PictureBox

Chapter 12 Understanding Controls Which of the following properties is associated with a ListBox but not a Button? a. BackColor b. SelectedItem c. Location d. IsSelected

b. SelectedItem

Ch 8. Advanced Methods When one of a method's parameters is optional, it means that ______________________. a. no arguments are required in a call to the method b. a default value will be assigned to the parameter if no argument is sent for it c. a default value will override any argument value sent to it d. you are not required to use the parameter within the method body

b. a default value will be assigned to the parameter if no argument is sent for it

Ch 10 Inheritance Quiz A(n) ____ class is one from which you cannot create concrete objects, but from which you can inherit. Select one: a. concrete b. abstract c. derived d. base

b. abstract

Chapter 14 Files and Streams The String class Split() method stores its results in ________________________. a. a string b. an array of strings c. an appropriate data type for each token d. an array of bytes

b. an array of strings

Ch 9 Classes When you use an instance variable within a class's nonstatic methods, you ________________________ explicitly refer to the method's this reference. a. must b. can c. cannot d. should (even though it is not required)

b. can

Chapter 11 Exception Handling When a program creates an Exception object, you ______________________. a. must handle it b. can handle it c. must not handle it d. none of these; programs cannot create Exceptions

b. can handle it

Chapter 11 Exception Handling Which of the following catch blocks will catch any Exception object? a. catch(Any e) {} b. catch(Exception e) {} c. catch(e) {} d. All of the above will catch any Exception

b. catch(Exception e) {}

Chapter 14 Files and Streams In the data hierarchy, a group of characters that has some meaning, such as a last name or ID number, is a ________________________. a. byte b. field c. file d. record

b. field

Ch 8. Advanced Methods Which is not a type of method parameter in C#? a. value b. forensic c. reference d. output

b. forensic

Ch 8. Advanced Methods Correctly overloaded methods must have the same ______________________. a. return type b. identifier c. parameter list d. All of the above.

b. identifier

Ch 9 Classes Quiz Using private fields within classes is an example of ____, a feature found in all object-oriented languages. Select one: a. overloading b. information hiding c. inheritance d. polymorphism

b. information hiding

Ch 10 Inheritance Specific types of objects assume features of more general classes through ____________________. a. polymorphism b. inheritance c. encapsulation d. structure

b. inheritance

Chapter 12 Understanding Controls The default event for a Control is the one that ________________________. a. occurs automatically whether or not a user manipulates the Control b. is generated when you double-click the Control while designing it in the IDE c. requires no parameters d. occurs when a user clicks the Control with a mouse

b. is generated when you double-click the Control while designing it in the IDE

Chapter 13 Handling Events A delegate is an object that contains a reference to a(n) _____________________________ . a. object b. method c. class d. Control

b. method

Ch 9 Classes Suppose that you declare a class named Furniture that contains a string field named woodType and a conventionally named property with a get accessor. When you declare an array of 200 Furniture objects named myChairs, which of the following accesses the last Furniture object's wood type? a. Furniture.Get(woodType[199]) b. myChairs[199].WoodType c. myChairs.WoodType[199] d. myChairs[199].WoodType()

b. myChairs[199].WoodType

Ch 10 Inheritance A base class named Garden contains a private field width and a property public int Width that contains get and set accessors. A child class named VegetableGarden does not contain a Width property. When you write a class in which you declare an object as follows, what statement can you use to access the VegetableGarden's width? a. VegetableGarden myGarden = new VegetableGarden(); b. myGarden.Width c. myGarden.base.Width d. VegetableGarden.Width e. You cannot use Width with a VegetableGarden object

b. myGarden.Width

Chapter 12 Understanding Controls Assume that you have created a Label named myLabel. Which of the following sets myLabel's background color to green? a. myLabel = BackColor.System.Drawing.Color.Green; b. myLabel.BackColor = System.Drawing.Color.Green; c. myLabel.Green = System.DrawingColor; d. myLabel.Background = new Color.Green;

b. myLabel.BackColor = System.Drawing.Color.Green;

Chapter 14 Files and Streams A file's ________________________ holds the byte number of the next byte to be read. a. index indicator b. position pointer c. header file d. key field

b. position pointer

Ch 9 Classes Most fields in a class are created with the ________________________ modifier. a. public b. private c. new d. protected

b. private

Ch 8. Advanced Methods Which of the following is an illegal method declaration? a. private static void CreateStatement(int acctNum, double balance = 0.0) b. private static void CreateStatement(int acctNum = 0, double balance) c. private static void CreateStatement(int acctNum = 0, double balance = 0) d. All of these are legal.

b. private static void CreateStatement(int acctNum = 0, double balance)

Ch 8. Advanced Methods Which of the following pairs of method declarations represent correctly overloaded methods? a. private static void Method(int a) private static void Method(int b) b. private static void Method(double d) private static int Method() c. private static double Method(int e) private static int Method(int f) d. Two of these are correctly overloaded methods.

b. private static void Method(double d) private static int Method()

Ch 9 Classes Assume that you have created a class named DemoCar. Within the Main() method of this class, you instantiate a Car object named myCar and the following statement executes correctly: WriteLine("The Car gets {0} miles per gallon", myCar.ComputeMpg()); Within the Car class, the ComputeMpg() method can be ________________________. a. public and static b. public and nonstatic c. private and static d. private and nonstatic

b. public and nonstatic

Ch 8 Advanced Methods Quiz Which of the following method declaration is not valid? Select one: a. public static void M4(int x, int y, int z) b. public static void M3(int x=1, int y, int z=3) c. public static void M2(int x, int y=2, int z=3) d. public static void M1(int x, int y, int z=3)

b. public static void M3(int x=1, int y, int z=3)

Chapter 14 Files and Streams When each record in a file is stored in order based on the value in some field, the file is a(n) ________________________ file. a. random access b. sequential c. formatted d. application

b. sequential

Chapter 11 Exception Handling If your program throws an IndexOutOfRangeException, and the only available catch block catches an Exception, ______________________. a. an IndexOutOfRangeException catch block is generated automatically b. the Exception catch block executes c. the Exception catch block is bypassed d. the IndexOutOfRangeException is thrown to the operating system

b. the Exception catch block executes

Ch 10 Inheritance When you create any derived class object, ____________________ . a. the base class and derived class constructors execute simultaneously b. the base class constructor must execute first, and then the derived class constructor executes c. the derived class constructor must execute first, and then the base class constructor executes d. neither the base class constructor nor the derived class constructor executes

b. the base class constructor must execute first, and then the derived class constructor executes

Chapter 12 Understanding Controls A ListBox's SelectedItem property contains ________________________ . a. the position of the currently selected item b. the value of the currently selected item c. a Boolean value indicating whether an item is currently selected d. a count of the number of currently selected items

b. the value of the currently selected item

Chapter 11 Exception Handling When you design your own classes that might cause exceptions, and other classes will use your classes as clients, you should usually create your methods to ______________________. a. neither throw nor handle exceptions b. throw exceptions but not handle them c. handle exceptions but not throw them d. both throw and handle exceptions

b. throw exceptions but not handle them

Chapter 11 Exception Handling In object-oriented terminology, you ______________________ a procedure that might not complete correctly. a. circumvent b. try c. catch d. throw

b. try

Ch 9 Classes When you create a class and want to include the capability to compare its objects so they can use the Array.Sort() or Array.BinarySearch() method, you must ________________________. a. include at least one numeric field within the class b. write a CompareTo() method for the class c. be careful not to override the existing IComparable.CompareTo() method d. Two of these are true.

b. write a CompareTo() method for the class

Chapter 14 Files and Streams When you store data in a computer file on a persistent storage device, you are ________________________. a. reading b. writing c. directing d. rooting

b. writing

Ch 8 Advanced Methods Quiz What would be the value of x and y after the following code being executed? static void Main(string[] args) { int x=4; int y=6; swap(ref x,y); } public static void swap(ref int x, int y) { int temp; temp = y; y = x; x = temp; } a. x will be 4, and y will be 4. b. x will be 6, and y will be 6. c. x will be 6 and y will be 4. d. x will be 4, and y will be 6.

b. x will be 6, and y will be 6.

Ch 10 Inheritance Abstract classes and interfaces are similar in that ____________________ . a. you can instantiate concrete objects from both b. you cannot instantiate concrete objects from either one c. all methods in both must be abstract d. neither can contain nonabstract methods

b. you cannot instantiate concrete objects from either one

Ch 8 Advanced Methods Quiz Which of the following pair of method declarations represent correctly overloaded methods? Select one: a. public static void M1(int a) public static void M2(int a) b. two of the pairs are correct. c. public static void M1(int a) public static void M1(int a, int b) d. public static int M1(int a) public static void M1(int a)

c. public static void M1(int a) public static void M1(int a, int b)

Chapter 11 Exception Handling Consider the following catch blocks. The variable c has been initialized to 0. If an IndexOutOfRangeException occurs in a try block just before this catch block, what is the value of c when this code completes? catch(IndexOutOfRangeException e) { ++c; } catch(Exception e) { ++c; } finally { ++c; } a. 0 b. 1 c. 2 d. 3

c. 2

Chapter 11 Exception Handling Consider the following try block. If x is 15, what is the value of a when this code completes? try { a = 99; if(x > 10) throw(new Exception()); a = 0; ++a; } a. 0 b. 1 c. 99 d. undefined

c. 99

Ch 9 Classes Quiz What happens when this statement is executed? Automobile car = new Automobile(1); Select one: a. A constructor that accepts a string in the Automobile class is called. b. An object of the Automobile class is declared, but not created. c. An object of the Automobile class is created. d. The default constructor in the Automobile class is called.

c. An object of the Automobile class is created.

Chapter 13 Handling Events Which of the following is true? a. A single event can be generated from multiple Controls. b. Multiple events can be generated from a single Control. c. Both of the above are true. d. None of the above are true.

c. Both of the above are true.

Ch 8. Advanced Methods A parameter array ______________________. a. is declared using the keyword params b. can accept any number of arguments of the same data type c. Both of these are true. d. Neither of these is true.

c. Both of these are true.

Ch 10 Inheritance Assuming that the following classes are well named, which of the following is a parent class of House? a. Apartment b. VictorianHouse c. Building d. myHouse

c. Building

Ch 8. Advanced Methods Assume you have declared a method as follows: private static double ComputeBill(int acct, double price, double discount = 0) Which of the following is a legal method call? a. ComputeBill(); b. ComputeBill(1001); c. ComputeBill(1001, 200.00); d. None of the above is legal.

c. ComputeBill(1001, 200.00);

Chapter 13 Handling Events Which of the following is not a predefined Control event? a. MouseEnter b. Click c. Destroy d. TextChanged

c. Destroy

Ch 9 Classes Assume that you have created a class named MyClass. The header of the MyClass constructor can be ________________________. a. public MyClass() b. public MyClass(double d) c. Either of these can be the constructor header. d. Neither of these can be the constructor header.

c. Either of these can be the constructor header.

Chapter 12 Understanding Controls Which of the following creates a Label named firstLabel? a. firstLabel = new firstLabel(); b. Label = new firstLabel(); c. Label firstLabel = new Label(); d. Label firstLabel = Label();

c. Label firstLabel = new Label();

Chapter 12 Understanding Controls Which of the following is not a commonly used Control property? a. BackColor b. Location c. Language d. Size

c. Language

When you create a ListBox, by default its SelectionMode is ________________________. a. Simple b. MultiExtended c. One d. false

c. One

Ch 10 Inheritance All of the following are Object class methods except ____________________ . a. ToString() b. Equals() c. Print() d. GetHashCode()

c. Print()

Chapter 14 Files and Streams 12. Which of the following is not a file Access enumeration? a. Read b. Write c. WriteRead d. ReadWrite

c. WriteRead

Ch 8. Advanced Methods Methods are ambiguous when they ______________________. a. are overloaded b. are written in a confusing manner c. are indistinguishable to the compiler d. have the same parameter type as their return type

c. are indistinguishable to the compiler

Ch 10 Inheritance When base and derived classes contain a method with the same name and parameter list, you can use the base class method within the derived class by using the keyword ____________________ before the method name. a. new b. override c. base d. super

c. base

Ch 10 Inheritance Which of the following is an English-language form of polymorphism? a. seeing a therapist and seeing the point b. moving friends with a compelling story and moving friends to a new apartment c. both of these d. neither of these

c. both of these

Chapter 11 Exception Handling Exception objects can be ______________________. a. generated automatically by C# b. created by a program c. both of these d. none of these

c. both of these

Chapter 13 Handling Events To combine two delegates using the + operator, the delegate objects must have _____________________________ . a. the same parameter list b. the same return type c. both of these d. neither of these

c. both of these

Chapter 14 Files and Streams A collection of data stored on a nonvolatile device in a computer system is a(n) ________________________. a. application b. operating system c. computer file d. memory map

c. computer file

Ch 9 Classes Quiz Two objects created from the same class can have different Select one: a. methods b. properties c. data d. fields

c. data

Chapter 13 Handling Events Which of the following correctly declares a delegate type? a. void aDelegate(int num); b. delegate void aDelegate(num); c. delegate void aDelegate(int num); d. delegate aDelegate(int num);

c. delegate void aDelegate(int num);

Chapter 14 Files and Streams A character used to specify the boundary between data items in text files is a ________________________. a. sentinel b. stopgap c. delimiter d. margin

c. delimiter

Chapter 12 Understanding Controls With a ListBox you can allow the user to choose ________________________. a. only a single option b. multiple selections c. either of these d. none of these

c. either of these

Chapter 13 Handling Events When a Form contains three Controls and one has focus, you can raise an event by _____________________________. a. clicking any Control b. pressing Enter c. either of these d. none of these

c. either of these

Chapter 14 Files and Streams Which character can be used to specify a boundary between characters in text files? a. a comma b. a semicolon c. either of these d. neither of these

c. either of these

Chapter 12 & 13 - Controls and Events Quiz The connection of an event to its resulting actions is known by what term? Select one: a. event watching b. event connecting c. event wiring d. event triggering

c. event wiring

Chapter 11 Exception Handling Any error condition or unexpected behavior in an executing program is known as an ______________________. a. exclusion b. anomaly c. exception d. omission

c. exception

Chapter 12 Understanding Controls A horizontal list of general options that appears under the title bar of a Form or Window is a ________________________. a. task bar b. subtitle bar c. menu strip d. list box

c. menu strip

Chapter 13 Handling Events In an event-handling method, the sender is the _____________________________ . a. delegate associated with the event b. method called by the event c. object where the event was initiated d. class containing the method that the event invokes

c. object where the event was initiated

Ch 9 Classes Quiz If you do not provide an access specifier for a class field, its access is ____ by default. Select one: a. public b. internal c. private d. protected

c. private

Ch 8. Advanced Methods A reference parameter differs from an output parameter in that a reference parameter ______________________ but an output parameter does not. a. receives a memory address b. occupies a unique memory address c. requires an initial value d. must be a simple data type

c. requires an initial value

Chapter 14 Files and Streams The argument to the String class Split() method is ________________________. a. void b. the number of fields into which to split a record c. the character that identifies a new field in a string d. a string that can be split into tokens

c. the character that identifies a new field in a string

Ch 10 Inheritance When a base class and a derived class contain a method with the same name and parameter list, and you call the method using a derived class object, ____________________. a. you receive an error message b. the base class version overrides the derived class version c. the derived class version overrides the base class version d. both method versions execute

c. the derived class version overrides the base class version

Chapter 11 Exception Handling A catch block executes when its try block ______________________. a. completes b. throws any Exception object c. throws an Exception of an acceptable type d. completes without throwing anything

c. throws an Exception of an acceptable type

Chapter 13 Handling Events In C#, events are _____________________________ . a. Boolean objects b. handled by catch blocks c. triggered by actions d. only used in GUI programs

c. triggered by actions

Chapter 13 Handling Events An event handler delegate requires _____________________________ argument(s). a. zero b. one c. two d. at least one

c. two

Chapter 11 and 14 Quiz When creating an Exception class, what is not one of the three recommended constructors needed? Select one: a. A constructor that takes a string message and an inner exception. b. A default constructor. c. A constructor that takes a string message. d. A constructor that takes a byte variable containing memory dumps

d. A constructor that takes a byte variable containing memory dumps

Chapter 12 Understanding Controls You can add items to a ListBox by using the ________________________ method. a. AddList() b. Append() c. List() d. AddRange()

d. AddRange()

Ch 8. Advanced Methods Assume that you have declared a method with the following header: private static void DisplayScores(params int[] scores) Which of the following method calls is valid? a. DisplayScores(20); b. DisplayScores(20, 33); c. DisplayScores(20, 30, 90); d. All of the above are valid

d. All of the above are valid.

Ch 8. Advanced Methods Assume you have declared a method as follows: private static double DisplayData(string name = "XX", double amount = 10.0) Which of the following is an illegal method call? a. DisplayData(name : "Albert"); b. DisplayData(amount : 200, name : "Albert"); c. DisplayData(amount : 900.00); d. All of these are legal.

d. All of these are legal.

Chapter 12 Understanding Controls Which of the following is most like a RadioButton? a. ListControl b. CheckedListBox c. PictureBox d. Button

d. Button

Chapter 14 Files and Streams Which of the following is not a File class method? a. Create() b. Delete() c. Exists() d. End()

d. End()

Chapter 11 Exception Handling When you create an Exception subclass of your own, you should extend the ______________________ class. a. SystemException b. PersonalException c. OverloadedException d. Exception

d. Exception

Ch 9 Classes Assume that you have created a class named MyClass. The header of the MyClass constructor can be ________________________. a. public void MyClass() b. public MyClassConstructor() c. Either of these can be the constructor header. d. Neither of these can be the constructor header.

d. Neither of these can be the constructor header.

Ch 10 Inheritance The root base class for all other class types is ____________________ . a. Base b. Super c. Parent d. Object

d. Object

Chapter 12 Understanding Controls The property that determines what the user reads on a Label is the ________________________ property. a. Setting b. Label c. Phrase d. Text

d. Text

Ch 8. Advanced Methods Suppose that you have declared an integer array named scores, and you make the following method call: TotalScores(scores, num : 1); Of the following overloaded method definitions, which would execute? a. private static void TotalScores(int[] scores) b. private static void TotalScores(int[] scores, int num) c. private static void TotalScores(int[] scores, int num = 10, int code = 10) d. The program would not compile

d. The program would not compile.

Ch 9 Classes Which of the following statements correctly instantiates a House object if the House class contains a single constructor with the declaration House(int bedrooms, double price)? a. House myHouse = new House(); b. House myHouse = new House(3, 125000.00); c. House myHouse = House(4, 200000.00); d. Two of these

d. Two of these

Ch 8. Advanced Methods Which of the following pairs of method declarations represent correctly overloaded methods? a. private static void MethodA(int a) private static void MethodA(int b, double c) b. private static void MethodB(double d) private static void MethodB() c. private static double MethodC(int e) private static double MethodD(int f) d. Two of these are correctly overloaded methods.

d. Two of these are correctly overloaded methods.

Chapter 11 Exception Handling Which of the following is not treated as a C# Exception? a. Your program asks the user to input a number, but the user enters a character. b. You calculate a value that is too large for the answer's variable type. c. You attempt to access an array with a subscript that is too large. d. You attempt to execute a C# program, but the C# compiler has not been installed.

d. You attempt to execute a C# program, but the C# compiler has not been installed.

Ch 9 Classes You explicitly call a destructor ________________________. a. when you are finished using an object b. when an object goes out of scope c. when a class is destroyed d. You cannot explicitly call a destructor.

d. You cannot explicitly call a destructor.

Ch 10 Inheritance Within an interface, ____________________ . a. no methods can be abstract b. some methods might be abstract c. some, but not all, methods must be abstract d. all methods must be abstract

d. all methods must be abstract

Chapter 14 Files and Streams Which of the following is serializable? a. an int b. an array of ints c. a string d. all of the above

d. all of the above

Chapter 12 Understanding Controls Labels, Buttons, and CheckBoxes are all ________________________. a. GUI objects b. Controls c. widgets d. all of these

d. all of these

Chapter 11 Exception Handling You can place ______________________ statement(s) within a try block. a. zero b. one c. two d. any number of

d. any number of

Chapter 13 Handling Events A single Control can raise _____________________________ event(s). a. one b. two c. five d. any number of

d. any number of

Chapter 11 Exception Handling How many catch blocks might follow a try block within the same method? a. only one b. any number as long as it is greater than zero c. any number as long as it is greater than one d. any number, including zero or one

d. any number, including zero or one

Ch 10 Inheritance Quiz You can use the keyword ____ to access a parent class method. Select one: a. super b. parent c. upper d. base

d. base

Ch 8 Advanced Methods Quiz Which of the following two methods cannot coexists in the same program. Select one: a. A: private static int Method(int x); private static int Method(double x); b. B: private static int Method(int x); private static int Method(int y); c. C: private static int Method(int x); private static void Method(int x); d. both B and C

d. both B and C

Ch 10 Inheritance When you create a class that is an extension or child of another class, you use a(n) ____________________ between the derived class name and its base class name. a. ampersand b. hyphen c. dot d. colon

d. colon

Chapter 13 Handling Events You can combine two delegates to create a(n) _____________________________ delegate. a. assembled b. classified c. artificial d. composed

d. composed

Ch 9 Classes In a program that creates five object instances of a class, the constructor executes ____________ time(s) and the destructor executes ________________________ time(s). a. one; one b. one; five c. five; one d. five; five

d. five; five

Ch 10 Inheritance Quiz Classes that depend on field names from parent classes are said to be ____ because they are prone to errors. Select one: a. solid b. fixed c. sound d. fragile

d. fragile

Ch 9 Classes A class header or class definition can contain all of the following except ________________________. a. an optional access modifier b. the keyword class c. an identifier d. initial field values

d. initial field values

Ch 10 Inheritance Quiz A base class named Automobile contains a private field length and a property public int Length that contains get and set accessors. A child class named Car doesn't contain a Length property. When you write a class in which you declare an object as follows, what statement can you use to access the Car's length? Car myCar = new Car(); Select one: a. myCar.length b. Car.length c. myCar.base.Length d. myCar.Length

d. myCar.Length

Ch 9 Classes Instance methods that belong to individual objects are ________________________ static methods. a. always b. usually c. occasionally d. never

d. never

Ch 9 Classes To allocate memory for an object instantiation, you must use the ________________________ operator. a. mem b. alloc c. instant d. new

d. new

Ch 10 Inheritance Quiz In C#, you can use either new or ____ when defining a derived class member that has the same name as a base class member. Select one: a. hide b. overload c. cast d. override

d. override

Ch 8. Advanced Methods The process of determining which overloaded version of a method to execute is overload ______________________. a. confusion b. infusion c. revolution d. resolution

d. resolution

Chapter 14 Files and Streams The process of converting objects into streams of bytes is ________________________. a. extrication b. splitting c. mapping d. serialization

d. serialization

Chapter 14 Files and Streams A channel through which data flows between a program and storage is a ________________________. a. path b. folder c. directory d. stream

d. stream

Chapter 11 and 14 Quiz When a file is open in C#, what holds the byte number of the next byte to be read? Select one: a. the magic number b. the file token c. the record token d. the file position pointer

d. the file position pointer

Chapter 11 Exception Handling When you write a block of code in which something can go wrong, and you want to throw an exception if it does, you place the code in a ______________________ block. a. catch b. blind c. system d. try

d. try

Ch 8. Advanced Methods Which type of method parameter receives the address of the variable passed in? a. a value parameter b. a reference parameter c. an output parameter d. two of the above

d. two of the above

Chapter 13 Handling Events If you have declared a delegate instance, you can assign it a reference to a method as long as the method has the same _____________________________ as the delegate. a. return type b. identifier c. parameter list d. two of the above

d. two of the above

Chapter 11 Exception Handling Which of the following is valid within a catch block with the header catch(Exception error)? a. WriteLine(error.ToString()); b. WriteLine(error.Message); c. return(error.ToString()); d. two of these

d. two of these

Chapter 13 Handling Events When you create Forms with Controls that raise events, an advantage to creating the code by hand over using the Visual Studio IDE is _____________________________. a. you are less likely to make typing errors b. you save a lot of repetitious typing c. you are less likely to forget to set a property d. you gain a clearer understanding of the C# language

d. you gain a clearer understanding of the C# language


Related study sets

Using Triangle Congruence Theorems Quiz

View Set

Chapter 5 - Learning and Conditioning

View Set

Personal Finance: Budget Variances and Tax Planning

View Set

Chapter 3 The External Assessment

View Set

Chapter 13 Macro Weird Questions

View Set