Midterm Flashcards

1
Q

Computers process data under the control sequences of instructions called ______________.

A

computer programs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A computer consists of various devices referred to as ______________, such as the keyboard, screen, mouse, hard disks, memory, DVD drives, and processing units.

A

hardware

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Data items processed by computers form a(n) ___________ that becomes larger and more complex in structure as we progress from the simplest data items (called “bits”) to richer data items, such as characters, fields, and so on.

A

data hierarchy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Computers can directly understand only their _________ language, which is composed of only 1s and 0s.

A

machine

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The three types of computer programming languages discussed in this chapter are machine languages, ______________, and ____________.

A

assembly languages, high-level languages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Programs that translate high-level language programs into machine language are called ____________.

A

compilers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A(n) _____________ processor implements several processors on a single “microchip” – a dual-core processor has two CPUs and quad-core processor has four CPUs.

A

multi-core

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Objects, or more precisely the __________ that objects come from, are essentially reusable software components.

A

classes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

You send messages to an object. Each message is implemented as a method that tells a method of an object to perform its task.

A

call

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A new class of objects can be created quickly and conveniently by ___________; the new class absorbs the characteristics of an existing class, possibly customizing them and adding unique characteristics of their own.

A

inheritance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

To create the best solutions, you should follow a detailed analysis process for determining your project’s __________ (i.e., defining what the system is supposed to do) and developing a design that satisfies them (i.e., deciding how the system should do it).

A

requirements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Visual C# is __________ driven. You’ll write programs that respond to mouse clicks, keystrokes, timer expirations and –new in Visual C# 2012– touches and finger swipes.

A

event

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Microsoft’s Visual C# is a(n) __________ programming language – in addition to writing program statements to build portions of your apps, you’ll also use Visual Studio’s graphical user interface (GUI) to conveniently drag and drop predefined objects like buttons and textboxes into place on your screen, and label and resize them.

A

visual

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

C++ provides several features that “spruce up” the C language, but more important, it provides capabilities for __________-oriented programming.

A

object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

A key goal of Java is to be able to write programs that will urn on a great variety of computer systems and computer-control devices. This is sometimes called _______________.

A

write once, run anywhere

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The _______________ executes .NET programs.

A

Common Language Runtime (CLR) of the .NET Framework

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

The CLR provides various services to ___________ code, such as integrating software components written in different .NET languages, error handling between such components, enhanced security and more.

A

managed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

The ability of a program to run without modification across multiple platforms is known as platform _______________.

A

independence

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Visual Studio is a(n) _________ in which C# programs are developed.

A

IDE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

The new Windows 8 look-and-feel features a Start screen with _________ that represent each app, is similar to that of the Windows Phone – a Microsoft operating systems for smartphones.

A

tiles

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Windows 8 apps feature a(n) _____________ window; there’s no longer a border around the window with the typical interface elements such as title bars and menus.

A

chromeless

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

You can sell your own Windows Phone apps in the ___________.

A

Windows Phone Marketplace

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

You can test your phone apps on the Windows Phone ____________ that Microsoft provides with the Windows Phone SDK (software developer kit).

A

Emulator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

T or F: Software objects model both abstract and real-world things.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

T or F: The most popular database model is the RELATIONAL DATABASE in which data is stored in simple TABLES. A table includes RECORDS and FIELDS.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

T or F: A database is a collection of data that’s organized for easy access an manipulation.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

T or F: Secondary storage data takes much longer to access than data in primary memory, but the cost per unit of secondary storage is much higher than that of primary memory.

A

False: The cost per unit of secondary storage is much lower than that or primary memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

T or F: High-Level languages allow you to write instructions that look almost like everyday English and contain commonly used mathematical expressions.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

T or F: An object has attributes that it carries along as it’s used in a program

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

T or F: The Transmission Control Protocol (TCP) ensures that messages, consisting of sequentially numbered pieces called bytes, were properly routed from sender to receiver, arrived intact and were assembled in the correct order.

A

False: Packets – not bytes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

T or F: The information-carrying capacity of communications lines on the Internet has increased tremendously, while hardware costs have increased.

A

False: Hardware costs have decreased.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

T or F: You can build web-based applications with C# and Microsoft’s ASP.NET technology.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

T or F: JAVA has become the key programming language for the Mac OS X desktop operating system and all iOS-based devices, such as iPods, iPhones, and iPads.

A

False: The language is Objective-C, not JAVA

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

T or F: Microsoft’s ASP.WEB technology is used to create web apps.

A

False: It’s ASP.NET technology

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

T or F: Microsoft’s Windows operating system is the most widely used desktop operating system worldwide.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

T or F: Windows 8 is designed for resource-constrained devices that have less memory and processor power than desktop computers, and limited battery life.

A

False: Windows Phone 8 is designed for resource-constrained devices.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

T or F: Visual C# 2012 also can be used to develop Windows Phone 8 apps. Visual C# 2012 is sure to become even more popular as the demand for Windows Phones increases.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

Arrange these byte measurements in order from smallest to largest: terabyte, megabyte, petabyte, gigabyte, and kilobyte.

A

kilobyte, megabyte, gigabyte, terabyte, petabyte

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

Describe the two-step translation process for preparing you C# code to execute on your particular computer.

A

C# code is first compiled into MSIL and placed in an executable file. When the app executes, another compiler called the JIT (just-in-time) compiler in the CLR translates the MSIL in the executable file into machine-language code (for a particular platform)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

Why might Windows terminate a suspended app?

A

To free up memory for executing other apps.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

A(n) __________ begins the body of every method and a(n) ________ ends the body of every method.

A

left brace ({), right brace (})

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

Most statements end with a(n) _____________.

A

semicolon (;)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

The ____________ statement is used to make decisions.

A

if

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

___________ begins a single-line comment.

A

//

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

____________, ____________, and _____________ are called whitespace characters. Newline characters are also considered whitespace characters.

A

Blank lines, spaces characters, tab characters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

_______________ are reserved for use by C#.

A

Keywords

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

C# apps begin execution at method _____________.

A

Main

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

Methods ______________ and _____________ display information in the console window.

A

Console.WriteLine and Console.Write

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

T or F: Comments cause the to display the text after the // on the screen when the app executes.

A

False: Comments do not cause any action to be performed with the app executes. They’re used to document apps and improve their readability.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

T or F: C# considers the variable number and NuMbEr to be identical.

A

False: C# is case sensitive, so these variables are distinct.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

T or F: The remainder operator (%) can only be used with integer operands.

A

False: The remainder operator also can be used with noninteger operands in C#.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

T or F: The arithmetic operators *,/,%,+, and - all have the same level of precedence.

A

False: The operators *,/, and % are the same level of precedence, and the operators + and - are on a lower level of precedence.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q

Declare variables c, thisIsAVariable, q76354, and number to be of type int.

A

int c, thisIsAVariable, q76354, number;

OR

int c;
int thisIsAVariable;
int q76354;
int number;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q

Prompt the user to enter an integer.

A

Console.Write(“Enter an integer: “);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q

Input an integer and assign the result to int variable value.

A

int value = Convert.ToInt32(Console.ReadLine());

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
Q

If the variable number is not equal to 7, display “The variable number is not equal to 7”.

A

if (number != 7)

Console.WriteLine(“The variable number is not equal to 7”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
57
Q

Display “This is a C# app” on one line in the console window.

A

Console.WriteLine(“This is a C# app”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
58
Q

Display “This is a C# app” on two lines in the console window. The first line should end with C#. Use method Console.WriteLine.

A

Console.WriteLine(“This is a C#\napp”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
59
Q

Display “This is a C# app” on two lines in the console window. The first line should end with C#. Use method Console.WriteLine and two format items.

A

Console.WrtieLine(“{0}\n{1}, “This is a C#”, “app”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
60
Q

FIND THE ERROR:

if (c > 7);
Console.WriteLine(“c is less than 7”);

A

ERROR: Semicolon after the right parenthesis of the condition(c < 7) in the if statement.
CORRECTION: Remove the semicolon after the right parenthesis. [NOTE: With the semicolon, the output statement executes regardless of whether the condition in the if is true.]

61
Q

FIND THE ERROR:

if (c => 7)
Console.WriteLine(“c is equal to or greater than 7:);

A

ERROR: The relational operator => is incorrect.
CORRECTION: Change => to >=.

62
Q

State that an app will calculate the product of three integers.

A

//Calculating the product of three integers.

63
Q

Declare the variables x, y, z and result to be of type int.

A

int x, y, z, and result;

OR

int x;
int y;
int z;
int result;

64
Q

Prompt the user to enter the first integer.

A

Console.WriteLine(“Enter first integer: “);

65
Q

Read the first integer from the user and store it to variable x.

A

x = Convert.ToInt32(“Console.ReadLine());

66
Q

Prompt the user to enter the second integer.

A

Console.WriteLine(“Enter second integer: “);

67
Q

Read the second integer from the user and store it to variable y.

A

y = Convert.ToInt32(Console.ReadLine());

68
Q

Prompt the user to enter the third integer.

A

Console.WriteLine(“Enter third integer: );

69
Q

Read the third integer from the user and store it to variable z.

A

z = Convert.ToInt32(Console.ReadLine());

70
Q

Compute the product of the three integers contained in variables x, y, and z, and assign the result to the variable result.

A

result = x y z;

71
Q

Display the message “Product is”, followed by the value of the variable result.

A

Console.WriteLine(“Product is {0}”, result);

72
Q

A house is to a blueprint as a(n) ___________ is to a class.

73
Q

Every class declaration contains keyword __________ followed immediately by the class’s name.

74
Q

Operator _________ creates an object of the class specified to the right of the keyword.

75
Q

Each parameter must specify both a(n) __________ and a(n) _________.

A

type, name

76
Q

By default, classes that are not explicitly declared in a namespace are implicitly placed in the ___________.

A

global namespace

77
Q

When each object of a class maintains its own copy of an attribute , the field that represents the attribute is known as __________.

A

instance variable

78
Q

C# provides three simple types for storing real numbers – _____________, ______________, and ____________.

A

float, double, decimal

79
Q

Variables of type double represent ______________.

A

double-precision

80
Q

Convert method ____________ returns a decimal value.

81
Q

Keyword public is a(n) ____________.

A

access modifier

82
Q

Return type __________ indicates that a method will not return any information when it completes its task.

83
Q

Console method ___________ reads characters until a neline character is encountered, the returns those characters (not including the newline) as a string.

84
Q

A(n) ____________ is not required if you always refer to a class with its fully qualified class name.

A

using directive

85
Q

Variables of type float represent ___________ floating-point numbers.

A

single-precision

86
Q

The format specifier _________ is used to display values in a monetary format.

87
Q

Types are either _________ types or ________ types.

A

value, reference

88
Q

For a(n) __________, the compiler automatically generates a private instance variable and set and get accessors.

A

auto-implemented property

89
Q

T or F: By convention, method names begin with a lowercase first letter and all subsequent words in the name begin with a capital first letter

A

False: By convention, method names begin with an uppercase first letter and all subsequent words in the name begin with an uppercase first letter.

90
Q

T or F: A property’s get accessor enables a client to modify the value of the instance variable associated with the property.

A

False: A property’s get accessor enables a client to retrieve the value of the instance variable associated with the property. A property’s set accessor enables a client to modify the value of the instance variable associated with the property.

91
Q

T or F: A using directive is not required when one class in a namespace uses another in the same namespace.

92
Q

T or F: Empty parenthesis following a method name in a method declaration indicate that the method does not require any parameter to perform its task.

93
Q

T or F: After defining a property, you can use it the same way you use a method, but with empty parentheses, because no arguments are passed to a property.

A

False: After defining a property, you can use it the same way you use a variable.

94
Q

T or F: Variables or methods declared with access modifier private are accessible only to members of the class in which they’re declared.

95
Q

T or F: Variables declared in the body of a particular method are known as instance variables and can be used in all methods of the class.

A

False: Such variables are called local variables and can be used only in the method in which they’re declared.

96
Q

T or F: A property declaration must contain both a get accessor and a set accessor.

A

False: A property declaration can contain a get accessor, a set accessor or both.

97
Q

T or F: The body of any method or property is delimited by left and right braces.

98
Q

T or F: Local variables are initialized by default.

A

False: Instance variables are initialized by default.

99
Q

T or F: Reference-type instance variables are initialozed by default to the value null.

100
Q

T or F: Any class that contains public static void Main(string[ ] args) can be used to execute an app.

101
Q

T or F: The number of arguments in the method call must match the number of required parameters in the method declaration’s parameter list.

102
Q

T or F: Real number values that appear in source code are known as floating-point literals and are of type float by default.

A

False: Such literals are of type double by default.

103
Q

What is the difference between a local variable and an instance variable.

A

Local variable: declared in the body of a method and can be used only in the method in which it’s declared.

Instance variable: declared in a class, but not in the body of any of the class’s members. Every object (instance) of a class has a separate copy of the class’s instance variables. They are accessible to all members of the class.

104
Q

Explain the purpose of a method parameter. What is the difference between a parameter and an argument.

A

A parameter represents additional information that a method requires to perform its task. Each parameter required by a method is specified in the method’s declaration. An argument is the actual value that’s passed to a method parameter when a method is called.

105
Q

All apps can be written in terms of three types of control structures: ________________________, ____________________________, and ________________________.

A

sequence, selection, repetition

106
Q

The ______________________ statement is used to execute once action when a condition is true and another when the condition is false.

A

if….else

107
Q

Repeating a set of instructions a specific number of times is called ____________________ repetition.

A

counter-controlled (or definite)

108
Q

When it’s not known in advance how many times a set of statements will be repeated, a(n) ________________ value can be used to terminate the repetition.

A

sentinel, signal, flag, or dummy

109
Q

The _________________ structure is built into C#–by default, statements execute in the order they appear.

110
Q

Instance variables of type int are given the value __________ by default.

111
Q

C# is a(n) _______________ language- it requires all variables to have a type.

A

strongly typed

112
Q

If the increment operator is _____________________ to a variable, the variable is incremented by 1 and its new value is used in the expression.

113
Q

T or F: An algorithm is a procedure for solving a problem in terms of the actions to execute and the order in which these actions execute.

114
Q

T or F: A set of statements contained within a pair of parenthesis is called a block.

A

False: A set of statements contained within a pair of braces ({ and }) is called a block.

115
Q

T or F: A selection statement specifies that an action is to be repeated while some condition remains true.

A

False: A repetition statement specifies that an action is to be repeated while some condition remains true. A selection statement determines whether an action is performed based on the truth of falsity of a condition.

116
Q

T or F: A nested control statement appears in the body of another control statement.

117
Q

T or F: C# provides the arithmetic compound assignment operators +=, -=, *=, /= and %= for abbreviating assignment expressions.

118
Q

T or F: Specifying the order in which statements (actions) execute in an app is called program control.

119
Q

T or F: The unary cast operator (double) creates a temporary integer copy of its operand.

A

False: The unary cast operator (double) creates a temporary floating-point copy of its operand.

120
Q

T or F: Instance variables of type bool are given the value true by default.

A

False: Instance variables of type bool are given the value false by default.

121
Q

T or F: Pseudocode helps you think out an app before attempting to write it in a programming language.

122
Q

Write four different C# statements that each add 1 to int variable x.

A

x = x + 1;
x += 1;
++x;
x++;

123
Q

Assign the sum of x and y to z, and increment x by 1 with ++. Use only one statement and ensure that the original value of x is used in the statement.

A

z = x++ y;

124
Q

Test whether variable count is greater than 10. If it is, display “Count is greater than 10”.

A

if (count > 10)

Console.WriteLine(“Count is greater than 10”);

125
Q

Decrement the variable x by 1, then subtract it from the variable total. Use only one statement.

A

total -= –x;

126
Q

Calculate the remainder after q is divided by divisor, and assign the result to q. Write this statement in two different ways.

A

q %= divisor;

q = q % divisor;

127
Q

Declare variable sum to be of type int.

128
Q

Declare variable x to be of type int.

129
Q

Assign 1 to variable x.

130
Q

Assign 0 to variable sum.

131
Q

Add variable x to variable sum, and assign the result to variable sum.

A

sum += x;
or
sum = sum + x;

132
Q

Display “The sum is: “ followed by the value of the variable sum.

A

Console.WriteLine(“The sum is: {0}”, sum);

133
Q

Identify and correct the errors:

while (c <= 5)
{
product *= c;
++c;

A

ERROR: The closing right brace of the while statement’s body is missing.

CORRECTION: Add a closing right brace after the statement ++c;

134
Q

Identify and correct the errors:

if (gender == 1)
Console.WriteLine(“Woman”);
else;
Console.WriteLine(“Man”);

A

ERROR: The semicolon after else results in a logic error. The second output statement will always execute.

CORRECTION: Remove the semicolon after else.

135
Q

What is wrong with the following while statement?

while (z >= 0 )
sum += z;

A

The value of the variable z is never changed in the while statement. Therefore, an infinite loop occurs if the loop-continuation condition (z >= 0) is initially true. To prevent an infinite loop, z must be decremented so that it eventually becomes less than 0.

136
Q

Typically, __________________ statements are used for counter-controlled repetition and _______________________ statements are used for sentinel-controlled repetition.

A

for, while

137
Q

The do…while statement tests the loop-continuation condition ____________________ executing the loop’s body; therefore, the body always executes at least once.

138
Q

The _____________ statement selects among multiple actions based on the possible values of an integer variable or expression.

139
Q

The ______________ statement, when executed in a repetition statement, skips the remaining statements in the loop body and proceeds with the next iteration of the loop.

140
Q

The ____________ operator can be used to ensure that two conditions are both true before choosing a certain path of execution.

A

&& (conditional AND) or & (boolean logical AND)

141
Q

If the loop-continuation condition in a for header is initially _________________, the for statement’s body does not execute.

142
Q

Methods that perform common tasks and cannot be called on objects are called _____________ methods.

143
Q

T or F: The default label is required in the switch selection statement.

A

False: The default label is optional. If no default action is needed, then there’s no need for a default label

144
Q

T or F: The break statement is required in ever case of a switch statement.

A

False: You could terminate the case with other statements, such as a return.

145
Q

T or F: The expression ((x > y) && (a < b)) is true if either (x > y) is true OR ( a < b) is true.

A

False: Both of the relational expressions must be true for this entire expression to be true when using the && operator.

146
Q

T or F: An expression containing the || operator is true if either or both of its operands are true.

147
Q

T or F: The integer after the comma (,) in a format item (e.g {0, 4}) indicates the field width of the displayed string.

148
Q

T or F: To test for a range of values in a switch statement, use a hyphen (-) between the start and end values of the range in a case label.

A

False: The switch statement does not provide a mechanism for testing ranges of values, so you must list every value too test in a separate case label.

149
Q

T or F: Listing cases consecutively with no statements between them enables the cases to perform the same set of statements.