CIS 199 Final F2021

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

argument

A ___ is data in a method call. A. literal B. parameter C. argument D. variable

Which one of the following statements declares a variable named fox that references an instance of the Animal class?

Animal fox = new Animal();

city = "Vienna";

Assuming a string variable named city has already been declared, which one of the following statements assigns the string literal "Vienna" to the variable?

instance

Each object that is created from a class is called a ____ of the class. A. member B. reference copy C. instance D. field

False

In C# arrays, the first element is found at index position one (i.e. a [1]). True or False

double quotation marks

In C# code, ____________ are required to indicate the beginning and the end of a string literal.

Length property

In C#, all arrays have a _____________ that is set to the number of elements in the array. A. getSize property B. Element property C. Length property D. GetBounds method

toolbox

In Visual Studio, the ____________ shows a scrollable list of controls that you can add to a form.

default

In a switch statement, a case can be labeled as _____ to execute in the event that none of the other provided cases match the test expression (selector).

semicolon

Just as a period marks the end of a sentence, a ____________ marks the end of a programming statement in C#.

__ errors are not violations of the programming language rules. Instead, the code will execute but produces incorrect results.

Logical (or semantic)

new

Memory for an array is typically allocated by using keyword ___. A. new B.array C. mem D. foreach

scope

Programmers use the term ____________ to describe the part of a program in which a variable may be accessed.

true

T/F: You may not modify array elements traversed through a foreach loop.

!

The NOT operator is written as ____.

&&

The conditional AND operator is written as (____).

passed by value

When an argument is ________, only a copy of the argument's value is passed into the parameter variable. A. passed by reference B. passed by value C.named D. uninitialized

False

When you instantiate an array, you can choose its exact location in memory True or False

assignment compatible

When you pass an argument to a method, the argument's data type must be ____ with the receiving parameters data type. A. memory mapped B. user friendly C. data bound D. assignment compatible

decimal, float, double

Which data types may be used to store a floating point number? Choose all that apply.

logic

__________ errors are not violations of the programming language rules. Instead, the code will execute but produces incorrect results.

parameter

a ___ receives an argument's value when the method executes A. element B. parameter C. literal D. argument

'T' is an example of a(n)_____literal

char

A constructor that requires no arguments in order to be called is known as a(n) ___ constructor

parameterless

Each element in an array is assigned a unique number known as a(n) ________.

subscript

77

what will the value of the variable test be after the following sequence of statements complete execution? int x = 77; int test; test = x--; A. 76 B.0 C.77 D. 78

True

when a method is declared with the private access modifier, it can be called only by code inside the same class as the method. True or False

overloaded

when a method or constructor is ___, it means that multiple methods (or constructors) in the same class have the same name but use different parameter lists. A. aliased B. overloaded C. shadowed D. paramererized

How many iterations will the following loop complete? for(int i = 10; i <= 1; --1) WriteLine ("i = " + i);

0

How many iterations will the following loop complete? for (int i = 10; i >= 1; --i) Console.WriteLine("i = " + i);

10

What does the following C# expression evaluate to? 7 - 2 * 3 + 4

5

What does the following C# expression evaluate to? Enter the numeric value (number only) below. 12 - 5 * 2 + 6

8

How many iteration will the following loop complete? for (int i = 1; i < 10; ++i) WriteLine("i = " + i );

9

The equality operator in C# is ____.

==

count property

A List object has a(n) ________ that holds the number of items currently stored in the List.

return

A ___ statement causes a value to be sent back to the calling method it uses A. break B. result C. return D. continue

property

A ____ is a special type of class member, similar to a method, that allows an object to store and retrieve a piece of data. A. valuator B. Property C. constructor D. accessory

class

A ____________ is code that serves as a template or blueprint for a particular type of object.

True

A method can return, at most, one value to a method that calls it. True or False

client

A method that uses another is called a ____ of the method it uses A. peer B. server C. pair D. client

use uppercase letters for the entire identifier

A standard convention used by programmers for naming constants is to ____.

return

A value-returning method must have a _____ statement. A. assignment B. return C. void D. logical

return

A value-returning method must have a(n) ____________ statement.

double-click

Adding functionality to a Button is easy when you use the IDE. After you have dragged a Button onto a Form, you can ____ it to create an event-handling method that executes when the user clicks the Button.

integer

An array subscript can be an expression, as long as the expression evaluates to a ____. A.integer B.float C.double D. boolean

integer

An array subscript can be an expression, as long as the expression evaluates to a(n) ____.

True

At most, a method can directly return on value to the statement that calls it. True or False

low-level language

Because assembly language is so close in nature to machine language, it is referred to as a ____________.

private

By using the ___ access modifier, a class can hide its data code from code outside the class. A.private B.ref C.const D.public

definite repetition

Counter-controlled repetition is an example of:

definite repition

Counter-controlled repetition is an example of:

A member that is declared with private visibility in a base class can also be seen in the derived class

False

In C# arrats, the first element is found at index position one (i.e a[1])

False

The name of a class's constructor is the same as the name of the class with the addition of a leading underscore character, as in _ClassName

False

by default, all parameters are passed by reference

False

0

How many iterations will the following loop complete? for (int i = 10; i <= 1; --i) Console.WriteLine("i = " + i);

10

How many iterations will the following loop complete? for (int i = 10; i >= 1; --i) WriteLine(" i = " + i); A. 0 B. 9 C. 10 D. 11 E. infinite Loop

new

Memory for an array is typically allocated by using keyword _____.

All are correct

Of the following statements, which one correclty initalizes an int array named quarters with the values 1, 2, 3, and 4? A. const int SIZE= 4; int [] quarters = new int[SIZE] { 1, 2, 3, 4}; B. int[] quarters = new int [] {1, 2, 3, 4}; C. int[] quarters = { 1, 2, 3, 4}; D. All are correct

True

Once an array object's size has been allocated, that array object's size may not be changed. True or False

iteration

One execution of any loop is called a ____. A. lap B. iteration C. path D. round

top-down design

Programmers commonly use a technique known as ____________ to break down a complex task into subtasks that are implemented using methods.

A____is a special type of class member, similar to a method, that allows an object to store and retrieve a piece of data.

Property

indefinite repetion

Sentinel-controlled repetition is an example of: A. indefinite repetition B. double repetition C. definite repetition D. infinite repetition

false

T/F: A logic error is a mistake that prevents the program from compiling.

true

T/F: A partially-filled array is normally used with an accompanying integer variable that holds the number of items that are actually stored in the array.

false

T/F: In C# arrays, the first element is found at index position one (i.e. a[1]).

true

T/F: In software, an object has two general capabilities: it can store data (attributes) and perform operations (tasks or behaviors).

true

T/F: Once an array object's size has been allocated, that array object's size may not be changed.

true

T/F: RAM is usually a volatile type of memory that is used only for temporary storage while a program is running.

true

T/F: When a variable is declared in the initialization expression of a for loop, the scope of the variable is limited to the loop itself.

false

T/F: When an array is passed to a method through a parameter, it is always passed by reference.

true

T/F: When arrays of primitive numeric types (such as int and double) are allocated, C# automatically initializes each element to zero.

true

T/F: When if-else statements are nested, each else always is paired with the most recent previous unpaired if unless curly braces force a different pairing.

false

T/F: When the keyword void appears in the method header, it means that the method will return a value.

false

T/F: When using a switch statement, the test expression (governing expression) may be a variable or expression that gives an integer, string, or floating point value.

false

T/F: When you divide an integer by an integer in C#, the result is always given as a floating point result.

true

T/F: You can combine as many AND and OR operators in an expression as you need.

true

T/F: You can concatenate two strings with the plus (+) sign.

When producing formatted output, the format specifier "D" is used to convert the number to a string that represents a currency amount, such as $100.00 in the United States.

T/F: false

While a Panel does not have a border displayed by default, it may be enabled.

T/F: true

Which property of a Window's form controls the message displayed in the form's title bar?

Text

get accessor

The ____ is the component that returns the property's value. A. this reference B. set accessor C. Show method D. get accessor

public

The ____ modifier allows unlimited access to a method A. public B. protected C. private D. protected internal

items

The collection of values stored in a ListBox control is accessed through the __________ property. For example, to add a new value to the ListBox named myLB, you'd write: myLB.__________.Add(value);

||

The conditional OR operator is written as (____).

after

The do-while repetition statement tests the condition ___ the body of the loop executes. A. before B. after C. while D. none of the above

after

The do-while repetition statement tests the condition _____ the body of the loop executes.

short-circuit

The expressions in each part of an AND expression are evaluated only as much as necessary to determine whether the entire expression is true or false. This feature is called ____ evaluation.

break

The keyword ____ usually terminates a switch structure at the end of each case.

True

The name of a class's constructor is the same as the name of the class True or false

backing field

The private instance variable, which is know as the property's ______, holds ant data that is assigned using a property. A. shadow variable B. backing field C. hidden value D. data core

A member that is declared with protected visibility in a base class can also bee seen in the derived class

True

A radio button is typically used with other radio buttons to provide a set of mutually exclusive options from which, at most, one may be chosen at a time

True

A string literal that begins with a $ indicates that string interpolation is being used

True

C# respects the case of identifiers, so variable name test123 is different from Test123 and TEST123.

True

You may not modify array elements traversed using a foreach loop

True

every time the program is run

Using the code fragment below, when does Excellent get displayed? if (score >= 90) grade = 'A'; MessageBox.Show("Excellent");

Animal fox = new Animal():

WHich of the following statements declares a variable named fox that references an instance of the Animal class? A. new Animal(fox); B.Animal fox(new); C.Animal fox = new Animal(); D.new Animal fox();

double

What data type is the numeric literal 25.8 stored as?

25

What will the value of the variable test be after the following sequence of statements complete execution? Enter the numeric value (number only) below. int x = 25; int test; test = x++;

1

What will the value of the variable z be after the following sequence of statements complete execution? Enter the numeric value (number only) below. int x = 5; int y = 4; int z; z = x/y;

inner

When loops are nested, each pair contains a(n) ____ loop and an outer loop.

True

When writing a method, you have to specify the data type for every parameter variable that is declared in the parameter list. True or False

void method

When you call a ____, it simply executes the statements it contains and then terminates. A. terminal method B. private method C. void method D. value-returning method

value-returning method

When you call a ____________, it executes the statements that it contains and then it returns a value back to the statement that called it.

True

You may not modify array elements traversed using a foreach loop. True or False

True

a partially-filled array is normally used with an accompanying integer variable that holds the number of items that are actually stored in the array. True or False

get accessor

a read-only property will only include a ___. A. this reference B. set accessor C. Show method D. get accessor

set accessor

any time a value is assigned to a property, the property's ____ is executed, and the value being assigned is passed into the value parameter. A. get accessor B. Show method C. this reference D. set accessor

The private instance variable, which is know as the property's____, typically holds any data that is assigned using the property.

backing field

The private instance variable, which is known as the property's ____________, holds any data that is assigned using a property.

backing field

When you want to make sure a specific constructor from the base class is used, the derived class constructor must explicitly call the base class constructor using the ___ in a constructor clause

base keyword

Which one of the following is a class header indicating that we are defining a class named Amphibian, and it is dervied from the Animal base class.

class Amphibian : Animal

Which of the statements below are functional equivalent to the given statement --count; a. count -= 1 ; b. count -= 1; c. count = count - 1; d. count --;

count -= 1; count = count -1; count --;

When a ________ is provided for a parameter, it becomes possible to call the method without explicitly passing an argument into the parameter.

default argument

If you write a class with no constructor whatsoever, the compiler provides a(n) ____________.

default constructor

In a switch statement, a case can be labeled as __to execute in the event that none of the other provided cases match the test expression

default:

A class that inherits from a base class is a ____

derived class

When you know you want to perform some task at least one time, the ____ loop is the best choice.

do-while

Using the code fragment below, when does Excellent get displayed? if (score > 89) grade = 'A'; WriteLine ("Excellent");

everytime the program is run

A(n) ____ involves placing the desired result type in parentheses followed by the variable or constant to be cast

explicit cast

An abstract class can be instantiated like any other class, directly objects of that type

false

Creating an instance of a Form's class also displays the form on the screen.

false

In the responsibility-driven design approach described in the text, all of the verbs that appear in the problem description should become classes.

false

When naming classes in C# the tradition is to use camel case, just like variables are named

false

When the keyword void appears in the method header, it means that the method will return a value.

false

With a ___ loop, you can indicate the starting value for the loop control variable, the test condition that controls loop entry, and the expression that alters the loop control variable, all in one convenient place.

for

________ is a process that periodically runs, removing all unreferenced objects from memory.

garbage colelction

A read-only property will only include a __________.

get accessor

A read-only property will only include a public ___.

get accessor

The ____________ is the component that returns the property's value.

get accessor

Sentinel-controlled repetition is an example of :

indefinite repetition

In object-oriented programming, ____is used to create an "is a" relationship among classes.

inheritance

Each object that is created from a class is called a(n) ____________ of the class.

instance

What data type is the numeric literal 25 stored as?

int

What data types is the numeric literal 25 stored as?

int

Error

int[,] values = { { 1, 2, 3, 4 } , { 5, 6, 7, 8 } }; What is the value stored in values[2, 2]? A. 3 B. 6 C. 7 D. Error

One execution of any loop is called a(n) ____.

iteration

In C#, all arrays have a(n) ________ that is set to the number of elements in the array

length property

Memory for an array is typically allocated by using keyword____.

new

Every class you create C# ultimately derives from a single class named___

object

When you create an instance of a class, you create a(n)___.

object

A(n)___ works like a reference (ref) parmeter, but the argument does not have to be set to a value before it is passed into the parameter.

output (out) parameter

A(n) ________ works like a reference parameter, but the argument does not have to be set to a value before it is passed into the parameter.

output parameter

When a method is ____________, it means that multiple methods in the same class have the same name but use different parameter lists.

overloaded

When you want a method to be able to change the value of a variable that is passed to its as an argument, the variable must be ___

passed by reference

A(n) ____ loop is one in which the loop control variable/expression is tested after the loop body executes.

posttest

value

predefined types such as int, double, and char are ____ types. A. output B. pointer C. reference D. value

A while loop is a(n) __ loop

pretest

By using the ____________ access modifier, a class can hide its data from code outside the class.

private

Instance variables(field) and methods declared with the __ modifier are only accessible within that class definition

private

A ____________ is a special type of class member, similar to a method, that allows an object to store and retrieve a piece of data.

property

Any time a value is assigned to a property, the property's ____________ is executed, and the value being assigned is passed into the value parameter.

set accessor

string

the fact that the ReadLine() method call can be assigned to a string means that its return type is ____. A.int B.Char C.bool D.String

When if-else statements are nested, each else always is paired with the most recent previous unpaired if unless curly braces force a different pairing.

trueT/F:

The first character of a control's name can be a(n):

underscore

Look a the following code sample: int[,] values = {{1, 2, 3, 4 }, {5, 6, 7, 8 }}; What is the value stored in value [2, 2]

unknown because it produces an error

in property's set accessor, the implicit parameter automatically created by the complier is named___.

value

Which one of the following statements assigns the value 40 to the first element in an int array named values?

values[0] = 40;

inner

when loops are nested, each pair contains a ___ loop and an outer loop. A. posttest B. pretest C. inner D. for

True

when writing a method, you have to specify the data type for every parameter variable that is declared in a parameter list True or False

Which of the following statements declared a variable named fox that references an instance of the Animal class? Animal = new Animal(); new Animal(fox); Animal fox(new); new Animal fox();

Animal fox = new Animal();

How many iterations will the following loop complete? for (int i = 0; i <= 10; ++i) Console.WriteLine("i = " + i);

11

How many iterations will the following loop complete? for (int i = 10; i >= 1; ++) WriteLine("i = " +i);

11

Look at the following code sample: const int ROWS = 2; const int COLS = 2; int[,] grid = new int[ROWS, COLS]; What is the total number of elements in the grid array?

4

What will the value of the variable test be after the following sequence of statements complete execution? int x = 41; int test; test = ++x;

42

constructor

A ____ is a special type of class member, similar to a method, that is automatically executed when an object is created. A. actuator B. constructor C. loader D. creator

jagged array

A ____ is similar to a rectangular two-dimensional array, but each row can have a different number of columns. A. offset array B. skewed array C. jagged array D. differential array

local

A variable is ___ to a method when it is declared within that method. a. local b. related c. global d. attached

True

A variable that refers to an object like an array actually stores the address of the object's location in memory True or False

pretest

A while loop is a ____ loop. A. posttest B. intest C. pretest D. fortest

pretest

A while loop is a(n) ____ loop.

jagged array

A(n) ________ is similar to a two-dimensional array, but the rows can have a different number of columns.

local

A(n) ____________ variable belongs to the method in which it is declared, and only statements inside that method can access the variable.

Any time a value is assigned to a property, the property's ____is executed, and the value being assigned is passed into the value parameter

set accessor

Programmers commonly use a technique known as ___ to break down a complex task into subtasks that are often implemented as methods

top-down design

The name of a class's constructor is the same as the name of the class.

true

When a method is declared with the private access modifier, it can be called only by code inside the same class as the method.

true

You have to write the data type for each parameter variable that is declared in a parameter list.

true

The names of the variable in the header of a method's definition (not its call) are known as arguments

False

Variables declared in the body of a particular method are know as instance variables or fields and can be used in all methods of the class.

False

When an array is passed to a method through a parameter, it is always passed by reference. this means that a method may always cause the argument to point a different array that was sent to the method.

False

0

How many iterations will the following loop complete? for (int i = 10; i<=1; --i) WriteLine(" i = " +i); A.0 B.9 C.10 D.11 E. infinite loop

True

If you do not provide an accessibility modifier for a method, it is private by default. True or False

static

If you use the keyword modifier ____, you indicate that a method can be called without referring to an object. A. static B. internal C. protected D. nonstatic

if-else

If you want to perform one action when a Boolean expression evaluates as true and an alternate action when it evaluates as false, you can use a(n) ____ statement.

default constructer

If you write a class with no constructor whatsoever, the compiler provides a ____. A. null reference B. void constructor C. error message D. default constructor

false

T/F: A switch statement may use a floating point expression as the test expression (governing expression).

false

T/F: Addition and subtraction always take place prior to multiplication, division, or remainder in an expression.

false

T/F: C# code is organized as namespaces, which are contained inside classes, which are contained inside methods.

true

T/F: C# is case sensitive, so the following identifiers would all refer to different variables: num2 , Num2 , NUM2.

false

T/F: The assignment operator assigns the value that appears on its left side to the item that appears on its right side.

true

T/F: When a method is declared with the private access modifier, it can be called only by code inside the same class as the method.

Equality comparisons (using the equality operator) with floating-point types can sometimes produce unpredictable results because of the way these types are represented in memory, especially after numeric calculations have been performed.

T/F: true

Equality comparisons with floating-point types can sometimes produce unpredictable results because of the way these types are represented in memory, especially after numeric calculations have been performed

True

If you don't write any constructor for a class, C# will provide one by default

True

Once an array object's size has been allocated, that array object's size may not be changed.

True

Preconditions and postconditions for a method should describe what the method does without telling how the method works.

True

When arrays of primitive numeric types (such as int and double) are allocated, C# automatically Memement to zero.

True

When if-else statements are nested, each else always is paired with the most unpaired if (unless curly braces force another pairing)

True

When you choose to use an auto-implemented property class, the compiler is responsible for creating the associated backing field, so the programmer doesn't have to

True

You can end a void method with the following statement that indicates nothing is returned: return;

True

9

What does the following C# expression evaluate to? Enter the numeric value (number only) below. 10 - 2 * 3 + 5

True

When a method is declared with the private access modifier, it can only be called by code inside the same class as the method. True or False

text

When a user types information into a TextBox in an executing program, it becomes the value for the ____ property of the TextBox.

True

When a variable is declared on the initialization expression of a for loop, the scope of the variable is limited to the loop itself. True or False

false

When an array is passed to a method through a parameter, it is always passed by reference. This means that a method may always cause the argument to point to a different array than was sent to the method. True or False

True

When arrays of primitive numeric types (such as int and double) are allocated, C# automatically initializes each element to zero. True or False

False

When the keyword void appears in the method header, it means that the method will return a value. True or False

value-returning method

When you call a ___, it executes the statements that it contains and then it returns a value back to the statement that called it. A. public method B. value-returning method C. recursive method D. void method

void method

When you call a ____________, it simply executes the statements it contains and then terminates.

do-while

When you know you want to perform some task at least one time, the ____ loop is the best choice. A. while B. do-while C. foreach D. for

assignment compatible

When you pass an argument to a method, the argument's data type must be ____________ with the receiving parameter's data type.

*, /, %

Which of the following binary arithmetic operators have the highest precedence (execute first). Choose all that apply.

1stPlayerStartBtn

Which one of the following Button control names is not a legal C# identifier?

double bonus = 24.95m;

Which one of the following assignment statements, for variables of the double data type, will cause an error?

balance == 0

Which one of the following expressions determines if the value of the balance variable is equal to zero?

text

Which property of a Window's Form controls the message displayed in the form's title bar?

for

With a ___ loop, you can indicate the starting value for the loop control variable, the test condition that controls loop entry, and the expression that alters the loop control variable, all in one convenient place. A. do B. do-while C. while D. for

arrayName.Length - 1

You can easily navigate through arrays using a for or while loop that varies a subscript from 0 up to (and including) ___. A. arrayName.Length - 2 B. arrayName.Length - 1 C. arrayName.Length D. arratName.Length + 1

arrayName.Length - 1

You can easily navigate through arrays using a for or while loop that varies a subscript from 0 up to (and including) ____.

True

You can end a void method with the following statement that indicates nothing is returned: return; True or false

cast operator

You can use a __________ to explicitly convert a value from one numeric data type to another, even if the conversion might result in a loss of data.

OR

You can use the conditional ____ operator when you want some action to occur even if only one of two conditions (or both) is true.

AND

You can use the conditional ____ operator within a Boolean expression to determine whether two expressions are both true.

const

You create a named constant similarly to the way you create a named variable, but by using the keyword ____.

main memory

____________ is where the computer stores a program while the program is running, as well as the data that the program is working with.

hardware

____________ refers to all the physical devices, or components, of which a computer is made.

Unicode

_____________ is an extensive encoding scheme that is compatible with ASCII and can also represent the characters of many of the world's languages.

The do-while repetition statement tests the condition__ the body of the loop executes

after

A(n) ____________ is a special type of class member, similar to a method, that is automatically executed when an object is created.

constructor

A(n)____ is a special type of a class member, similar to a method, that is automatically executed when an object is created.

constructor

Counter-controlled repetition is an example of :

definite repitition

With a ____ loop, you can indicate the starting value for the loop control variable, the test condition that controls loop entry, and the expression that alters the loop control variable, all in one convenient place.

for

When you create an additional method definition with the same method name as the original but with a different parameter list, it is know as method____.

overloading

When you replace a base class method definition with one in the derived class using the same method name and parameter list as the original but new method body, it is known as a

overriding

With inheritance, the original class that is used to derive a new one is called the ___. parent class base class superclass subclass super class dervied class

parent class base class super class

When you want a method to be able to change the value of a variable that is passed to it as an argument, the variable must be ________.

passed by reference

When an argument is ________, only a copy of the argument's value is passed into the parameter variable.

passed by value


Ensembles d'études connexes

BUS171 Chapter 2: Analyzing the Business Case

View Set

Chapter 2: Principles of Physical Fitness

View Set

ISYS 316 Advanced Java Programming Chapter 30 Multi-threading and Parallel Programming

View Set

Chapter 1: Foundations of Structural Kinesiology

View Set

PSYC 2013, FINAL EXAM, Chen, Auburn

View Set

APUSH - Period 4, 75 College Board Questions

View Set

Science 908 lifepac test study guide

View Set