ISYS 3393 test 1

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

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

. machine language

1. Assume that you have a variable declared as int varl = 3;. What is the value of 22 % var1? a. 21 b. 7 c. 1 d. 0

1

1. What is the value of the expression 4 + 2 * 3? a. 0 b. 10 c. 18 d. 36

10

1. Assume that you have declared a variable as double hourly = 13.00;. What will the statement WriteLine(hourly); display? a. 13 b. 13.0 c. 13.00 d. 13.000000

13

1. Assume that you have a variable declared as int var1 = 3;. If var2 = var1++, what is the value of var2? a. 2 b. 3 c. 4 d. 5

3

1. Assume that you have a variable declared as int var1 = 3;. If var2 = ++var1, what is the value of var2? a. 2 b. 3 c. 4 d. 5

4

1. Assume that you have a variable declared as int var1 = 3;. What is the value of 22 / var1? a. 21 b. 7.333 c. 7 d. 1

7

1. Which of the following is not a C# comparison operator? a. => b. != c. == d. <

=>

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

Console

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

Form

In the IDE, the area where you visually construct a Form is the___________. a. Toolbox b. Palette c. Easel d. Form Designer

Form Designer

When you create a new Windows Forms project, by default the first Form you see is named a. Form b. Form1 c. FormA d. FormAlpha

Form1

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

Main()

Which of the following is the legal Form Name property? a. Payroll Form b. PayrollForm c. either of the above d. none of the above

PayrollForm

Which of the following is not a Form property? a. Backcolor b. ProjectName c. Size d. Text

ProjectName

Which of the following does not appear in the IDE's Toolbox list? a. Text b. Button c. Label d. TextBox

Text

_________are controls through which a user can enter input data in a GUI application. a. Labels b. Tags c. Tickets d. TextBoxes

TextBoxes

1. Which of the following is true of variable declarations? a. Two variables of different types can be declared in the same statement. b. Two variables of the same type can be declared in the same statement. c. Two variables of the same type must be declared in the same statement. d. Two variables of the same type cannot coexist in a program.

Two variables of the same type can be declared in the same statement.

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");

1. Assume that you have a variable declared as int var1 = 3;. Which of the following would display X 3X? a. WriteLine("X{0}X", var1); b. WriteLine("X{0,2}X", varl); c. WriteLine("X{2,0}X", varl); d. WriteLine("X{0}{2}", varl);

WriteLine("X{0,2}X", varl);

1. Assume that you have two variables declared as int var1 = 3; and int var2 = 8;. Which of the following would display 838? a. WriteLine("{0}{1}{2}", var1, var2); b. WriteLine("{0}{1}{0}", var2, var1); c. WriteLine("{0}{1}{2}", var2, var1); d. WriteLine("{0}{1}{0}", var1, var2);

WriteLine("{0}{1}{0}", var2, var1);

1. Assume that you have declared a variable as double salary = 45000.00;. Which of the following will display $45,000? a. WriteLine(salary.ToString("c")); b. WriteLine(salary.ToString("c0")); c. WriteLine(salary); d. two of these

WriteLine(salary.ToString("c0"));

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

a

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

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

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

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

1. Which of the following declares a variable that can hold the word computer? a. string device = 'computer'; b. string device = "computer"; c. char device = 'computer';

string device = "computer";

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

1. What is the value of the expression 6 >= 7? a. 0 b. 1 c. true d. false

false

The button_Click() method is generated by the IDE_____ a. has a private access specifier b. is nonstatic c. contains parameters between its parentheses d. all of above

has a private access specifier

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

In the Visual Studio IDE main window, where does the main menu lie? a. vertically along the left border b. vertically along the right border c. horizontally across the top of the window d. horizontally across the bottom of the window

horizontally across the top of the window

1. Which of the following C# types cannot contain floating-point numbers? a. float b. double c. decimal d. int

int

1. When you use a number such as 45 in a C# program, the number is a ______________. a. figurative constant b. literal constant c. literal variable d. figurative variable

literal constant

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

literal string

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

Which of the following is a legal Form Text property? a. Payroll Form b. PayrollForm c. either of the above d. none of the above

none of the above

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

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

salaryTextBox

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

source code

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

Most methods in a class are created with the _________ modifier. a. public b. protected c. new d. private

a

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

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

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

1. Unicode is_____________________. a. an object-oriented language b. a subset of the C# language c. a 16-bit coding scheme d. another term for hexadecimal

a 16-bit coding scheme

The value in a TextBox is_____ a. an int b. a double c. a string d. It might be any of the above

a string

1. When you perform arithmetic operations with operands of different types, such as adding an int and a float____________________ . a. C# chooses a unifying type for the result b. you must choose a unifying type for the result c. you must provide a cast d. you receive an error message

a. C# chooses a unifying type for the result

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

The Form class has________properties. a. three b. ten c. about 100 d. about 1000

about 100

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

adding the method to the Discard window

Statements allowed in a Click() method include_______ a. variable declarations b. arithmetic statements c. both of the above d. none of the above

arithmetic statements

1. A variable declaration must contain all of the following except a(n) ______________. a. data type b. identifier c. assigned value d. ending semicolon

assigned value

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

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

b

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

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

b

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

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

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

b

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

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

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

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

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

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

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

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

An object is a(n) _________ of a class. a. child b. institution c. instantiation d. relative

c

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

1. A variable that can hold the two values true and false is of type ______________. a. char b. it c. bool d. double

bool

. 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

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

c

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

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

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

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

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

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

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

c

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

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

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

c

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

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

After you have dragged a Button onto 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. execute a method when a user clicks the Button

create a method that executes when a user clicks the Button

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

d

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 collection of methods that can be used by any class, as long as the class provides a definition to override the collection's do-nothing, or abstract, definitions is _____ a. a superclass b. a polymorph c. a perimeter d. an interface

d

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

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

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

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

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

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

d

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

d

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

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

Most fields in a class are created with the _________ modifier. a. public b. protected c. new d. private

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

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

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

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

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

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

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

A(n)_____ is generated when a user interacts with a GUI object. a. event b. occasion c. method d. error

event

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

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

debugging

Of the following,the most significant difference between many console applications and GUI application is_____ a. their appearance b. their ability to accept input c. their ability to perform calculations d. their ability to be created using C#

their ability to be created using C#

1. Which of the following compares two string variables named string1 and string2 to determine if their contents are equal? a. stringl = string2 b. stringl == string2 c. Equals.String(string1, string2) d. two of the above

tringl == string2

If you create a Button named yesButton, the name of the method that respond to clicks on it is_____ a. button1_Click() b. yesButton_Method() c. click_YesButton() d. yesButton_Click()

yesButton_Click()


Kaugnay na mga set ng pag-aaral

Chapter 24 (actually chapter 17)

View Set

Montagu/ Rowlatt Acts/ Amritsar/Gov of India Act 1919

View Set

Prep U Adults 2 Exam 1 (Ch 13, 32, 33, 34, 35, 53, 54, 55, 56, 57, 58, 59)

View Set

Chapter 18: Health Problems of Adolescent (TEST 2)

View Set

EHAP FRENCH REVOLUTION TEST 1/26

View Set

BUS 2030 Chapters 1-4 & 6 Test Outline

View Set

FON CHP 15 Elimination & Gastric Intubation

View Set

02.00 Carousel of Progress Pre-Test

View Set

Upper Extremity Shoulder/Humerus/Clavicle Fractures and Soft Tissue Injuries

View Set

Medical Terminology Obstetrics and Neonatology, Chapter 15, Medical Terminology Chapter 10 Nervous System, Medical Terminology Chapter 9, Digestive system & eye, Ear and Musculoskeletal System, Medical terminology, nursing final

View Set