Computer Sci C# Chapters 9,10,11,12,13,14,15,16

¡Supera tus tareas y exámenes ahora con Quizwiz!

A method that is declared on a base class, but implemented in the derived class is called what? Select one: a. An abstract method b. A derived method c. An error! d. A half method

An abstract method

A method that is declared on a base class, but implemented in the derived class is called what? Select one: a. An error! b. An abstract method c. A derived method d. A half method

An abstract method

If you needed to sort an array with 10,000 items in the least amount of time, which sorting algorithm would you use? Select one: a. An algorithm with an efficiency of O(n2) b. These algorithms have the same speed over the same data c. Neither of these algorithms will work d. An algorithm with an efficiency of O( n * log(n) )

An algorithm with an efficiency of O( n * log(n) )

f you needed to sort an array with 10,000 items in the least amount of time, which sorting algorithm would you use? Select one: a. These algorithms have the same speed over the same data b. An algorithm with an efficiency of O( n * log(n) ) c. An algorithm with an efficiency of O(n2) d. Neither of these algorithms will work

An algorithm with an efficiency of O( n * log(n) )

What type of error does the C# language throw when something unexpected happens? Select one: a. A debug error b. A compiler error c. A malfunction error d. An exception

An exception

What method would you call to remove all of the nodes from a linked list? Select one: a. Clear() b. RemoveAll() c. DeleteAll() d. EradicateAllNodes()

Clear()

A "checkmate" in Chess, occurs when a player's queen is under imminent attack and there is no possible way to remove it from danger in the next move. Select one: True False

False

The "C" language was developed at Bell Labs in the 1970s as a fully object-oriented language. Select one: True False

False

The .NET Framework is limited to only drawing ellipses, rectangles and lines. Select one: True False

False

The Bubble Sort only requires a single pass through the data. Select one: True False

False

The original object-oriented programming language was created to help simulate the design of modern cars. Select one: True False

False

You can only create static methods, not static properties. Select one: True False

False

Name one other interchangeable term used to refer to a "method"? Select one: a. function b. technique c. block d. loop

function

Which one of the following languages is an OOP language? Select one: a. C b. C# c. Pascal d. FORTRAN

c#

Given the mystery() function below... double mystery(double a, double b) { return 3.0 * a / b; } ...what is the result from the following lines of code? double a = 3.0; double b = 1.0; result = mystery(b,a); Select one: a. A divide-by-zero error will occur at run-time b. 9.0 c. 3.0 d. 1.0

1.0

If the function calculateWeight() is declared with a double return type, which of the following lines of code is valid? 1. calculateWeight(); 2. double weight = calculateWeight(); 3. double cost = 0.1 * calculateWeight(); Select one: a. Only #1 and #2 are valid b. Only #1 is valid c. Only #2 and #3 are valid d. #1, #2, and #3 are all valid

#1, #2, and #3 are all valid

There can be many different ways to describe the relationship between two or more objects. Select one: True False

'True'.

For an image with width = 50 and height = 100 and an upper-left coordinate of (200, 200), which coordinate pair represents the image's bottom-right corner? Select one: a. (149,99) b. (299,249) c. (249,299) d. (250,300)

(249,299)

For a screen with 800 x 600 pixel resolution, what is the coordinate of the pixel in the top-right corner of the screen? Select one: a. (799,0) b. (0,0) c. (0,799) d. (799,599)

(799,0)

Given the mystery() function below... void mystery(int clue) { clue = 5; } ...what is the value of clue after the following lines of code? int clue = 4; mystery(clue); Select one: a. Impossible to tell from the information given b. 4 c. 5 d. A run-time error will occur.

4

Give an example of two objects that might share an "Uses-A" relationship. Select one: a. A Dog uses-a Cat b. A Vehicle uses-a Car c. A Car uses-a GPS d. A Wheel uses-a Truck

: A Car uses-a GPS

What is the result of the following code: int[ ] myArray = new int[3] { 5, 10, 15 }; int sum = 1; foreach (int value in myArray) { sum *= value; } MessageBox.Show(sum.ToString()); Select one: a. A MessageBox with the value 50 b. A MessageBox with the value 30 c. A MessageBox with the value 750 d. A MessageBox with the value 25

: A MessageBox with the value 750

If you do not create a class constructor, what happens when an instance of your class in created? Select one: a. The program will run, but you will not be able to access your class. b. A default constructor with no parameters and no logic within the function is automatically created by the compiler. c. The program will not compile if you do not create a constructor for your class. d. A default constructor is created by the compiler that has all the necessary parameters and logic to initialize the class.

: A default constructor with no parameters and no logic within the function is automatically created by the compiler.

What is a recursive function? Select one: a. A function which calls itself. b. A function that contains a program loop c. A function that returns a value d. A function that calls another function

: A function which calls itself.

How do well-written objects promote re-usable code? Select one: a. Objects can be shared between unrelated applications b. Objects can track useful data and provide useful methods c. All of these are true d. Objects can accurately model real-world things

: All of these are true

How would you apply object-oriented concepts to simplify a complex system? Select one: a. Create larger and larger objects until the system is represented by one large object b. Break the system down into smaller and smaller parts until each part is well-understood c. Separate all the system methods into one class and all the properties into another class d. Object-oriented concepts cannot be used to simplify a complex system

: Break the system down into smaller and smaller parts until each part is well-understood

Give an example of two objects that might share an "Is-A" relationship. Select one: a. Tea is-a Coffee b. Vehicle is-a Bus c. Cat is-an Animal d. Short-Story is-a Novel

: Cat is-an Animal

If you have a variable declared as a base class type, what must you do to access derived class data and methods from the variable? Select one: a. Use a Get( ) method from the base class b. Downcast the base class reference to the derived class type c. Use the dot operator after the base class name d. Upcast the derived class type to the base class reference

: Downcast the base class reference to the derived class type

Which is the most useful state for debugging a program? Select one: a. Debugging b. Running c. Stopped d. In-Break

: In-Break

What two very popular, modern programming languages were designed from the ground up with object-oriented concepts in mind? Select one: a. Visual Basic and C# b. Java and C# c. Java and C++ d. COBOL and C

: Java and C#

When is it possible for a class to access a "protected" data member of another class? Select one: a. Protected members can be accessed by any other class b. Protected members can be accessed only by sub-classes c. Protected members can be accessed only by other protected objects in your program d. Protected members can never be accessed by another class

: Protected members can be accessed only by sub-classes

How can you determine the number of elements in a one-dimensional array? Select one: a. Use the ArraySize or ArrayLength properties. b. Read the Length property or call GetLength(0) c. Read the Size property of the array d. Call the Size() or Length() methods on the array.

: Read the Length property or call GetLength(0)

Given the starting array {3, 2, 1}, after one complete pass with the Insertion Sort algorithm, what will the array contain? Select one: a. {1, 3, 2} b. {1, 2, 3} c. {3, 1, 2} d. {2, 1, 3}

: {1, 2, 3}

Which is the most useful state for debugging a program? Select one: a. In-Break b. Stopped c. Running d. Debugging

A ______________ is a place in the code where you want the debugger to pause the program. Select one: a. pausepoint b. break c. watchpoint d. breakpoint

How would you declare a function that requires the calling code to modify the original contents of an input parameter? Select one: a. void mystery(double clue out) b. double mystery(double clue) c. void mystery(out double clue) d. This is not possible; parameters are always passed by-value.

void mystery(out double clue)

Given the starting input array {7, 3, 6, 1}, what is the output array in each case when the bubble sort, insertion sort, and quick sort algorithms have completed? Select one: a. {1, 3, 6, 7} in all cases b. {1, 3, 6, 7}, {3, 1, 7, 6}, {7, 3, 1, 6} c. {1, 6, 3, 7}, {1, 3, 7, 6}, {6, 3, 7, 1} d. {7, 6, 3, 1} in all cases

{1, 3, 6, 7} in all cases

What are some common uses for recursion? Select one: a. A maze solution algorithm b. Computing the exponents of a number c. All of these are good examples of common uses for recursion d. The traversal of files and directories on a hard drive

All of these are good examples of common uses for recursion

What is one reason to create or use a method? Select one: a. Make code easy to follow and understand b. Execute the same task from different parts of your program c. Eliminate repetitious code d. All of these are good reasons

All of these are good reasons

What is one possible use for a recursive method? Select one: a. maze-solving b. sorting c. navigating directory structures d. All of these are possible uses

All of these are possible uses

Which of the following statements are true about relationships between objects? Select one: a. All of these are true b. Objects in a "has-a" relationship are owned by one another. c. Objects in an "is-a" relationship inherit common traits and behavior d. Objects in a "uses-a" relationship use the other's public methods and data.

All of these are true

Which of the following tasks might be suitable for moving into a separate function so you can re-use it from multiple places in your code? Select one: a. ask the user to confirm an input with a yes/no answer b. calculate a complex mathematical expression c. All of these could make good functions d. sort some data into an ordered list

All of these could make good functions

Which of the following tasks might be suitable for moving into a separate function so you can re-use it from multiple places in your code? Select one: a. sort some data into an ordered list b. ask the user to confirm an input with a yes/no answer c. All of these could make good functions d. calculate a complex mathematical expression

All of these could make good functions

What is a critical feature of any recursive method? Select one: a. A counter to keep track of the current position in the recursion process b. The ability to drive you insane c. A loop to iterate through the data d. An exit criteria to prevent infinite recursion

An exit criteria to prevent infinite recursion

What is an advantage of using a linked list over an array? Select one: a. Linked lists can grow or shrink without reallocating all elements b. Neither of these are true c. You can more easily add or remove elements from the middle of the list d. Both of these are true

Both of these are true

Why is it a good idea to declare internal methods and data as "private"? Select one: a. Neither of these are true b. Both of these are true c. Prevent external objects from accidentally changing internal data d. Hide internal implementation so it can be freely changed

Both of these are true

What is the imaginary box called that tightly surrounds any shape? Select one: a. Soap Box b. Square Bounds c. Wrapper Point d. Bounding Rectangle

Bounding Rectangle

What is usually a good approach when defining object methods? Select one: a. Define all functions as public unless you really need them to be private b. Make sure your public functions only call other public functions c. Try to keep as much logic as possible in one giant function d. Break the object's behavior down into smaller, more easily understood sub-functions

Break the object's behavior down into smaller, more easily understood sub-functions

What is usually a good approach when defining object methods? Select one: a. Make sure your public functions only call other public functions b. Break the object's behavior down into smaller, more easily understood sub-functions c. Try to keep as much logic as possible in one giant function d. Define all functions as public unless you really need them to be private

Break the object's behavior down into smaller, more easily understood sub-functions

What are the three main points to consider when defining an object Select one: a. Data, Objects, and Relationships b. Design, Relationships and Size c. Data, Methods and Relationships d. Data, Size and Complexity

Data, Methods and Relationships

What three general characteristics can be used to describe objects? Select one: a. Size, strength, and flexibility b. Data, methods, and relationships c. Data, algorithms, and scope d. Methods, data, and efficiency

Data, methods, and relationships

Who are we going to miss next year?

DrFormen.

Who is the best Teacher?

DrFormen.

Who will miss all her students?

DrFormen.

Which function would you call to create an outline of a perfect square? Select one: a. FillSquare() b. DrawSquare() c. DrawRectangle() d. FillRectangle()

DrawRectangle()

A method must have either a return value or method parameters. Select one: True False

False

A method with a void return type can return any kind of data type. Select one: True False

False

If you assign one class variable to another, you have created a copy of that class variable. Select one: True False

False

Java was developed by the Oracle Corporation. Select one: True False

False

Some methods in C# belong to classes, others only belong to programs, not classes. Select one: True False

False

The popularity of graphical programs and the Internet created the need for more structural programs. Select one: True False

False

When naming public properties and methods, you must begin them with an upper case letter. Select one: True False

False

You cannot call a base class constructor from a derived class Select one: True False

False

awns capture opposing pieces by moving horizontally on the board. Select one: True False

False

Consider the following code: namespace MyLibrary { namespace Vehicle { class Truck { } } } Which code statement would create a Truck object? Select one: a. Vehicle.Truck myTruck = new Vehicle.Truck(); b. Truck myTruck = new Truck(); c. MyLIbrary.Vehicle.Truck myTruck = new Truck(); d. MyLIbrary.Vehicle.Truck myTruck = new MyLibrary.Vehicle.Truck();

MyLIbrary.Vehicle.Truck myTruck = new MyLibrary.Vehicle.Truck();

Are the methods named "MyMethod()" and "myMethod()" viewed as the same method by the compiler? Why or why not? Select one: a. Maybe, it depends on the contents of the methods. b. Yes, the methods are named the same and are therefore seen as the same by the compiler. c. No; method names are case sensitive d. Yes, since neither method requires parameters, they are seen as the same by the compiler.

No; method names are case sensitive

What is the name of the function that can be used to force the screen to repaint itself? Select one: a. Validate() b. OnPaint() c. Invalidate() d. RePaint()

Invalidate()

What does the "O" in Big O notation mean? Select one: a. Objective-of b. Order-of c. Organization-of d. Object-of

Order-of

Why are X and Y values stored as float data types and not int data types? Select one: a. There is not enough room in an int data type to hold the X and Y information. b. Storing floating point numbers will help when you are moving images quickly across the screen. c. X and Y values are NEVER stored as floating point numbers. d. Storing floating point numbers to track image positions gives you very fine control over the location of the image.

Storing floating point numbers to track image positions gives you very fine control over the location of the image.

Why can't you access non-static class data from a static class method? Select one: a. Static methods cannot use any objects b. Non-static class data is marked private by default c. You can access non-static class data from a static class method d. Static methods have no way of knowing which instance of an object's non-static data you might want to access

Static methods have no way of knowing which instance of an object's non-static data you might want to access

Why can't you access non-static class data from a static class method? Select one: a. Static methods cannot use any objects b. You can access non-static class data from a static class method c. Non-static class data is marked private by default d. Static methods have no way of knowing which instance of an object's non-static data you might want to access

Static methods have no way of knowing which instance of an object's non-static data you might want to access

Consider the following code: Console.WriteLine("step 1"); // step 1 code here Console.WriteLine("step 2"); // step 2 code here Console.WriteLine("step 3"); // step 3 code here Console.WriteLine("step 4"); // step 4 code here If at runtime you see the following output, which step threw an exception? step 1 step 2 step 3 Select one: a. Step 4 b. Step 3 c. Step 2 d. Step 1

Step 3

Which debugging command would you use to execute a complete statement, including any functions within the statement, without stepping through the details line-by-line? Select one: a. Step Over b. Step Into c. Run d. Step Out

Step Over

Why are X and Y values stored as float data types and not int data types? Select one: a. Storing floating point numbers to track image positions gives you very fine control over the location of the image. b. Storing floating point numbers will help when you are moving images quickly across the screen. c. X and Y values are NEVER stored as floating point numbers. d. There is not enough room in an int data type to hold the X and Y information.

Storing floating point numbers to track image positions gives you very fine control over the location of the image.

Which of the following types of Brushes would you create in order to display an Image from a file within the shape? Select one: a. TextureBrush b. HatchBrush c. SolidBrush d. LinearGradientBrush

TextureBrush

The .NET Framework defines a number of very useful collections and related objects in the which namespace? Select one: a. The Collection namespace b. The Lists namespace c. The System.Collections namespace d. The Arrays namespace

The System.Collections namespace

The .NET Framework defines a number of very useful collections and related objects in the which namespace? Select one: a. The System.Collections namespace b. The Arrays namespace c. The Lists namespace d. The Collection namespace

The System.Collections namespace

What information can you obtain in a catch block for an error in your program? Select one: a. The System.Error variable has a property called Message, which will contain a description of the error. b. The System.Exception variable has a property called Message, which will contain a description of the error. c. The System.Exception variable has a property called Error, which will contain a description of the error. d. You cannot get any additional information in the catch block.

The System.Exception variable has a property called Message, which will contain a description of the error.

All array variables are reference variables. Select one: True False

True

All class variables are reference data types. Select one: True False

True

An effective debugging strategy often involves more than one debugging technique. Select one: True False

True

Class constructors must have the same name as the class itself. Select one: True False

True

Computer Y-coordinates are backwards from the standard Cartesian coordinate system. Select one: True False

True

Each time the recursive function is called, the function body represents a new scope with its own copy of any local variables.

True

Each time the recursive function is called, the function body represents a new scope with its own copy of any local variables. Select one: True False

True

Failing to code an exit condition for your recursive function can cause infinite recursion. Select one: True False

True

If you define parameters for your Constructor, you must provide them when you create an instance of the class. Select one: True False

True

It's a good idea to override the ToString method for an object in order to provide a custom description for the object. Select one: True False

True

Polymorphism means you can use an object as a generic type and it will actually behave differently, according to its actual type. Select one: True False

True

Protected members can be only be accessed from within that class and from any subclasses that inherit from the class. Select one: True False

True

The "paper" for drawing on the screen is the Graphics object. Select one: True False

True

The foreach command works the same for both a Linked List and an array. Select one: True False

True

There can be many different ways to describe the relationship between two or more objects. Select one: True False

True

To call the base class constructor that has parameters, you need to create a constructor that can supply the required parameters to the base. Select one: True False

True

We don't typically use simple System.Object variables directly in most programs. Select one: True False

True

When a program crashes you may get a useful error message with information like the exception that was thrown and a detailed description of the error. Select one: True False

True

When an exception is thrown, all remaining code statements in that block are skipped. Select one: True False

True

When you call an overridden method through a base class reference, C# is smart enough to figure out which version to call based on the actual type of the object. Select one: True False

True

You can assign default values to class properties when you declare them. Select one: True False

True

You can use a Pen to draw an outline or a Brush to make a solid shape. Select one: True False

True

What two keywords are used to handle any possible exceptions a program may throw? Select one: a. Pause and Resume b. Exception and Compiler c. Try and Catch d. Try and Fail

Try and Catch

How do you implement an abstract method in a derived class? Select one: a. Use the override keyword before the function name b. Use the abstract keyword before the function name c. Use the abstract keyword before the class name d. Use the override keyword before the class name

Use the override keyword before the function name

What technique is used in C# to better handle exceptions? Select one: a. Using a try and catch block around the entire program b. Using a try and parse block around the code c. Using a try and catch block around any suspect code d. There is no need to handle exception errors in C#

Using a try and catch block around any suspect code

What does "divide and conquer" mean when faced with a large task? Select one: a. You should delegate parts of a task to different people b. You should divide a task into two equal parts before getting started c. You should reduce the complexity with some mathematical operations d. You should break a task into smaller and smaller pieces until each one is trivial to solve

You should break a task into smaller and smaller pieces until each one is trivial to solve

Consider the following function: public string mystery(string input) { if (input.Length == 0) return ""; char first = input[0]; string remainder = input.Substring(1, input.Length - 1); return mystery(remainder) + first; } What will be the result returned from calling mystery("abc")? Select one: a. abc b. cba c. a | b | c d. c * b * a

cba

In the C# language (and in most languages), an object is referred to as a _____. Select one: a. library b. class c. object d. namespace

class

In the C# language (and in most languages), an object is referred to as a _____. Select one: a. library b. object c. namespace d. class

class

Which statement declares a class "CellPhone" that inherits from the class "Phone"? Select one: a. class Phone(CellPhone) b. class CellPhone isa Phone c. class Phone : CellPhone d. class CellPhone : Phone

class CellPhone : Phone

Which of the following code lines will create a derived class called DogClass from a base class named PetClass? Select one: a. class PetClass: DogClass { } b. class DogClass isa PetClass { } c. class DogClass: PetClass { } d. class Dog: Pet { }

class DogClass: PetClass { }

Arrays and Linked Lists are both examples of ___________. Select one: a. ways to store numeric data b. collections c. groups of data stored side-by-side in memory d. value data types

collections

rrays and Linked Lists are both examples of ___________. Select one: a. ways to store numeric data b. value data types c. collections d. groups of data stored side-by-side in memory

collections

Write a statement that shows the return value from function "g(x)" passed directly into function "f()" as the first input parameter. Select one: a. f( g=x); b. f( g(x ) ); c. g( f=x); d. g( f(x) );

f( g(x ) );

Which line of code demonstrates the correct way to call the wakeUp() method on an object of type Robot that is stored in a variable named "Freddie" ? Select one: a. freddie->wakeUp() b. wakeUp.freddie(); c. freddie.wakeUp(); d. Robot.freddie.wakeUp();

freddie.wakeUp();

Which of the following code lines will create a method called "myMethod" that does not have any parameters, but returns an integer value? Select one: a. int = myMethod() b. int myMethod() c. myMethod (returns int) d. myMethod(int myValue)

int myMethod()

Any class which inherits from a base class is called a: Select one: a. subclass. b. derived class. c. None of these answers is true. d. either a subclass or a derived class.

ither a subclass or a derived class.

What keyword needs to be used by a derived class to override a virtual base class method? Select one: a. virtual b. abstract c. override d. void

override

What keyword needs to be used by a derived class to override a virtual base class method? Select one: a. void b. abstract c. override d. virtual

override

If you use a base class reference to call an abstract method implemented by a derived class, what concept have you just demonstrated? Select one: a. inheritance b. abstract methods c. derived classes d. polymorphism

polymorphism

What type of methods can you create inside a class? Select one: a. You can only define methods that have return values, but not parameters. b. You can define any sort of method you like with different return types and input and output parameters. c. You can only define methods that do not have parameters or return values. d. You can only define methods that have parameters, but not return values.

You can define any sort of method you like with different return types and input and output parameters.

What type of methods can you create inside a class? Select one: a. You can only define methods that have return values, but not parameters. b. You can only define methods that do not have parameters or return values. c. You can define any sort of method you like with different return types and input and output parameters. d. You can only define methods that have parameters, but not return values.

You can define any sort of method you like with different return types and input and output parameters.

What kind of data can be returned from a method? Select one: a. You can only return numeric values from methods b. You can return values, variables or expressions, as long as they have the correct data type c. You must return a value, not a variable or an expression. d. You can only return variables, not plain values.

You can return values, variables or expressions, as long as they have the correct data type

What kind of data can be returned from a method? Select one: a. You can only return variables, not plain values. b. You can only return numeric values from methods c. You must return a value, not a variable or an expression. d. You can return values, variables or expressions, as long as they have the correct data type

You can return values, variables or expressions, as long as they have the correct data type

What is wrong with the following code? public void StartGame() { } class TicTacToe { } Select one: a. The class definition should come before the function b. Nothing, this will compile just fine c. The function name is not valid d. You cannot declare a function outside of a class

You cannot declare a function outside of a class

The typical external interface to a "black box" class is created by what? Select one: a. private methods b. public classes c. public methods d. protected methods

public methods

All array variables are of what data type, regardless of what the array contains? Select one: a. integers b. reference c. static d. primitive

reference

What keyword is used to send data back to the calling program? Select one: a. return b. exit c. send d. void

return

What keyword is used to send data back to the calling program? Select one: a. void b. exit c. send d. return

return

What can we say about the value of the saveMe variable after the following code executes? int saveMe = 3; mystery(saveMe); Select one: a. saveMe equals 3 b. We cannot say anything for sure; it depends on what the mystery() function does

saveMe equals 3

Write an expression that shows how to access the 4th element in an array called "myData". Select one: a. myData(4) b. myData[4] c. myData[3] d. myData(3)

myData[3]

Which of the following lines will draw a line on the screen from position (10,10) to position (50, 75)? Select one: a. myGraphics.DrawLine(myPen,10, 10, 50, 75); b. myGraphics.Draw(myPen,50, 75, 10, 10); c. myGraphics.Draw(myPen,10, 10, 50, 75); d. myGraphics.DrawLine(myPen,50, 75, 10, 10);

myGraphics.DrawLine(myPen,10, 10, 50, 75);

What line of code will remove all items from a linked list named myList? Select one: a. myList.RemoveAll(); b. myList.Clear(); c. myList.Remove(); d. myList.ClearAll();

myList.Clear();

Which of the following code statements would remove the value "3" from a linked list named myList? Select one: a. myList.Delete("3"); b. myList.Clear("3"); c. myList.Remove("3"); d. myList.RemoveAt(3);

myList.Remove("3");

Which of the following code statements would remove the value "3" from a linked list named myList? Select one: a. myList.RemoveAt(3); b. myList.Remove("3"); c. myList.Delete("3"); d. myList.Clear("3");

myList.Remove("3");

If the following code complies without errors, what can you say about the parameters defined in the mystery() function? double p1 = 3.0; String p2 = "three"; mystery(p1,p2); Select one: a. mystery() returns a double and a string as results b. mystery() contains at least two parameters, but perhaps more c. mystery() contains a double and a String parameter, in that order. d. mystery() contains parameters that MUST be named p1 and p2

mystery() contains a double and a String parameter, in that order.

When your program is paused in the debugger, the line with the arrow on it is the: Select one: a. line that contains an error. b. line that will not be run at all. c. line that was just executed. d. next line that will be executed.

next line that will be executed.

When your program is paused in the debugger, the line with the arrow on it is the: Select one: a. line that will not be run at all. b. line that was just executed. c. line that contains an error. d. next line that will be executed.

next line that will be executed.

The position of an image on the screen is identified using a single coordinate pair, usually the: Select one: a. top-center of the image. b. upper-left corner of the image. c. lower-left corner of the image. d. top of the image.

upper-left corner of the image.

The position of an image on the screen is identified using a single coordinate pair, usually the: Select one: a. upper-left corner of the image. b. lower-left corner of the image. c. top-center of the image. d. top of the image.

upper-left corner of the image.

Which of the following method declarations is NOT valid? Select one: a. void MyFunction1() b. void ThisIsMyFunction() c. void m() d. void my Function()

void my Function()

Which of the following method declarations is NOT valid? Select one: a. void my Function() b. void m() c. void MyFunction1() d. void ThisIsMyFunction()

void my Function()

Put the steps for the Quick Sort into their proper order: Arrange the elements in the list so that all of the values that are less than the "pivot" point value are to the left, and all of the greater values are to the right. Make sure there are elements in the list Sort each of the smaller lists until the entire list is sorted in a series of 1-element arrays. Choose a "pivot" point - typically the middle of the list Select one: a. 2, 4, 1, 2 b. 2, 4, 1, 3 c. 3, 4, 1, 2 d. 1, 4, 2, 3

2, 4, 1, 3

Give an example of two objects that might share an "Uses-A" relationship. Select one: a. A Dog uses-a Cat b. A Wheel uses-a Truck c. A Car uses-a GPS d. A Vehicle uses-a Car

A Car uses-a GPS

Which brush type can be used to fill a shape with patterns? Select one: a. A LinearGradientBrush b. A SolidBrush c. A TextureBrush d. A HatchBrush

A HatchBrush

Which brush type can be used to fill a shape with patterns? Select one: a. A TextureBrush b. A HatchBrush c. A SolidBrush d. A LinearGradientBrush

A HatchBrush

Given the following array: String[ ] myArray = new String[4] {"cat", "dog", "fish", "horse"}; What is the result of the following code: int index; for (index = 0; index < myArray.Length; index++) { if (myArray[index].Equals("fish")) break; } MessageBox.Show(index.ToString()); Select one: a. A MessageBox with the value 2 b. A MessageBox with the value 4 c. A MessageBox with the value 3 d. A MessageBox with the value 1

A MessageBox with the value 2

Given the following array: String[ ] myArray = new String[4] {"cat", "dog", "fish", "horse"}; What is the result of the following code: int index; for (index = 0; index < myArray.Length; index++) { if (myArray[index].Equals("fish")) break; } MessageBox.Show(index.ToString()); Select one: a. A MessageBox with the value 3 b. A MessageBox with the value 2 c. A MessageBox with the value 4 d. A MessageBox with the value 1

A MessageBox with the value 2

Given the following array: int[ ] myArray = new int[4] { 5, 10, 15, 20 }; What is the result of the following code: int num = 0; for (int i = 0; i < myArray.Length; i++) { num += myArray[i]; } MessageBox.Show(num.ToString()); Select one: a. A MessageBox with the value 15 b. A MessageBox with the value 50 c. A MessageBox with the value 45 d. A MessageBox with the value 30

A MessageBox with the value 50

Given the following array: int[ ] myArray = new int[4] { 5, 10, 15, 20 }; What is the result of the following code: int num = 0; for (int i = 0; i < myArray.Length; i++) { num += myArray[i]; } MessageBox.Show(num.ToString()); Select one: a. A MessageBox with the value 30 b. A MessageBox with the value 50 c. A MessageBox with the value 45 d. A MessageBox with the value 15

A MessageBox with the value 50

What is the result of the following code: int[ ] myArray = new int[3] { 5, 10, 15 }; int sum = 1; foreach (int value in myArray) { sum *= value; } MessageBox.Show(sum.ToString()); Select one: a. A MessageBox with the value 25 b. A MessageBox with the value 50 c. A MessageBox with the value 30 d. A MessageBox with the value 750

A MessageBox with the value 750

How does a code review help to pinpoint errors in your code? Select one: a. A code review is not a useful tool for debugging a program. b. A code review will examine your code line-by-line, looking to make sure the code makes sense, is formatted correctly and produces expected results. c. A code review will use very verbose output to tell you where your program is executing within the source code. d. A code review will allow you to watch a program running in the debugger.

A code review will examine your code line-by-line, looking to make sure the code makes sense, is formatted correctly and produces expected results.

How does a code review help to pinpoint errors in your code? Select one: a. A code review will use very verbose output to tell you where your program is executing within the source code. b. A code review will allow you to watch a program running in the debugger. c. A code review is not a useful tool for debugging a program. d. A code review will examine your code line-by-line, looking to make sure the code makes sense, is formatted correctly and produces expected results.

A code review will examine your code line-by-line, looking to make sure the code makes sense, is formatted correctly and produces expected results.

What would happen if you tried to create an abstract class with the "new" keyword? Select one: a. The program will build and run normally b. An exception at runtime c. A compiler error d. The program will run, but the data will be unreliable

A compiler error

Consider the following code: String myString = "12"; double myNumber = myString; What kind of error or exception will be generated? Select one: a. A StringException error will be thrown at runtime b. A compiler error, caused by a type mismatch c. This code will work without any problems d. A FormatException will be thrown at runtime

A compiler error, caused by a type mismatch

Consider the following code: String myString = "12"; double myNumber = myString; What kind of error or exception will be generated? Select one: a. A compiler error, caused by a type mismatch b. This code will work without any problems c. A StringException error will be thrown at runtime d. A FormatException will be thrown at runtime

A compiler error, caused by a type mismatch

When does a Bubble Sort algorithm know when it is finished? Select one: a. A complete pass is made through the array without swapping any numbers b. When all the items are sorted into the smallest possible pieces of data c. When the recursive function hits its exit condition. d. After a single pass of the array.

A complete pass is made through the array without swapping any numbers

What is a linked list? Select one: a. A group of linked array structures b. A data structure of elements that can be individually accessed using an index value. c. A special kind of array d. A data structure that holds a series of elements called nodes

A data structure that holds a series of elements called nodes

What is a recursive function? Select one: a. A function which calls itself. b. A function that calls another function c. A function that returns a value d. A function that contains a program loop

A function which calls itself.

What do arrays contain? Select one: a. A group of values of different types b. A group of values of the same data type c. A group of methods d. A single data value

A group of values of the same data type

What do arrays contain? Select one: a. A group of values of the same data type b. A group of values of different types c. A single data value d. A group of methods

A group of values of the same data type

When would you use a linked-list instead of an array? Select one: a. A linked list Is better for times when you need to frequently add or remove items from the list. b. A linked list is best when you know exactly how many items you will have in the list. c. Linked lists and arrays can be used interchangeably in your code. d. A linked list is best when you often need to access individual elements in the list.

A linked list Is better for times when you need to frequently add or remove items from the list.

Would an Insertion Sort be easier to implement on an array or linked list, and why? Select one: a. A linked list because you can randomly access the individual elements in the list. b. Neither data structure will work well for an Insertion Sort. c. An array because you can randomly access the individual elements in the array. d. A linked list because you can easily slide elements in and out of the list without re-allocating or copying elements

A linked list because you can easily slide elements in and out of the list without re-allocating or copying elements

Based on the lesson, what will the following code produce: Pawn piece3 = new Pawn(); piece3.Player = PlayerType.BLACK; piece3.Name = "Pawn"; piece3.Col = 5; piece3.Row = 2; MessageBox.Show(piece3.ToString()); Select one: a. A message box with the text: "Black Pawn at (5,2) - PAWNS RULE!" b. An error message c. A message box with the text: "Black Pawn at (5,2)" d. A message box with the text: "Pawn at (5,2)"

A message box with the text: "Black Pawn at (5,2) - PAWNS RULE!"

Which of the following best describes an abstract method? Select one: a. A method that can only be used in the base class b. A method that is declared and implemented within the base class c. A method declared, but not implemented, in a base class d. A method that cannot be used by the derived class

A method declared, but not implemented, in a base class

What is a virtual method? Select one: a. A method that MUST be implemented in the derived class b. A method that MUST be overridden in the derived class c. A method that is declared, but not implemented in the base class d. A method that is implemented in the base class, but can be optionally overridden by the derived class.

A method that is implemented in the base class, but can be optionally overridden by the derived class.

What is a virtual method? Select one: a. A method that MUST be implemented in the derived class b. A method that is implemented in the base class, but can be optionally overridden by the derived class. c. A method that MUST be overridden in the derived class d. A method that is declared, but not implemented in the base class

A method that is implemented in the base class, but can be optionally overridden by the derived class.

How would you best visualize a one-dimensional and two-dimensional array? Select one: a. A one-dimensional array is grid and a two-dimensional array is cube of elements. b. A one-dimensional array is a grid and a two-dimensional array is a line of elements. c. A one-dimensional array is line and a two-dimensional array is grid of elements. d. A one-dimensional array is line and a two-dimensional array is longer line of elements.

A one-dimensional array is line and a two-dimensional array is grid of elements.

What is a breakpoint? Select one: a. A function that causes the program to enter the in-break mode b. A place in the code where you want the debugger to pause the program in-break mode c. A variable that shows the current state of the program d. A place in the code where the program causes an error

A place in the code where you want the debugger to pause the program in-break mode

What symbol marks a breakpoint you have set in the Visual C# IDE? Select one: a. A blue triangle b. A yellow diamond c. A green square d. A red circle

A red circle

A class property must have the following data type: Select one: a. A string data type b. Any data type c. A reference data type d. Another class type

A reference data type

What is the difference between a singly-linked list and a doubly-linked list? Select one: a. A singly-linked list only knows how to reach the next item in the list. A doubly-linked list can find the next or previous item in the list. b. A doubly-linked list only knows how to reach the next item in the list. A singly-linked list can find the next or previous item in the list. c. A singly-linked list can only handle one item, a doubly-linked list can handle 2 or more items. d. A doubly-linked list has two references to the next item in the list. A singly-linked list has only one reference to the next item.

A singly-linked list only knows how to reach the next item in the list. A doubly-linked list can find the next or previous item in the list.

What is the result of the following code? SolidBrush mySolidBrush = new SolidBrush(Color.Green); Rectangle myRect = new Rectangle(50,200,100,100); myGraphics.FillEllipse(mySolidBrush, myRect); Select one: a. A solid circle 100 pixels wide and high b. A solid ellipse 50 pixels wide and 200 pixels high c. An outlined ellipse 50 pixels wide and 200 pixels high d. A solid circle 200 pixels wide and high

A solid circle 100 pixels wide and high

What is a class constructor? Select one: a. A special method that is called when a class variable is created. b. A special method that is automatically called when a class is created with the new keyword. c. A special method that is automatically called when the class is destroyed.

A special method that is automatically called when a class is created with the new keyword.

What is the result of the following code? Pen myPen = new Pen(Color.Blue, 1); Point startingPoint = new Point(50,50); Point endingPoint = new Point(50,100); myGraphics.DrawLine(myPen, startingPoint, endingPoint); Select one: a. A horizontal blue line b. A diagonal blue line from lower left to upper right c. A vertical blue line d. A diagonal blue line from upper left to lower right

A vertical blue line

What is a "watch" and what is it used for? Select one: a. A watch is a way to examine a variable's value while debugging b. A watch is a timer used to measure the efficiency of your program. c. A watch is a variable that shows the current status of the overall program. d. A watch is a special breakpoint used in the debugger

A watch is a way to examine a variable's value while debugging

What will be the base class for the Chess pieces in our game? Select one: a. BasePiece b. GamePiece c. Chess d. AbstractChessPiece

AbstractChessPiece

Given algorithm A is O(4 * n) and algorithm B is O(n2), which algorithm is better for n = 2, n = 4, and n = 8 ? Select one: a. A is better for n = 2, and n = 4, and B is better for n = 8 b. Both algorithms are equally good at handling all the data. c. B is better for n = 2, both are equal for n = 4, and A is better for n = 8 d. A is better for n = 2, both are equal for n=4, and B is better for n = 8

B is better for n = 2, both are equal for n = 4, and A is better for n = 8

What language is Microsoft's answer to Java? Select one: a. Simula 67 b. C++ c. C# d. Visual Basic

C#

What language is Microsoft's answer to Java? Select one: a. Simula 67 b. Visual Basic c. C# d. C++

C#

Which one of the following languages is an OOP language? Select one: a. Pascal b. C c. C# d. FORTRAN

C#

How can you force a screen to redraw? Select one: a. Call Redraw() b. There is no way to do this under program control; it always happens automatically c. Call Invalidate() d. Call Paint()

Call Invalidate()

In our chess game, which AbstractChessPiece method will be created as virtual? Select one: a. IsValidMove() b. CanMoveToLocation() c. CanCaptureLocation() d. Rook()

CanCaptureLocation()

Which of the following is an example of object up-casting? Select one: a. Casting a base reference to a derived data type b. Casting an abstract reference to a base data type c. Casting a derived reference to a base data type d. Casting a base reference to an abstract data type

Casting a derived reference to a base data type

What is the difference between a singly-linked list and a doubly-linked list? Select one: a. A singly-linked list has only one element. A doubly-linked list has two or more elements. b. Each element in a singly-linked list only knows how to reach the next element. Doubly-linked list elements know how to reach previous and next elements. c. A doubly-linked list has two references to the next item in the list. A singly-linked list has only one reference to the next item. d. Each element in a singly-linked list can reach either the previous or next elements. A doubly-linked list can only find the next element in the list.

Each element in a singly-linked list only knows how to reach the next element. Doubly-linked list elements know how to reach previous and next elements.

Given the code below, which of the following statements will create a new TicTacToe object? namespace Game { class TicTacToe { } } Select one: a. new Game.TicTacToe(); b. new Game(TicTacToe); c. new Game(); d. new TicTacToe : Game;

Game.TicTacToe();

In the C# Quick Sort sample, what do the "leftBound" and "rightBound" parameters do? Select one: a. Identifies the beginning and end of the overall recursion b. Identify the smaller portion of the array that the sorting algorithm is currently processing c. Defines the beginning and end of the entire array to be sorted d. Points to the exit condition for the recursion

Identify the smaller portion of the array that the sorting algorithm is currently processing

When might exception handling code be particularly useful in a program? Select one: a. Exception handling is not particularly useful in any program b. If you have a simple block of code c. If you have a large block of code d. If you have a block of code that is risky, complicated, or subject to bad input data

If you have a block of code that is risky, complicated, or subject to bad input data

What is the name of the function that can be used to force the screen to repaint itself? Select one: a. OnPaint() b. Validate() c. Invalidate() d. RePaint()

Invalidate()

What is the most likely type of exception that could be thrown from the following function? String mystery(String[] input) { if (input != null) return input[1]; else return ""; } Select one: a. NullReferenceException b. FormatException c. IndexOutOfRangeException d. InvalidCastException

IndexOutOfRangeException

What is inheritance? Select one: a. Inheritance allows for the methodical execution of the code in an object. b. Inheritance is when you break complex systems down into smaller, manageable parts. c. Inheritance allows objects to hide their internal details. d. Inheritance allows similar objects to share common details or traits.

Inheritance allows similar objects to share common details or traits.

What is inheritance? Select one: a. Inheritance is when you break complex systems down into smaller, manageable parts. b. Inheritance allows similar objects to share common details or traits. c. Inheritance allows objects to hide their internal details. d. Inheritance allows for the methodical execution of the code in an object.

Inheritance allows similar objects to share common details or traits.

How do similar objects share common data and methods? Select one: a. Using enumeration b. Objects are not allowed to share common data or methods c. Inheritance or sub-classing d. Using return values

Inheritance or sub-classing

In the Quick Sort algorithm, what does the "partitioning" step accomplish? Select one: a. It moves all values smaller than the pivot to the left and larger values to the right of the pivot value b. Partitioning is not a part of the Quick Sort algorithm. c. It divides the data exactly in half d. It picks a value to be used when pivoting

It moves all values smaller than the pivot to the left and larger values to the right of the pivot value

What language was created from the ground up as an object-oriented language? Select one: a. C++ b. FORTRAN c. Java d. LISP

Java

Where should your method definition go within a source file? Select one: a. Just inside the curly braces of another function b. Just inside the class curly braces so the method belongs to a class c. Just inside the namespace curly braces so all classes can access it d. All these are possible locations

Just inside the class curly braces so the method belongs to a class

What characters are allowed to start a C# method name? Select one: a. Letters or underscores (_) b. Underscores (_) or numbers c. Letters only d. Numbers and letters

Letters or underscores (_)

Which of the following statements declares a variable called "myInts" that can hold a linked list of int values? Select one: a. LinkedList<int> myInts= new LinkedList<int>(); b. System.Collections.LinkedList myInts; c. int myInts<int> = new LinkedList(); d. int myInts = new LinkedList();

LinkedList<int> myInts= new LinkedList<int>();

Once you declare any method as abstract, what must you also do to the overall class? Select one: a. Give it a name that starts with "Abstract" b. Implement all the methods in the class c. All of these are correct d. Mark the class itself as abstract

Mark the class itself as abstract

What property on the System.Exception object contains a description of the error? Select one: a. Message b. Text c. ErrorText d. Description

Message

What is the most likely type of exception the following code might throw? int mystery(String input) { return input.Length; } Select one: a. DivideByZeroException b. IndexOutOfRangeException c. NullReferenceException d. InvalidCastException

NullReferenceException

What are method parameters? Select one: a. Parameters are the rules that govern how methods are written. b. Parameters include all the code within a method. c. Parameters are the data that you receive from your method to the calling code d. Parameters are the data that you pass into your method from the calling code

Parameters are the data that you pass into your method from the calling code

What are method parameters? Select one: a. Parameters include all the code within a method. b. Parameters are the data that you pass into your method from the calling code c. Parameters are the rules that govern how methods are written. d. Parameters are the data that you receive from your method to the calling code

Parameters are the data that you pass into your method from the calling code

If a base class constructor requires parameters, what must the derived class do? Select one: a. Pass parameters to the base class using the base keyword. b. Create a similar constructor in the derived class. c. Initialize the base class member variables in the derived class constructor. d. Nothing. This is entirely handled by the base class.

Pass parameters to the base class using the base keyword.

Which of the following lines of code will create a red pen that is 5 pixels wide. Select one: a. Pen myPen = new Pen(Color.Red, 5); b. Pen myPen = new Pen(5, Color.Red); c. Pen myPen = new Pen(Color.Red, 3); d. Pen myPen = new Pen(Color.Black, 5);

Pen myPen = new Pen(Color.Red, 5);

Which of the following lines of code will create a red pen that is 5 pixels wide. Select one: a. Pen myPen = new Pen(Color.Red, 5); b. Pen myPen = new Pen(Color.Red, 3); c. Pen myPen = new Pen(5, Color.Red); d. Pen myPen = new Pen(Color.Black, 5);

Pen myPen = new Pen(Color.Red, 5);

What was the first OOP language? Select one: a. Simula 67 b. LISP c. C# d. Java

Simula 67

How can program tracing help you to locate errors in your program? Select one: a. Program tracing uses very verbose output to tell you where your program is executing within the source code. b. Program tracing involves watching your program run in the debugger. c. Program tracing will examine your code line-by-line, looking to make sure the code makes sense, is formatted correctly and produces expected results. d. Program tracing cannot help you to debug a program.

Program tracing uses very verbose output to tell you where your program is executing within the source code.

How can program tracing help you to locate errors in your program? Select one: a. Program tracing will examine your code line-by-line, looking to make sure the code makes sense, is formatted correctly and produces expected results. b. Program tracing involves watching your program run in the debugger. c. Program tracing uses very verbose output to tell you where your program is executing within the source code. d. Program tracing cannot help you to debug a program.

Program tracing uses very verbose output to tell you where your program is executing within the source code.

How should programmers handle boundary conditions or data constraints? Select one: a. Programmers should carefully define the range of data expected for all values, and understand how to handle data that is unusual in any way. b. By assuming users will not use values outside the normal range. c. There is no way for a programmer to handle this issue. d. By allowing the program to through an exception when a boundary condition is met.

Programmers should carefully define the range of data expected for all values, and understand how to handle data that is unusual in any way.

What are static methods and properties? Select one: a. Properties and methods that all have public access. b. Properties and methods that all have private access. c. Properties and methods that belong to all instances of the class simultaneously. d. Properties and methods that all have protected access.

Properties and methods that belong to all instances of the class simultaneously.

What are static methods and properties? Select one: a. Properties and methods that belong to all instances of the class simultaneously. b. Properties and methods that all have public access. c. Properties and methods that all have protected access. d. Properties and methods that all have private access.

Properties and methods that belong to all instances of the class simultaneously.

From where can "public" and "private" data be accessed? Select one: a. Public data can be accessed by any object. Private data can be accessed only from within methods belonging to the object. b. Public data can be accessed only from within methods that belong to an object. Private data can be accessed from any object. c. Public data can be accessed by any object. Private data can be accessed only from abstract methods. d. Public data can be accessed by any object. Private data cannot be accessed by anyone.

Public data can be accessed by any object. Private data can be accessed only from within methods belonging to the object.

What is the difference between public and private data? Select one: a. Private data is accessible by any external component that uses the object. Public data is only available to the object itself. b. There is no difference between private and public data. c. Public data can be changed during the life of the object. Private data cannot be changed. d. Public data is accessible by any external component that uses the object. Private data is only available to the object itself.

Public data is accessible by any external component that uses the object. Private data is only available to the object itself.

How would you obtain the number of pixels from top-to-bottom in the draw-able area within your current window? Select one: a. Call getCurrentHeight() b. Read the this.clientSize.Width property c. Read the this.clientSize.Height property d. Call getCurrentWidth()

Read the this.clientSize.Height property

Assuming the following Pen declaration: Pen myPen = new Pen(Color.Red, 2); How would we create an outline of an Ellipse that starts at (10, 10) and ends at (20, 70)? Select one: a. Rectangle myRect = new Rectangle(10,10,20,70); myGraphics.FillEllipse(myPen, myRect); b. myGraphics.DrawEllipse(myPen, 10, 10, 70); c. Rectangle myRect = new Rectangle(10,10,20,70); myGraphics.DrawEllipse(myPen, myRect); d. myGraphics.FillEllipse(myPen, 10, 10, 20);

Rectangle myRect = new Rectangle(10,10,20,70); myGraphics.DrawEllipse(myPen, myRect);

Assuming the following Pen declaration: Pen myPen = new Pen(Color.Red, 2); How would we create an outline of an Ellipse that starts at (10, 10) and ends at (20, 70)? Select one: a. myGraphics.DrawEllipse(myPen, 10, 10, 70); b. myGraphics.FillEllipse(myPen, 10, 10, 20); c. Rectangle myRect = new Rectangle(10,10,20,70); myGraphics.DrawEllipse(myPen, myRect); d. Rectangle myRect = new Rectangle(10,10,20,70); myGraphics.FillEllipse(myPen, myRect);

Rectangle myRect = new Rectangle(10,10,20,70); myGraphics.DrawEllipse(myPen, myRect);

Assuming the following code: SolidBrush mySolidBrush = new SolidBrush(Color.Red); Which of the following code blocks will create a solid rectangle that starts at point (10, 20) and is 30 pixels wide and 50 pixels high? Select one: a. Rectangle myRect = new Rectangle(30,50,10,20); myGraphics.FillRectangle(mySolidBrush, myRect); b. Rectangle myRect = new Rectangle(10,20,50,30); myGraphics.FillRectangle(mySolidBrush, myRect); c. Rectangle myRect = new Rectangle(10,20,30,50); myGraphics.FillRectangle(mySolidBrush, myRect); d. Rectangle myRect = new Rectangle(10,20,30,50); myGraphics.DrawRectangle(mySolidBrush, myRect);

Rectangle myRect = new Rectangle(10,20,30,50); myGraphics.FillRectangle(mySolidBrush, myRect);

What are two drawbacks to implementing a recursive algorithm? Select one: a. Recursion can take a great deal of memory and can be tricky to implement correctly b. There are no drawbacks to recursive programming c. Recursion is slow and requires the use of nested loops in a function d. Recursion requires more lines code and more time to process an algorithm

Recursion can take a great deal of memory and can be tricky to implement correctly

What are the two states for programs in the Visual C# debugger? Select one: a. Debugging and Running b. Running and Stopped c. Running and In-Break d. Debugging and Stopped

Running and In-Break

What does the following function do? int mystery(int input1, int input2) { if (input1 > input2) return input1; else return input2; } Select one: a. Returns the lesser of the input1 and input2 values b. Computes the sum of input1 and input2 c. Returns the greater of the input1 and input2 values d. Prints the values of input1 and input2

Returns the greater of the input1 and input2 values

What debugging command would you execute to make the program resume running from the current point? Select one: a. Run or Continue b. Step Over c. Step Out d. Pause

Run or Continue

What are the two possible program states in the debugger? Select one: a. Running and Stopped b. Paused and Stopped c. Running and In-Break d. Stopped and Paused

Running and In-Break

What was the first OOP language? Select one: a. Java b. C# c. LISP d. Simula 67

Simula 67

Which of the following statements declares a variable called "myStrings" that can hold a linked list of strings? Select one: a. String myStrings = new LinkedList<string>; b. System.Collections.LinkedList myStrings; c. String myStrings<string> = new LinkedList(); d. System.Collections.Generic.LinkedList<string> myStrings;

System.Collections.Generic.LinkedList<string> myStrings;

Given the following array: int[ ] myArray = new int[3] { 5, 10, 15 }; How would you get an enumerator to navigate the array? Select one: a. Enumerator iterator = myArray.GetEnumerator(); b. IEnumerator iterator = myArray.GetEnumerator(); c. System.Collections.IEnumerator iterator = myArray.GetEnumerator(); d. System.IEnumerator iterator = myArray.GetEnumerator();

System.Collections.IEnumerator iterator = myArray.GetEnumerator();

In the C# language, all objects inherit from a single root base class called: Select one: a. System.Class b. System.Object c. System.Class.Object d. System

System.Object

Which is the simplest of the sorting algorithms? Select one: a. None of these is correct b. The Insertion Sort c. The Bubble Sort d. The Simple Sort

The Bubble Sort

Which is the simplest of the sorting algorithms? Select one: a. None of these is correct b. The Simple Sort c. The Insertion Sort d. The Bubble Sort

The Bubble Sort

What C# object is used to draw lines and shapes? Select one: a. The Drawing object b. The Brush object c. The Pen object d. The Shape object

The Pen object

What C# object is used to draw lines and shapes? Select one: a. The Pen object b. The Shape object c. The Drawing object d. The Brush object

The Pen object

What .NET Framework object can be used to store a pair of X and Y coordinates? Select one: a. The Point object b. The Pixel object c. The Vector2 object d. The Coordinate object

The Point object

What .NET Framework object can be used to store a pair of X and Y coordinates? Select one: a. The Point object b. The Vector2 object c. The Pixel object d. The Coordinate object

The Point object

How does the Quick Sort algorithm improve on the performance of the Bubble Sort or Insertion Sort? Select one: a. The Quick Sort uses recursion to sort the data with an efficiency of O = n * log(n), which is a big improvement over the other algorithms. b. The Quick Sort uses an iterative technique to sort the data with an efficiency of O = (n), which is a big improvement over the other algorithms. c. The Quick Sort uses recursion to sort the data with an efficiency of O = n2, which is a big improvement over the other algorithms. d. The Quick Sort is not more efficient than either the Bubble Sort or the Insertion Sort.

The Quick Sort uses recursion to sort the data with an efficiency of O = n * log(n), which is a big improvement over the other algorithms.

How does the Quick Sort algorithm improve on the performance of the Bubble Sort or Insertion Sort? Select one: a. The Quick Sort uses recursion to sort the data with an efficiency of O = n * log(n), which is a big improvement over the other algorithms. b. The Quick Sort uses recursion to sort the data with an efficiency of O = n2, which is a big improvement over the other algorithms. c. The Quick Sort uses an iterative technique to sort the data with an efficiency of O = (n), which is a big improvement over the other algorithms. d. The Quick Sort is not more efficient than either the Bubble Sort or the Insertion Sort.

The Quick Sort uses recursion to sort the data with an efficiency of O = n * log(n), which is a big improvement over the other algorithms.

A static property is especially useful for any property that is intended to be a global setting. Select one: True False

True

What does the "Big O" notation measure? Select one: a. The overall complexity of a program's source code. b. The order of variables in a program c. The number of objects in a class file d. The approximate order of overall time and resources needed to complete an algorithm

The approximate order of overall time and resources needed to complete an algorithm

If a derived class does not override a virtual method, what implementation gets executed when the method is called? Select one: a. None of these are correct b. The base class implementation c. The derived class implementation d. A default class implementation

The base class implementation

What is meant by a screen's "resolution"? Select one: a. The screen width and height in terms of pixel counts. b. The number of colors that can be seen on a screen. c. The intensity of the colors on a screen. d. The width, in pixels, of the screen.

The screen width and height in terms of pixel counts.

Assume we create an abstract class named PetClass and then derive a class named DogClass from PetClass. The DogClass includes a Bark() method that is not existent in the PetClass. What happens when the following code is run? DogClass myDog = new DogClass(); PetClass myPet = new DogClass(); myDog.Bark(); myPet.Bark(); Select one: a. The code will cause an error on line 2 b. The code will cause an error on line 4 c. The code will cause an error on line 3 d. The code will run fine

The code will cause an error on line 4

Assume we create an abstract class named PetClass and then derive a class named DogClass from PetClass. The DogClass includes a Bark() method that is not existent in the PetClass. What happens when the following code is run? DogClass myDog = new DogClass(); PetClass myPet = new DogClass(); myDog.Bark(); myPet.Bark(); Select one: a. The code will cause an error on line 4 b. The code will run fine c. The code will cause an error on line 3 d. The code will cause an error on line 2

The code will cause an error on line 4

When calling a method, why is the order of parameters provided to the function important? Select one: a. The parameters must all be in alphabetical order. b. The compiler will assign input data to parameter variables in the order received, regardless of input or parameter variable names c. The parameters must be arranged in order of size, so the compiler can deal with large data first and small data last. d. The order of the parameters is not important at all.

The compiler will assign input data to parameter variables in the order received, regardless of input or parameter variable names

What is meant by a screen's "resolution"? Select one: a. The screen width and height in terms of pixel counts. b. The width, in pixels, of the screen. c. The intensity of the colors on a screen. d. The number of colors that can be seen on a screen.

The screen width and height in terms of pixel counts.

What are class methods? Select one: a. The relationships that belong to a class. b. The functions that belong to a class. c. The instances of a class. d. The variables that belong to a class.

The functions that belong to a class.

In the following code: void myMethod(); What does the word "void" mean? Select one: a. The keyword void means the method cannot be used in a program b. The keyword void means the method will not return any value c. The keyword void means the method will return a value d. The keyword void means the method will not perform any tasks

The keyword void means the method will not return any value

What does the keyword "void" mean when it is placed in front of a method declaration? Select one: a. The method is invalid b. The method will not be returning a value to the calling code c. The method does not require any parameters d. The method cannot be used by another class

The method will not be returning a value to the calling code

What need resulted in the creation of the "Simula 67" programming language? Select one: a. The need for a simpler, more robust programming language b. The need to create complex mathematical simulations c. The need to model complex ships that shared common traits d. The need to create a language that handled large amounts of data

The need to model complex ships that shared common traits

Consider the following code: class Car { public String make; private int numWheels = 4; } What happens when you run the following code: Car myCar = new Car(); myCar.make="Tucker"; myCar.numWheels=2; Select one: a. The program will cause an error when the make property is accessed. b. The program will cause an error when the numWheels property is accessed. c. The program will run correctly. d. The program will not compile.

The program will cause an error when the numWheels property is accessed.

Consider the following code: class Car { public String make; private int numWheels = 4; } What happens when you run the following code: Car myCar = new Car(); myCar.make="Tucker"; myCar.numWheels=2; Select one: a. The program will cause an error when the numWheels property is accessed. b. The program will not compile. c. The program will run correctly. d. The program will cause an error when the make property is accessed.

The program will cause an error when the numWheels property is accessed.

We will override the ToString method in the AbstractChessPiece class to provide what information? Select one: a. The type of chess piece b. The player that owns the chess piece c. The color of the chess piece d. We will not override the ToString method

The type of chess piece

Given the following array: int[ ] myArray = new int[5]; Consider the following code: for (int i = 0; i < myArray.Length; i++) { myArray[i] = i * 5; } What values are now in the array? Select one: a. The values: 0, 5, 10, 15, 20 b. The values: 1, 5, 10, 15, 20 c. The values: 5, 10, 15, 20, 25 d. The values: 0, 5, 25, 125, 625

The values: 0, 5, 10, 15, 20

Given the following array: int[ ] myArray = new int[5]; Consider the following code: for (int i = 0; i < myArray.Length; i++) { myArray[i] = i * 5; } What values are now in the array? Select one: a. The values: 5, 10, 15, 20, 25 b. The values: 1, 5, 10, 15, 20 c. The values: 0, 5, 10, 15, 20 d. The values: 0, 5, 25, 125, 625

The values: 0, 5, 10, 15, 20

What are class properties? Select one: a. The relationships between classes. b. The methods that belong to a class. c. The variables that belong to a class. d. The instances of a class.

The variables that belong to a class.

How can language and reference material help you find errors in your code? Select one: a. These materials will inspect your code for any oddities. b. These materials will show the exact line number of the error in your program. c. These materials are not used in solving program errors d. These materials will allow you to double-check the syntax and format of different methods.

These materials will allow you to double-check the syntax and format of different methods.

How can language and reference material help you find errors in your code? Select one: a. These materials will show the exact line number of the error in your program. b. These materials will inspect your code for any oddities. c. These materials are not used in solving program errors d. These materials will allow you to double-check the syntax and format of different methods.

These materials will allow you to double-check the syntax and format of different methods.

What is one important thing to remember about static methods? Select one: a. These methods can only work with data that is specific to one instance of the class. b. These methods can access any other methods and properties. c. Static methods can only be created on protected classes. d. These methods can only access other static methods and properties.

These methods can only access other static methods and properties.

What does it mean to model complex systems in OOP? Select one: a. This means to hide the details of the complex system architecture. b. This means to take simple systems and build them up into more complex systems. c. This means to take complex systems and break them down into smaller and simpler objects that work together. d. This means to allow similar objects to share common details or traits.

This means to take complex systems and break them down into smaller and simpler objects that work together.

In C#, an unexpected error will do what? Select one: a. Throw an "exception" b. Be ignored by the program c. Throw a party d. Cause the program to pause until you fix the problem.

Throw an "exception"

Why would you want to design an object as a "black box"? Select one: a. To make it large enough to hold all the data b. To hide the internal implementation details so we can change them later c. To be stylish and sleek d. To make sure everyone knows exactly how the object is implemented

To hide the internal implementation details so we can change them later

What is the purpose of constructor parameters? Select one: a. Constructor parameters are required for all class constructors. b. To properly initialize any necessary information in the class. c. You cannot use parameters in class constructors.

To properly initialize any necessary information in the class.

What is the purpose of constructor parameters? Select one: a. You cannot use parameters in class constructors. b. To properly initialize any necessary information in the class. c. Constructor parameters are required for all class constructors.

To properly initialize any necessary information in the class.

What method on System.Object provides a textual description of the object? Select one: a. Message( ) b. ToString( ) c. Text( ) d. Desc( )

ToString( )

What is the most useful method on the base object? Select one: a. Constructor() b. ToString() c. Name() d. Load()

ToString()

What is the most useful method on the base object? Select one: a. ToString() b. Name() c. Constructor() d. Load()

ToString()

A "black box" gives objects the ability to hide their internal details. Select one: True False

True

A "linear" algorithm is one where there is a 1 to 1 correlation between the number of elements and the time it takes to complete the algorithm. Select one: True False

True

A "linear" algorithm is one where there is a 1 to 1 correlation between the number of elements and the time it takes to complete the algorithm. Select one: True False Feedback The correct answer is

True

A "watch" will allow you to examine the data contained in a variable while the program is paused and compare it to your expected data. Select one: True False

True

A base class variable can be assigned an instance of any class derived from that base type to the variable Select one: True False

True

A method is a function that belongs to an object or class. Select one: True False

True

A method is useful when you have a task that may need to be performed many times during a program. Select one: True False

True

A namespace is a way to organize objects. Select one: True False

True

How do you specify that a variable in the calling code used as a method parameter can be changed within the method body? Select one: a. Use the "global" keyword b. Use the "out" keyword c. Use the "change" keyword d. You can never change the value of a variable in the calling code inside of a method body.

Use the "out" keyword

When should you use a derived class reference and not the base class reference? Select one: a. When you want to use a method or property on a derived class that is not available on the base class. b. You should never use derived class references c. You should always use derived class references, never base class references d. When you need to use a method or property on the base class

When you want to use a method or property on a derived class that is not available on the base class.

When is a class constructor method called? Select one: a. The first time any class method is used in a program. b. When the object is created with the "new" keyword c. Whenever you assign a value to a class property d. None of these are true

When the object is created with the "new" keyword

When should you use a derived class reference and not the base class reference? Select one: a. You should always use derived class references, never base class references b. You should never use derived class references c. When you want to use a method or property on a derived class that is not available on the base class. d. When you need to use a method or property on the base class

When you want to use a method or property on a derived class that is not available on the base class.

How and where will you actually draw custom graphics? Select one: a. By drag-n-drop of the graphics on the Form Design screen b. With the Graphics object in the OnPaint() method c. With the Graphics object in the Draw() method d. With the Drawable object in the OnPaint() method

With the Graphics object in the OnPaint() method

How does a recursive method end? Select one: a. Recursive functions are meant to run until the program ends. b. The recursive function will end when it reaches the end of the data c. You will need to create some exit logic that will allow the recursive function calls to end d. The recursive function will end when it reaches the return keyword.

You will need to create some exit logic that will allow the recursive function calls to end

What keyword would you use to reference the base class version of a method? Select one: a. abstract b. default c. override d. base

base

What keyword would you use to reference the base class version of a method? Select one: a. base b. override c. abstract d. default

base

Any class which inherits from a base class is called a: Select one: a. derived class. b. subclass. c. None of these answers is true. d. either a subclass or a derived class.

either a subclass or a derived class.

Which keyword should replace the "???" question marks below to ensure the currentPlayer member can only be accessed by TicTacToe objects? class TicTacToe { ??? int currentPlayer; } Select one: a. abstract b. restricted c. protected d. private

private

Which statement below will replace the "???" question marks to declare a private, static string variable on the TicTacToe class named "PLAYER1_SYMBOL" and initialize it to the value "X"? class TicTacToe { ???? } Select one: a. private static string PLAYER1_SYMBOL = "X"; b. protected char PLAYER1_SYMBOL = 'X'; c. static string PLAYER1_SYMBOL = "X"; d. private string PLAYER1_SYMBOL : X;

private static string PLAYER1_SYMBOL = "X";

What type of access is NOT recommended for class properties? Select one: a. It doesn't matter what access type you use for your class properties. b. public c. protected d. private

public

What type of access is NOT recommended for class properties? Select one: a. protected b. public c. It doesn't matter what access type you use for your class properties. d. private

public

Assuming you have a DogClass, which derives from the base PetClass, how would you call the base class constructor from the DogClass constructor? Select one: a. public DogClass() : base() b. public DogClass() : PetClass() c. public base() d. public PetClass() : DogClass()

public DogClass() : base()

How would you declare a constructor for the "TicTacToe" class that requires an integer parameter? Select one: a. public TicTacToe(int currentPlayer) b. public Constructor(int currentPlayer) c. public CurrentPlayer( ) d. public TicTacToe( ) { int currentPlayer = 0; }

public TicTacToe(int currentPlayer)

Given the following array: int[ ] myArray = new int[3] { 5, 10, 15 }; How would you get an enumerator to navigate the array? Select one: a. System.IEnumerator iterator = myArray.GetEnumerator(); b. IEnumerator iterator = myArray.GetEnumerator(); c. Enumerator iterator = myArray.GetEnumerator(); d. System.Collections.IEnumerator iterator = myArray.GetEnumerator();

ystem.Collections.IEnumerator iterator = myArray.GetEnumerator();


Conjuntos de estudio relacionados

Introduction to Clinical Nursing Final Exam

View Set

APUSH Midterm: Important People, Terms, & Events

View Set

Hoofdstuk 7 Nederlands in gang (7): personaal pronomen A0-A1

View Set

Living earth unit test (march 19th)

View Set

Assignment: PrepU Management of Patients with Gastric and Duodenal Disorders

View Set

Political Science Midterm Questions

View Set