Exam 1 Study Guide ISYS 3393

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

A child class is also called a(n) ____________________ . A. extended class B. base class C. superclass D. delineated class

A

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

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

An object is a(n) ________________________ of a class. A. instantiation B. institution C. child D. relative

A

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

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

In C#, a(n) _____________________________ is triggered when specific changes to an object occur. A. event B. delegate C. notification D. instantiation

A

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

ListBox, ComboBox, and CheckedListBox objects all descend from which family? A. ListControl B. List C. ButtonBase D. ListBase

A

Most methods in a class are created with the ________________________ modifier. A. public B. private C. new D. protected

A

Of the following, the most significant difference between many console applications and GUI applications is ______________ . A. their appearance B. their ability to accept input C. their ability to perform calculations D. their ability to be created using C#

A

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

The Control that causes an event is the _____________________________ argument to an event method. A. first B. second C. third D. fourth

A

The Control you frequently use to provide descriptive text for another Control object is a ________________________. A. Label B. Form C. CheckBox D. MessageBox

A

The EventArgs class contains a static field named _____________________________. A. Empty B. Text C. Location D. Source

A

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 D. delegate name indicating the event raised when the user tabs to the Control

A

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

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

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

When you create an abstract method, you provide ____________________. A. the keyword abstract B. curly braces C. method statements D. all of these

A

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

Which of the following is a legal Form Name property value? A. PayrollForm B. Payroll Form C. either of the above D. none of the above

A

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

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. polymorph C. a perimeter D. a superclass

A

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

11. Which of the following is a class? a. System b. Console c. void d. WriteLine()

Console

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

A single Control can raise _____________________________ event(s). A. one B. two C. five D. any number of

D

A(n) ______________ is generated when a user interacts with a GUI object. A. error B. occasion C. method D. event

D

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

If you create a Button named yesButton, the default name of the method that responds to clicks on it is ______________ . A. button1_Click() B. yesButton_Method() C. click_YesButton() D. yesButton_Click()

D

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

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

Instance methods that belong to individual objects are ________________________ static methods. A. always B. usually C. occasionally D. never

D

Labels, Buttons, and CheckBoxes are all ________________________. A. GUI objects B. Controls C. widgets D. all of these

D

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()

D

The button1_Click() method that is generated by the IDE ______________ . A. has a private access specifier B. is nonstatic C. contains parameters between its parentheses D. all of the above

D

The property that determines what the user reads on a Label is the ________________________ property. A. Setting B. Label C. Phrase D. Text

D

The root base class for all other class types is ____________________ A. Base B. Super C. Parent D. Object

D

To allocate memory for an object instantiation, you must use the ________________________ operator. A. mem B. alloc C. instant D. new

D

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

Which of the following is most like a RadioButton? A. ListControl B. CheckedListBox C. PictureBox D. Button

D

Which of the following is not a Form property? A. BackColor B. Size C. Text D. ProjectName

D

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

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

You can add items to a ListBox by using the ________________________ method. A. AddList() B. Append() C. List() D. AddRange()

D

You can combine two delegates to create a(n) _____________________________ delegate. A. assembled B. classified C. artificial D. composed

D

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

______________ are controls through which a user can enter input data in a GUI application. A. Labels B. Tags C. Tickets D. TextBoxes

D

1. Which of the following is a method? a. namespace b. class c. Main() d. static

Main()

6. Which of the following pairs is an example of a class and an object, in that order? a. University and Yale b. Chair and desk c. Clydesdale and horse d. Maple and tree

University and Yale

1. If a programmer inserts using static System.Console; at the top of a C# program, which of the following can the programmer use as an alternative to System.Console.WriteLine("Hello");? a. System("Hello"); b. WriteLine("Hello"); c. Console.WriteLine("Hello"); d. Console("Hello");

WriteLine("Hello");

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

. 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. None of these are true.

c. Both of these are true.

Identify the false statement. a. The following statement is legal in C#: char department = '5'; b. The following statement is legal in C#: char department = '\f'; c. The following statement is legal in C#: char department = '32';

c. The following statement is legal in C#: char department = '32';

Identify the false statement. a. C# supports nine integral data types, including the most basic one, int. b. Every Unicode character, including the letters of the alphabet and punctuation marks, can be represented as a number. c. When you assign a value to any numeric variable, it is optional to use commas for values in the thousands.

c. When you assign a value to any numeric variable, it is optional to use commas for values in the thousa

3. The grammar and spelling rules of a programming language constitute its _____________ . a. logic b. variables c. class d. syntax

syntax

Programming errors such as using incorrect punctuation or misspelling words are collectively known as ____________________ errors. a. syntax b. logical c. executable d. fatal

syntax

When you use a method, you do not need to know how it operates internally. This feature is called _____. a. scope management b. selective ignorance c. implementation hiding d. privacy

c. implementation hiding

13. Every method in C# contains a _________________________ . a. header and a body b. header and a footer c. variable and a class d. class and an object

header and a body

9. A series of characters that appears within double quotation marks is a(n) ______________ .

literal string

8. Which of the following languages is least similar to C#? a. Java b. Visual Basic c. C++ d. machine language

machine language

4. Variables are _______________ . a. named memory locations b. unexpected results c. grammar rules d. operations

named memory locations

12. In C#, a container that groups similar classes is a(n) ___________________ . a. superclass b. method c. namespace d. identifier

namespace

5. Programs in which you create and use objects that have attributes similar to their real-world counterparts are known as ______________ programs. a. procedural b. logical c. object-oriented d. authentic

object-oriented

1. Which of the following identifiers is not legal in C#? a. per cent increase b. annualReview c. HTML d. alternativetaxcredit

per cent increase

Most fields in a class are created with the ________________________ modifier. A. public B. private C. new D. protected

private

1. The text of a program you write is called _________________________. a. object code b. source code c. machine language d. executable documentation

source code

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

A delegate is an object that contains a reference to a(n) _____________________________ . A. object B. method C. class D. Control

B

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

All Control objects descend from ________________________ . A. Form B. Component C. ButtonBase D. all of these

B

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

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

If you inadvertently create a Click() method for a control that should not generate a click event, you can successfully eliminate the method by ______________ . A. deleting the method code from the Form1.cs file B. eliminating the method from the Events list in the Properties window C. adding the method to the Discard window D. making the method a comment by placing two forward slashes at the start of each line

B

In the IDE, the area where you visually construct a Form is the ______________ . A. Toolbox B. Form Designer C. Easel D. Sandbox

B

Specific types of objects assume features of more general classes through ____________________. A. polymorphism B. inheritance C. encapsulation D. structure

B

The Control in which you can display a bitmap or JPEG image is a(n) ________________________ . A. DisplayModule B. PictureBox C. BitmapControl D. ImageHolder

B

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

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

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

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

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

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

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

Which of the following is a GUI object that provides an interface for collecting, displaying, and delivering information and that contains other controls? A. Button B. Form C. TextBox D. Label

B

Which of the following is a legal and conventional name for a TextBox? A. Salary TextBox B. salaryTextBox C. both of the above D. none of the above

B

Which of the following properties is associated with a ListBox but not a Button? A. BackColor B. SelectedItem C. Location D. IsSelected

B

Two of the following statements are true, and one is false. Identify the false statement: a. When you write the declaration for a method that accepts a parameter, you need to include the parameter's data type within the method header. b. When you write the declaration for a method that accepts a parameter, you need to include the identifier of the argument that will be sent to the method within the method header. c. When you write the declaration for a method that accepts a parameter, you need to include a local identifier for the parameter within the method header.

B: When you write the declaration for a method that accepts a parameter, you need to include the identifier of the argument that will be sent to the method within the method header.

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

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

After you have dragged a Button onto a Form in the IDE, you can double-click it to ______________ A. delete it B. view its properties C. create a method that executes when a user clicks the Button D. increase its size

C

All of the following are Object class methods except ____________________ . A. ToString() B. Equals() C. Print() D. GetHashCode()

C

An event handler delegate requires _____________________________ argument(s) . A. zero B. one C. two D. at least one

C

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 ________________________. public and static public and nonstatic private and static private and nonstatic

C

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

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

In C#, events are _____________________________ . A. Boolean objects B. handled by catch blocks C. triggered by actions D. only used in GUI programs

C

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

In the Visual Studio IDE main window, where does the menu bar lie? A. vertically along the left border B. vertically along the right border C. horizontally across the bottom of the window D. horizontally across the top of the window

C

Statements allowed in a Click() method include ______________ . A.variable declarations B. arithmetic statements C. both of the above D. none of the above

C

The Form class has ______________ properties. A. three B. ten C. about 100 D. about 1000

C

The process of changing a program's internal structure without changing the way the program works is ______________ . A. compiling B. debugging C. code refactoring D. systems analysis

C

The value in a TextBox is ______________ . A. an int B. a double C. a string D. It might be any of the above.

C

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

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

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

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

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

C

When you create a ListBox, by default its SelectionMode is ________________________. A. Simple B. MultiExtended C. One D. false

C

When you create a new Windows Forms project, by default the first Form you see is named ______________ . A. Form B. FormA C. Form1 D. FormAlpha

C

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

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

Which of the following does not appear in the IDE's Toolbox list? A. Label B. Button C. Text D. TextBox

C

Which of the following is a legal Form Text property value? A. PayrollForm B. Payroll Form C. either of the above D. none of the above

C

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

Which of the following is not a commonly used Control property? A. BackColor B. Location C. Language D. Size

C

Which of the following is not a predefined Control event? A. MouseEnter B. Click C. Destroy D. TextChanged

C

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

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

Assume 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

Identify the false statement. a. A floating-point number is one in which the decimal point varies each time you reference it. b. C# supports three floating-point data types: float, double, and decimal. c. To explicitly store a constant as a float, you may place an F after the number, but to store a constant as a double you need no special designation.

a. A floating-point number is one in which the decimal point varies each time you reference it.

Two of the following statements are true, and one is false. Identify the false statement: a. A method header must contain declared accessibility. b. A method header must contain a return type. c. A method header must contain an identifier.

a. A method header must contain declared accessibility.

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

c. forensic

Two of the following statements are true, and one is false. Identify the false statement: a. An optional parameter to a method is one for which an argument can be a value parameter, a ref parameter, or an out parameter. b. You make a parameter optional by providing a value for it in the method declaration. c. If you assign a default value to any variable in a method's parameter list, then all parameters to the right of that parameter must also have default values.

a. An optional parameter to a method is one for which an argument can be a value parameter, a ref parameter, or an out parameter.

a. Assuming number and answer are legally declared variables with assigned values, then the following statement is valid: WriteLine("{1}{2}", number, answer); b. Assuming number and answer are legally declared variables with assigned values, then the following statement is valid: WriteLine("{1}{1}{0}", number, answer); c. Assuming number and answer are legally declared variables with assigned values, then the following statement is valid: WriteLine("{0}{1}{1}{0}", number, answer);

a. Assuming number and answer are legally declared variables with assigned values, then the following statement is valid: WriteLine("{1}{2}", number, answer);

Two of the following statements are true, and one is false. Identify the false statement: a. C# classes always contain a Main() method. b. An object is an instantiation of a class. c. The data components of a class often are its instance variables.

a. C# classes always contain a Main() method.b. An object is an i

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 are legal.

a. CalculateDiscount();

Two of the following statements are true, and one is false. Identify the false statement: a. Console applications are used for declaring variables and constants and performing arithmetic, but GUI applications are not. b. GUI programs usually take longer to develop than their console counterparts because you can spend a lot of time setting up and arranging the controls. c. Console applications look dull compared to GUI applications, but they can often be developed more quickly because you do not spend much time setting up objects for a user to manipulate.

a. Console applications are used for declaring variables and constants and performing arithmetic, but GUI applications are not.

Two of the following statements are true, and one is false. Identify the false statement: a. Declaring a class creates one object of a new data type. b. After you declare a class, you must use the new operator to allocate memory for an object of that class and to instantiate it. c. After an object has been instantiated, its public members can be accessed using the object's identifier, a dot, and a method call.

a. Declaring a class creates one object of a new data type.

Identify the false statement. a. If rate is 7.5 and min is 7, then the value of rate >= min is false. b. If rate is 7.5 and min is 7, then the value of rate < min is false. c. If rate is 7.5 and min is 7, then the value of rate == min is false.

a. If rate is 7.5 and min is 7, then the value of rate >= min is false.

Identify the false statement. a. In C#, an identifier must begin with an underscore, the at sign ( @ ), or an uppercase letter. b. An identifier can contain only letters, digits, underscores, and the @ sign, not special characters such as #, $, or &. c. An identifier cannot be a C# reserved keyword.

a. In C#, an identifier must begin with an underscore, the at sign ( @ ), or an uppercase letter.

Two of the following statements are true, and one is false. Identify the false statement: a. Label and TextBox names usually start with an uppercase letter, but Form names usually start with a lowercase letter. b. Professional programmers usually do not retain the default names for Forms and controls. c. If you rename an event method, you must refactor the code.

a. Label and TextBox names usually start with an uppercase letter, but Form names usually start with a lowercase letter.

Identify the false statement. a. Line comments start with two forward slashes ( // ) and end with two backslashes ( \\ ). b. Block comments can extend across as many lines as needed. c. You use a namespace with a using clause, or using directive, to shorten statements when you need to repeatedly use a class from the same namespace.

a. Line comments start with two forward slashes ( // ) and end with two backslashes ( \\ ).

Which of the following is a good reason for creating methods within a program? a. Methods are easily reusable. b. Because all methods must be stored in the same class, they are easy to find. c. The Main() method becomes more detailed. d. All of these are true.

a. Methods are easily reusable.

Suppose the value of isRateOK() is true, and the value of isQuantityOK() is false. When you evaluate the expression isRateOK() || isQuantityOK(), which of the following is true? a. Only the method isRateOK() executes. b. Only the method isQuantityOK() executes. c. Both methods execute. d. Neither method executes.

a. Only the method isRateOK() executes.

Identify the false statement. a. Strings are information that methods need to perform their tasks. b. The WriteLine() method displays output on the screen and positions the cursor on the next line, where additional output might be displayed. c. Many methods such as WriteLine() have been created for you because the creators of C# assumed you would need them frequently.

a. Strings are information that methods need to perform their

Two of the following statements are true, and one is false. Identify the false statement: a. The following is a usable C# method header:private static void MyMethod(double amt, sum) b. The following is a usable C# method header:private static void MyMethod2(int x, double y) c. The following is a usable C# method header:static void MyMethod3(int id, string name, double rate)

a. The following is a usable C# method header:private static void MyMethod(double amt, sum)

Identify the false statement. a. The following is valid: int age = Convert.ToInt(ReadLine()); b. The following is valid: double payRate = Convert.ToDouble(ReadLine()); c. The following is valid: int dependents = int.Parse(ReadLine());

a. The following is valid: int age = Convert.ToInt(ReadLine());

Two of the following statements are true, and one is false. Identify the false statement: a. The following methods are potentially ambiguous:private static int Method1(int g)private static int Method1(int g, int h) b. The following methods are potentially ambiguous:private static double Method2(int j)private static void Method2(int k) c. The following methods are potentially ambiguous:private static void Method3(string m)private static string Method3(string n)

a. The following methods are potentially ambiguous:private static int Method1(int g)private static int Method1(int g, int h)

Identify the false statement. a. The value of 26 % 4 * 3 is 18. b. The value of 4 / 3 + 2 is 3. c. If price is 4 and tax is 5, then the value of price - tax++ is -1.

a. The value of 26 % 4 * 3 is 18.

10. The C# method that produces a line of output on the screen and then positions the cursor on the next line is ________________ . a. WriteLine() b. PrintLine() c. DisplayLine() d. OutLine()

a. WriteLine()

A method declaration might contain _____. a. declared accessibility b. a nonstatic modifier c. multiple return types d. parameters separated by dots

a. declared accessibility

When an array is passed to a method, the method has access to the array's memory address. This means an array is passed by _____. a. reference b. value c. alias d. orientation

a. reference

A method's type is also its _____. a. return type b. accessibility c. parameter type d. scope

a. return type

Assume 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

Suppose you have declared a variable as int myAge = 21;. Which of the following is a legal call to a method with the declaration private static void AMethod(int num)? a. AMethod(int 55); b. AMethod(myAge); c. AMethod(int myAge); d. AMethod();

b. AMethod(myAge);

1. Programming languages such as C#, Java, and Visual Basic are ____________________languages. a. machine b. high-level c. low-level d. uninterpreted

b. High-level

Identify the false statement. a. If deptNum is an int with a value of 10, then the following is valid: double answer = deptNum; b. If answer is a double with a value of 10.0, then the following is valid: int deptNum = answer; c. If value is a double with a value of 12.2, then the following is valid: double answer = (int)value;

b. If answer is a double with a value of 10.0, then the following is valid: int deptNum = answer;

Identify the false statement. a. If creature1 = "dog" and creature2 = "cat", then the value of String.Equals(creature1, creature2) is false. b. If creature1 = "dog" and creature2 = "cat", then the value of String.Compare(creature1, creature2) is false. c. If creature1 = "dog" and creature2 = "cat", then the value of creature1.CompareTo(creature2) is a positive number.

b. If creature1 = "dog" and creature2 = "cat", then the value of String.Compare(creature1, creature2) is false.

Identify the false statement. a. Procedural programs use variables and tasks that are grouped into methods or procedures. b. Object-oriented programming languages do not support variables or methods; instead they focus on objects. c. Object-oriented programs were first used for simulations and GUI programs.

b. Object-oriented programming languages do not support variables or methods; instead they focus on objects.

Two of the following statements are true, and one is false. Identify the false statement: a. When a program in Visual Studio has a syntax error, you see an error dialog box that asks if you want to continue with the last successful build. You should always respond No. b. Program errors are harder to locate in the Visual Studio IDE than they are in applications written using a plain text editor. c. If you inadvertently create a Click() method in Visual Studio, you should not delete its code. You should select the event in the Properties window and delete it there.

b. Program errors are harder to locate in the Visual Studio IDE than they are in applications written using a plain text editor.

Two of the following statements are true, and one is false. Identify the false statement: a. A property is a member of a class that defines how fields will be set and retrieved. b. Properties contain set accessors for retrieving an object's fields and get accessors for setting the stored values. c. You can create auto-implemented properties when you want a field's set accessor simply to assign a value to the appropriate field, and a field's get accessor simply to return the field value.

b. Properties contain set accessors for retrieving an object's fields and get accessors for setting the stored values.

Identify the false statement. a. The following is a valid and conventional C# constant declaration: const string FIRST_HEADING = "Progress Report"; b. The following is a valid and conventional C# constant declaration: const double COMMISSION_RATE; c. By default, enumeration values are integers.

b. The following is a valid and conventional C# constant declaration:

Two of the following statements are true, and one is false. Identify the false statement: a. The following methods are overloaded:private static void MethodA(int a)private static void MethodA(double b) b. The following methods are overloaded:private static void MethodC(int c)private static void MethodD(int c) c. The following methods are overloaded:private static void MethodE(int e)private static void MethodE(int e, int f)

b. The following methods are overloaded:private static void MethodC(int c)private static void MethodD(int c)

Two of the following statements are true, and one is false. Identify the false statement: a. A Label and a TextBox both have a Text property. b. When a user types a value on a Label in an executing program, it becomes the value for the Text property of the Label. c. You can display the value on a Label using a format string. Hide Feedback

b. When a user types a value on a Label in an executing program, it becomes the value for the Text property of the Label.

Two of the following statements are true, and one is false. Identify the false statement: a. Both reference and output parameters represent memory addresses that are passed to a method, allowing the method to alter the original variables. b. When you declare a reference parameter in a method header, the parameter must not have been assigned a value. c. When you use an output parameter, it need not contain an original, assigned value when the method is called, but it must receive a value before the method ends.

b. When you declare a reference parameter in a method header, the parameter must not have been assigned a value.

Two of the following statements are true, and one is false. Identify the false statement: a. You indicate that a method parameter can be an array element by placing a data type and identifier in the method's parameter list. b. You indicate that a method parameter must be an array by placing parentheses after the data type in the method's parameter list. c. Arrays are passed by reference; that is, the method receives the actual memory address of the array and has access to the actual values in the array elements.

b. You indicate that a method parameter must be an array by placing parentheses after the data type in the method's parameter list.

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

In C#, a method must include all of the following except a _________. a. return type b. access modifier c. body d. closing curly brace

b. access modifier

In the method call PrintTheData(double salary);, salary is the __________ parameter. a. formal b. actual c. proposed d. preferred

b. actual

Correctly overloaded methods must have the same ____. a. return type b. identifier c. parameter list d. All of the above.

b. identifier

Suppose you have declared a method named private static void CalculatePay(double rate). When a method calls the CalculatePay() method, the calling method _____. a. must contain a declared double named rate b. might contain a declared double named rate c. cannot contain a declared double named rate d. cannot contain any declared double variables

b. might contain a declared double named rate

What is a correct declaration for a method that receives two double arguments. calculates and displays the difference between them, and returns nothing? a. private static void CalcDifference(double price1, price2) b. private static void CalcDifference(double price1, double price2) c. Both of these are correct. d. None of these are correct.

b. private static void CalcDifference(double price1, double price2)

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

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

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()

If you want to create a method that other methods in other classes can access without limitations, you declare the method to be _____. a. unlimited b. public c. shared d. unrestricted

b. public

A comment in the form /* this is a comment */ is a(n)___. a. XML comment b. block comment c. executable comment d. line comment

block comment

Which of the following is a difference between a reference parameter and an output parameter? a. A reference parameter receives a memory address; an output parameter does not. b. A reference parameter occupies a unique memory address; an output parameter does not. c. A reference parameter must have an initial value; an output parameter need not. d. A reference parameter need not have an initial value; an output parameter must.

c. A reference parameter must have an initial value; an output parameter need not.

a. A constant value cannot be changed after a program is compiled, but a variable can be changed. b. A data type describes the format and size of a data item and the types of operations that can be performed with it. c. A variable declaration requires a data type, name, and assigned value

c. A variable declaration requires a data type, name, and assigned value

Two of the following statements are true, and one is false. Identify the false statement: a. A method is an encapsulated series of statements that carry out a task. b. Any class can contain an unlimited number of methods. c. All the methods that will be used by your programs have been written for you and stored in files.

c. All the methods that will be used by your programs have been written for you and stored in files.

Suppose the value of isRateOK() is true, and the value of isQuantityOK() is false. When you evaluate the expression isRateOK() && isQuantityOK(), which of the following is true? a. Only the method isRateOK() executes. b. Only the method isQuantityOK() executes. c. Both methods execute. d. Neither method executes.

c. Both methods execute.

What is a correct declaration for a method that receives two double arguments and sums them, but does not return anything? a. private static void CalcSum(double firstValue, double secondValue) b. private static void CalcSum(double price1, double price2) c. Both of these are correct. d. None of these are correct.

c. Both of these are correct.

Identify the false statement. a. The C# programming language was developed as an object-oriented and component-oriented language. b. C# contains several features that make it similar to other languages such as Java and Visual Basic. c. C# contains many advanced features, so the C++ programming language was created as a simpler version of the language.

c. C# contains many advanced features, so the C++ programming language was created as a simpler version of the language.

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 are legal.

c. ComputeBill(1001, 200.00);

Two of the following statements are true, and one is false. Identify the false statement: a. A method can return, at most, one value to a method that calls it. b. The data type used in a method's return statement must be the same as the return type declared in the method's header. c. If a method returns a value and you call the method, you must store the value in a variable that has the same data type as the method's parameter.

c. If a method returns a value and you call the method, you must store the value in a variable that has the same data type as the method's parameter.

Two of the following statements are true, and one is false. Identify the false statement: a. An advantage to using the IDE to create GUI programs is that many methods you need are generated automatically. b. As with any other methods, when you create a Click() method associated with a button in a GUI application, you do not need to reference the parameters within the method body. c. If you want a Click() method to add two variables, you must pass them in as parameters.

c. If you want a Click() method to add two variables, you must pass them in as parameters.

Two of the following statements are true, and one is false. Identify the false statement: a. In C#, a Main() method header can be written public static void Main(). b. In C#, a Main() method header can be written static void Main(string[] args). c. In C#, a Main() method header can be written static int main(string args).

c. In C#, a Main() method header can be written static int main(string args).

Identify the false statement. a. After you write and save a program, you must compile it into intermediate language and then the C# just in time (JIT) compiler must translate the intermediate code into executable code. b. You can compile and execute a C# program from the command line or within the Integrated Development Environment (IDE) that comes with Visual Studio. c. Many programmers prefer to compile their programs from the command line because it provides features such as color-coded keywords and automatic statement completion.

c. Many programmers prefer to compile their programs from the command line because it provides features such as color-coded keywords and automatic statement completion.

Two of the following statements are true, and one is false. Identify the false statement: a. A class header always contains the keyword class. b. When you create a class, you define both its attributes and its methods. c. Most fields and methods defined in a class are private.

c. Most fields and methods defined in a class are private.

Identify the false statement. a. A high-level programming language allows you to use a vocabulary of reasonable terms such as read, write, or add instead of the sequence of on/off switches that perform these tasks. b. Each high-level programming language has its own syntax. c. Programmers use a computer program called a compiler to translate machine code into a high-level language they can understand.

c. Programmers use a computer program called a compiler to translate machine code into a high-level language they can understand.

Two of the following statements are true, and one is false. Identify the false statement: a. When you call a method that has a mandatory parameter, you must send an argument. b. When you call a method that has an optional parameter, you do not have to send an argument, but you can. c. When you call a method with a mandatory value parameter, you must pass an argument, but if it is a variable, you do not have to have initialized it.

c. When you call a method with a mandatory value parameter, you must pass an argument, but if it is a variable, you do not have to have initialized it.

Two of the following statements are true, and one is false. Identify the false statement: a. The Visual Studio IDE allows you to use a visual environment for designing Forms. b. Some key features in Visual C# include the Toolbox, Form Designer, and Solution Explorer. c. When you create a first Windows Forms project in any folder, Visual C# names the project MyFirstForm by default.

c. When you create a first Windows Forms project in any folder, Visual C# names the project MyFirstForm by default.

Two of the following statements are true, and one is false. a. Good object-oriented techniques require that data should usually be hidden and access to it should be controlled by well-designed accessors. b. Although private fields, methods, and accessors are the norm, occasionally you need to create public versions of them. c. When you define a named constant within a class, it is always static; that is, the field belongs to the entire class, not to any particular instance of the class.

c. When you define a named constant within a class, it is always static; that is, the field belongs to the entire class, not to any particular instance of the class.

A program contains the method call PrintTheData(salary);. In the method definition, the name of the formal parameter must be __________. a. salary b. any legal identifier other than salary c. any legal identifier d. omitted

c. any legal identifier

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

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

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

1. In C#, an identifier _________________________ . a. must begin with an underscore b. can contain digits c. must be no more than 16 characters d. can contain only lowercase letters

can contain digits

Assume 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.

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.

Suppose 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.

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.

Every method declaration must contain _________. a. a statement of purpose b. declared accessibility c. the static modifier d. a return type

d. a return type

When you write the method declaration for a method that can receive a parameter, you need to include all of the following items except _________. a. a pair of parentheses b. the type of the parameter c. a local name for the parameter d. an initial value for the parameter

d. an initial value for the parameter

At most, a class can contain _________ method(s). a. 0 b. 1 c. 2 d. any number of

d. any number of

2. A program that translates high-level programs into intermediate or machine code is a(n) _______________________ . a. mangler b. compactor c. analyst d. compiler

d. compiler

If you use the keyword modifier static in a method header, you indicate that the method _________. a. cannot be copied b. can be called only once c. cannot require parameters d. is called without an object reference

d. is called without an object reference

A method is declared as private static double CalcPay(int hoursWorked). Suppose you write a Main() method in the same class that contains the declarations int hours = 35; and double pay;. Which of the following represents a correct way to call the CalcPay() method from the Main() method? a. hours = CalcPay(); b. hours = Main.CalcPay(); c. pay = CalcPay(hoursWorked); d. pay = CalcPay(hours);

d. pay = CalcPay(hours);

. The process of determining which overloaded version of a method to execute is overload _____ a. confusion b. infusion c. revolution d. resolution

d. resolution

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

7. The technique of packaging an object's attributes into a cohesive unit that can be used as an undivided entity is ______________ . a. inheritance b. encapsulation c. polymorphism d. interfacing

encapsulation


Ensembles d'études connexes

Ch. 18 Maintaining Server Installations

View Set

WATER CYCLE 4th Grade a. Plan and carry out investigations to observe the flow of energy in water as it changes states from solid (ice) to liquid (water) to gas (water vapor) and changes from gas to liquid to solid. Sources: Ed. Galaxy, HSP textbook, GPS

View Set

Human Growth and development (Part 14): Psychosexual Stages of Development (p.108)

View Set

Piano 1 - Unit one review worksheet

View Set

nursing 6 unit 5 Brunner Med surg (CH 33 - Patients With Nonmalignant Hematologic Disorders)

View Set

310 midtern, Legs 2, Module 1/2 Quiz, Module 3A Quiz, Module 3B/3C Quiz, Legal Exam Questions Modules 1-3

View Set