CS 220 1-4 comprehensive
Extension for C# source file.
.cs
The binary equivalent of 24 is ____.
00011000
False
A machine that has a 64-bit processor can process 64 characters at one time.
False
A method body provides information about how other methods can interact with it. True/False?
0
A default constructor has how many parameters?
a specific condition remains true
A while statement allows you to specify that an action should repeat while:
return statement
A(n) ____ causes a value to be sent from a called method back to the calling method.
method
A(n) ____ is a program module that contains a series of statements that carry out a task.
Raw facts; the basic numbers and characters that are manipulated to produce useful information.
Data
When should test plans be developed?
During the analysis and design phases
"{0:C}"
In order to format the first argument in the WriteLine method so that it prints the value 5343.67 as $5,343.67 with a comma and a dollar symbol, you would insert the following format string as the argument to the WriteLine( ) ____.
you must use the keyword override in the heading
In order to provide a new definition for the ToString() method, ____.
Plays a very important role in C#; this is the "entry point" for all applications; where the program begins execution; can be placed anywhere inside the class definition; when a C# program is launched, the execution starts with the first executable statement found in this method and continues to the end of that method; should begin with an uppercase.
Main ( ) method
Allows multiple characters to be entered; it accepts characters until the Enter key is pressed; used to input data values.
ReadLine( )
2 - Design a solution methods: -Object-Oriented approach -Procedural "divide & conquer" (or top-down design) approach can be used with either method.
Step 2 in the Software Development Process
3 - Code the Solution After completing the design and verified that the algorithm is correct, the design is translated into source code. (In our case, this will be C#.)
Step 3 of Program Development Process
1 - Analyze the problem 2 - Design a solution 3 - Code the solution 4 - Implement the code 5 - Test and debug
Steps in the Program Development Process
False
Structured English is an abbreviated, action-oriented version of the English language. One of its syntax rules is that every statement must end with a semicolon.
3
Suppose that s1, s2, and s3 are three strings, given as follows: String s1 = "Tallahassee, FL"; String s2 = "Atlanta, GA"; String s3 = "Birmingham, AL"; What is the results of the following expressions? s2.substring(3).lastIndexOf('a'))
False
Suppose that s1, s2, and s3 are three strings, given as follows: String s1 = "Welcome to Java"; String s2 = "Programming is fun"; String s3 = "Welcome to Java"; What is the results of the following expressions? s2.startsWith("Wel")
17
Suppose the following strings are declared as follows: String city = "Tallahassee"; String state = "Florida"; What is the results of the following expressions? city.concat(state).lastIndexOf('a')
A clear, unambiguous, step-by-step process for solving a problem; these steps are expressed completely and precisely so that all details are included.
Algorithm
B. objects
An instance of a class is called a(n) __________. A. instantiation B. objects C. template D. type
False
An int variable would be the most appropriate type for a memory location that will be used to store the monthly membership dues for the computer club.
False
The decimal equivalent for 3.42e-5 in scientific notation is .00342.
includes the heading and the body
The definition of the method
widening
A(n) ________ conversion occurs when a type is converted to a type that can hold more data.
must be defined to have a void return type
A method that does not return any value on exit
data field, method
A property resembles a(n) ____, but is more closely aligned to a(n) ____.
parentheses
A quick way to identify a method is by looking for ____.
Normally data members are defined to have ____ access.
private
During the design phase, it is important to develop a(n) ____________ illustrating what the desired final output should be.
prototype
The compiler checks for ____.
syntax rule violations
b. _ (underscore)
The special character that can be used with an indentifier is ______. a. - b. _ c. * d. #
Console.WriteLine("Good day!");
Which of the following would display "Good day!" on the screen?
D. answer -=100;
Which statement subtracts 100 from the original value of an answer? A. 100 -= answer; B. answer = 100 -; C. answer =- 100; D. answer -= 100;
True
You can identify a class that is an application because it contains a public static void main() method. True/False?
A class is normally associated with a(n) ____, which often describes a person, place, or thing and is normally a noun.
entity
A program environment, such as Visual Studio .Net, in which you type your source code statements, debug, compile, and run your applications. IDE's include a number of useful development tools: IntelliSense (pop-up windows with completion options), color coding of different program sections, and online help and documentation.
Integrated Development Environment (IDE)
negative integers
Invalid possibilities for array indices include ________.
Common Language Runtime; the Common Language Runtime (CLR), the virtual machine component of Microsoft's .NET framework, manages the execution of .NET programs; a process known as just-in-time compilation converts compiled code into machine instructions which the computer's CPU then executes; similar to Java's JVM.
CLR
False
Casting is a form of implicit type coercion
Brain of computer; housed inside the system unit on a silicon chip; most important hardware element.
Central Processing Unit (CPU)
Converts programming language instructions into machine-readable format (machine language); looks at entire pieces of code; before translating code, it checks for rule violations; only converts when all syntax errors are removed; generates a file that ends with .exe; generates MSIL or IL.
Compiler
One class predefined as part of .NET is ____.
Console
False
Console applications require a Main() method, unlike Windows applications that do not require a Main() method.
Enables programmers to write to and read from the console window or keyboard; defined within the System namespace.
Console class (System.Console)
class, method
Console is a ____ and WriteLine( ) is a ____.
a method call
Console.WriteLine("Final Grade = {0:N2}", CalculateGrade(90, 75, 83)); In the statement above, CalculateGrade(90, 75, 83) is ____.
Value = 12,346
Console.WriteLine("Value = {0:N0}", 12345.9032); What will be displayed from the above line?
A data item defined and initialized to keep the same value throughout the life of the program.
Constant
True
Constants are normally named using all uppercase characters, separating second and subsequent words with the underscore character.
-If you write one constructor, you lose the default one that is created automatically. -Constructors are used to provide initial values to the object's data members. -To add full functionality to your classes, write multiple constructors
Constructors
use the same identifier as the class
Constructors differ from other methods in that constructors ____.
public
Constructors should be defined with a ____ access modifier.
True
Declaring a class's instance variables with access modifier private indicates that only the class's methods should have access to those instance variables.
Includes the heading and the body of the method, which are enclosed in curly braces.
Definition
analysis
During which phase of software development should questions be asked to clarify the problem definition?
all of the above.
In order to test a class, ____.
True
In structured programming, the only two ways to combine control statements are stacking and nesting.
True
In the case of an infinite while loop, the while expression (that is, the loop condition) is always true.
private
Normally data members are defined to have ____ access.
True
One required entry for a method heading is the return type.
the reference itself from being modified
Passing a reference type by value is done to protect:
the program may compile and produce results with a run-time error
Run-time errors are more difficult to find than syntax errors because ____.
False
Software consists of programs, which are sets of instructions telling you how to use the computer.
The most important and frequently used namespace; contains classes that define commonly used types or classes; includes using directive; must be included in the references for a project created using Visual Studio; when a console application is created, Visual Studio automatically references and imports this.
System namespace
False
The output of the Java code, assuming that all variables are properly declared, is 32. num = 10; while (num <= 32) num = num + 5; System.out.println(num);
True
The output of the following Java code is: Stoor. int count = 5; System.out.print("Sto"); do { System.out.print('o'); count--; } while (count >= 5); System.out.println('r'); True/False?
True
The output of the following Java code is: Stoor. int count = 5; System.out.print("Sto"); do { System.out.print('o'); count--; } while (count >= 5); System.out.println('r');
False
The params modifier can be used anywhere in the method's header.
Which of the following is true regarding methods of a class?
They are called instance methods.
write more than 1 constructor
To add full functionality to your classes
class's
To call a static method, use the ________ name followed by a period, and the method with its arguments.
0
What is the output of the following Java code? int num = 15; while (num > 0) num = num - 3; System.out.println(num);
A markup language that provides a format for describing data using tags similar to HTML tags.
XML (Extensible Markup Language)
Next line (similar to pressing enter key)
\n
Which of the following is a valid compile-time initialization for amountDue, a floating point variable of the double type, that will initially be set to zero?
amountDue = 0;
Which of the following is a valid compile-time initialization for amountDue, a variable of the decimal type, that will initially be set to zero?
amountDue = 0m;
Console is a ____ and WriteLine( ) is a ____.
class, method
What object-oriented feature enables you to define subclasses that share some of the characteristics of other classes?
inheritance
48
int [ ] anArray = new int [10]; int [ ] anotherArray = {6, 7, 4, 5, 6, 2, 3, 5, 9, 1}; foreach (int val in anotherArray) total += val; Using the above declaration along with the foreach loop, what is stored in total after the program statements are executed?
In order to test a class, ____.
invoke instance methods using the objects you construct.
When you assign a default value to a parameter, it then becomes a(n) ____________ parameter.
optional
The compiler is responsible for ____.
translating high-level programming language into machine-readable form
False
A method call is the same as a method declaration.
False
A standard convention used by programmers for naming classes is to use an action verb phrase.
beta
A(n) ____ version of software has not been fully tested and may still contain bugs or errors.
True
An appropriate identifier used to store the total transaction amount is totalTransactionAmount.
False
An array must be declared and allocated in the same statement.
billion
A computer that has 8 GB of RAM can store approximately eight ____ characters.
D. billion
A computer that has 8 GB of RAM can store approximately eight ________ characters. A. million B. trillion C. gillion D. billion
True
A selection statement chooses among alternative courses of action.
False
A standard convention used by C# programmers is to use Pascal case style for class, data member identifiers, and method identifiers.
C. use uppercase letters for the identifier
A standard convention used by programmers for naming constants is to _________. A. use camel case B. begin the first character with a lower case characters and use upper case for the rest of the identifier C. use uppercase letters for the identifier D. use Pascal case
True
Three of the contextual keywords associated with properties are get, set, and value.
True
To declare an array, the value(s) used inside the square bracket can be a constant literal, a variable, or an expression that produces an integral value.
set
To define a property to change a data member of a class include a ____ clause.
objects
To program an object-oriented solution begin by determining what ____ are needed in the solution.
False
To protect the reference of an array, it should be passed to methods with keyword val.
True
To write a recursive solution, a base case needs to be identified.
If berber is an object, the statement Console.Write(berber); automatically invokes the ____________ method.
ToString( )
True
ToString( ), Equals( ), GetType( ), and GetHashCode( ) are all methods of the object class.
A design methodology that divides a problem into a number of subproblems; each subproblem is then further subdivided into smaller units until the method is manageable.
Top-Down Approach (Step-Wise Refinement) or "Divide & Conquer"
c. true
A variable of type bool can store ______. a. "true" b. TRUE c. true d. All of the above
constructor
A(n) ____ method is a method that creates and initializes class objects.
local
A(n) ____ variable is known only within the boundaries of the method.
False
An error will be produced when moreData is assigned the boolean variable shown above because the keyword true should be enclosed in double quotation marks.
True
UML represents instance variables and properties as attributes by listing the attribute name followed by a colon and the attribute type.
False
Unary operators (such as ++) cannot be used in conditions.
The character set used by programmers of C#; uses 16 bits to represent a character; thus 2^16 or 65,536 unique characters can be represented.
Unicode
During which phase of software development should questions be asked to clarify the problem definition?
Analysis
False
Unicode includes representation of 2^8 or 256 unique characters.
False
Use a type prefix, such as C for class name. For example, a student class should be named CStudent.
class
Using the object-oriented approach, a(n) ____ is a combined set of attributes and actions.
Convert the Assembly programming language, which is a low-level programming language, into machine code; not easy to read or write low-level languages
Assemblers
private access
Assigning ____ to a field means that no other classes can access the field's values.
double product(double n1, double n2)
Assume you have a method with the following method header: int product(int n1, int n2) Which of the following methods overloads the method above?
False
At the beginning of a program, comments are often written to identify how many pages are included in the program listing.
False
By convention, the first set of brackets of a two-dimensional array identifies an element's column and the second identifies the row.
Made up of 8 bits; represents one keystroke.
Byte
True
C# allows you to mix numeric integral types and floating-point types in an expression.
Program statements written using a programming language, such as C# or Java.
Source Code
System.out.printf("Here is the first character of the middle name: %10c", middleName.charAt(0));
What is the code that will display the middle initial 'L' (right justified) with a total of 10 spaces, given the following declaration? String middleName = "Lanette";
params
What is the keyword associated with variable-length argument lists?
0
What is the result of the following program? (public class FindMax image)
one-dimensional arrays
What kinds of arrays can variable-length argument lists work with?
multiline
Comments that use two forward slashes are called ____.
Directs flow of info like a traffic cop; responsible for determining the next instruction; fetches and decodes the instructions and controls the overall operation of the other components of the CPU.
Control Unit (CU)
Backslash ( '\' ).
Escape Character
Backslash included with a character, such as: \n to represent the next line \t for a tab indention
Escape Sequence
a. amountDue = 0;
Which of the following is a valid compile-time initialization amountDue, a floating point variable of the double type, that will initially be set to zero? a. amountDue = 0; b. amountDue = '0'; c. amountDue = 0m; d. amountDue = 0f;
C. amountDue = 0m;
Which of the following is a valid compile-time initialization for amoundDue, a variable of the decimal type, that will initially be set to zero? A. amountDue = 0; B. amountDue = '0'; C. amountDue = 0m; D. amountDue = 0d;
D. constant
Following standard conventions used by many programmers, the identifier REBATE would be defined as a(n) ________. A. class B. object C. namespace D. constant
False
For an array that is dimensioned with a Length of 100, valid subscripts are 0 through 100.
Made up of more than 2000 classes; all classes available for use by any of the .NET-supported languages; most of it written in C#; includes a number of different namespaces, such as System.
Framework Class Library (FCL)
DisplayContents(anArray)
Given an array declaration of int anArray[1000], which of the following would be a valid call to a DisplayContents( ) method to send the full array into the method as an argument?
1.6
Given the following declarations, what is stored in ans as a result of the arithmetic expression? int ans = 0, v1 = 5, v2 = 8; ans = v2 % v1++;
false
Good programmers often build test plans while they are in the implementation stage.
The Base 16 numbering system which powers of 16 and the symbols 0-9 and A-F.
Hexadecimal Numbering System
False
Hexadecimal uses the symbols 1, 2, 3, 4, 5, 6, 7 8, 9, A, B, C, D, E, F ,G.
False
Hexadecimal uses the symbols 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, G.
The names of elements that appear in a program, such as the names of data items, variables, objects, classes, or methods. Some identifiers are predefined; others are user defined.
Identifiers
A. char letterGrade
If you expect to receive an "A" in this course, which of the following declarations would be most appropriate for storing the grade? A. char letterGrade; B. string grade; C. int letterGrade; D. double letterGrade;
c. finalGrade
Which of the following is a valid identifier? a. score#1 b. amount owed by student c. finalGrade d. 4thExam
Logic
If you write a program and, instead of multiplying two values together as intended, you divide one value by the other, you produce a(n) ____ error.
IntelliSense
In Visual Studio .NET, the feature that attempts to sense what you are going to type before you type it is called ____.
True
In order to call a static method form another class, the class name muse be used with the method name.
True
In order to call a static method from another class, the class name must be used with the method name.
False
In order to do a compile-time initialization of a decimal type, it is necessary to add a d or D onto the end of the value
Indicated by two forward slashes // and is usually considered a one-line comment; Enter ends the comment.
Inline Comment
nonstatic methods.
Instance methods are
directly accessing private data members
Instance methods manipulate data by ____.
Unlike compilers, it checks for rule violations line by line; normally slower than compilers; some languages offer both, such as: C, BASIC, Python, Lisp.
Interpreters
Container providing context and scope for information created to hold a logical grouping of unique identifiers or symbols; used to group types of similar functionality; The Systems.Windows.Forms namespace is used as an umbrella to organize classes needed to create Windows applications.
Namespace
Code that can be read by a computer.
Native Code (Machine Language)
Type of system software that oversees and coordinates resources on the machine. Ex) Windows, Linux, MAC OS Includes communication programs for connecting to the Internet or connecting to output devices, such as printers. Includes user interface subsystems.
Operating Systems
True
Parentheses in a method declaration contain parameters that are funneled into the method. True/False?
c. amountDue = 0m;
Which of the following is a valid-compile time initialization for amountDue, a variable of the decimal type, that will initially be set to zero? a. amountDue = 0; b. amountDue = '0'; c. amountDue = 0m; d. amountDue = 0f;
textbook index
Which of the following is not an algorithm?
1 - Analyze the problem Understand the problem thoroughly; review problem specifications, which is the desired output of the program (what is to be displayed, saved or printed) Review program inputs, such as: -What kind of data will be inputted and by whom? -What type of values (whole #'s, alphabetic, etc.)? -What is the domain ( range of values) for each item? -Are any of the items of data set constant?
Step 1 of the Development Process
Welcome to JavaProgramming is fun
Suppose that s1, s2, and s3 are three strings, given as follows: String s1 = "Welcome to Java"; String s2 = "Programming is fun"; String s3 = "Welcome to Java"; What is the results of the following expressions? s1.concat(s2)
Operating systems and also: setting up directories; moving, copying, and deleting files; transferring data from secondary storage to primary memory; formatting media; and displaying data on screens.
System Software
Concatenation
System.out.println("Your name is " + yourName); The above statement is an example of ______, which is used to join Strings.
True
The decimal value type is appropriate for storing monetary data items because it provides for greater precision.
True
The default constructor normally has an empty body.
class diagram
The diagram used in object-oriented development to show the characteristics and behaviors of a class is a(n) ____.
False
The entries found inside the parentheses of the method heading are called the access modifiers.
the heading of the method
The first line of a method is called
c
Which of the following is not necessarily an error (either a syntax error or a logic error)? a.) Neglecting to include an action in the body of a while statement that will eventually cause the condition to become false. b.) Spelling a key word (such as while or if) with a capitalized first letter. c.) Using a condition for a while statement that is initially false. d.) An infinite loop.
None of these
Which of the following is not part of recursion?
.
Which of the following is the member access operator?
The body of the loop may not execute at all.
Which of the following is true about a while loop?
float, double, decimal
Which of the following list correctly orders which type has fewest to the most significant digits?
/
Which of the following operators associates from left to right?
Console.WriteLine("Live\nLife to the \tfullest");
Which of the following statements would produce the output shown here?
B. decimal tuitionCost = 10000.00m;
Which of the following would be the best declaration and compile-time initialization for an identifier to store the cost of tuition this year, if the value is $10,000? A. decimal tuitionCost = $10,000.00; B. decimal tuitionCost = 10000.00m; C. decimal tuitionCost = 10,000.00; D. decimal tuitionCost = "$10,000.00";
c. amountOfRain
Which of the following would be the most appropriate identifier for a memory location that will store the amount of rainfall for a given period of time? a. time b. amount of rain c. amountOfRain d. amountofrainforsomeperiodoftime
Scope is the portion of a program that can refer to an entity by its simple name
Which of these statements best defines scope?
answer -= 100;
Which statement subtracts 100 from the original value of an answer?
d. answer -= 100;
Which statement subtracts 100 from the original value of an answer? a. 100 -= answer; b. answer = 100-; c. answer =- 100; d. answer -= 100;
Following standard conventions used by many programmers, the identifier REBATE would be defined as a(n) ____.
constant
Run-time errors are more difficult to find than syntax errors because ____
the program may compile and produce results with a run-time error
If you write a program and, instead of multiplying two values together as intended, you divide one value by the other, you produce a(n) ____ error.
logic
As with overloaded methods, ____________ must differ for constructors.
signatures
All Main( ) method headings must include the ____________ modifier meaning that the method belongs to the type itself rather than to a specific object of a class.
static
d. 3
Given the following declarations, what is stored in ans as a result of the arithmetic expressions? a. 1.3333 b. 1.6 c. 2 d. 3
Ok\ "I'm sure"
Given the following output statement, what would be displayed? Console.Write("Ok\\ \"I\'m sure\"");
False
If aNumber is declared to be of type int with a value of 50, Console.out.WriteLine(aNumber++), displays 51.
15 ow
If the String variable str contains the string "Now is the time", what is the result of the following expression? String str = "Now is the time"; System.out.println(str.length() + " " + str.substring(1,3));
False
In an array of reference types, each element may be a reference to a different type.
new
In order to allocate memory for an object, you use the ____ operator.
C. add the keyword const to a declaration.
In order to place a value in memory that cannot be changed, you would ____. A. declare the variable and do a compile-time initialization. B. add the keyword unchangeable to the declaration. C. add the keyword const to a declaration. D. not be able to use C#.
a different class is needed, invoke instance methods using the objects you construct, use the properties to assign and retrieve values.
In order to test a class...
True
In the case of an infinite while loop, the while expression (that is, the loop condition) is always true. True/False?
Consists of fetching a program instruction from memory, decoding the instruction, executing, and then storing the result in memory.
Instruction Cycle
A feature of the Integrated Development Environment (IDE) that attempts to sense what you are going to type before you type it; when the IntelliSense window pops up, you can quickly select from the pull-down menu without having to complete the typing.
IntelliSense
For longer comments, A forward slash followed by an asterisk /* marks the beginning, and the opposite pattern */ marks the end; everything that appears between the comment symbols is treated as a comment; also called block comments.
Multiline Comments
1
public int mystery(int x, int y) { if (x >= y) return x - y; else return x + y; } Based on the code above, what would be the output of the following statement? System.out.println(mystery(8,7));
True
Several third-party vendors are also marketing .NET-compliant languages.
The name of the method, modifiers, and the types of its formal parameters; differs from the method heading in that the heading also includes the return type for the method and identifiers for the data type.
Signature
An error in a program due to a code that does not conform to order expected by the programming language; misplaced or missing semicolon, period, parentheses, or quotes as well.
Syntax Error
true
System software includes software such as the operating system.
D. includes the heading and the body
The definition of the method __________. A. is the same as the heading for the method. B. is the body of the method C. includes everything between the curly braces D. includes the heading and the body
False
The definition of the method includes the entry inside the curly braces, which is sometimes called the body of the method.
False
The name of the method, modifiers, return type, and the types of its formal parameters make up the signature of the method.
True
Types are actually implemented through classes in C#.
are only visible inside Main( )
Variables declared in the Main() method are ____.
False
int [ ] anArray = new int[24]; For the above declaration, 25 cells are set aside for the array since the first element is referenced by index 0.
The set of rules that a language such as C# has to follow are called ____ rules.
syntax
A valid string literal representing the last month of the year is ____.
"December"
In order to format the first argument in the WriteLine method so that it prints the value 5343.67 as $5,343.67 with a comma and a dollar symbol, you would insert the following format string as the argument to the WriteLine( ) ____.
"{0:C}"
The result of the following expression is ____. double ans, v1 = 45.7, v2 = 10.5; int v3 = 5; ans = (int) v1 + v2 / (double) v3;
47.1
True
C# is considered native code.
state-controlled loop
A flag-controlled loop is also called a ____.
masks
A locally declared variable always ____ another variable with the same name elsewhere in the class.
b. "December"
A valid string literal representing the last month of the year is _____. a. 12 b. "December" c. lastMonthOfTheYear d. December
comes into scope
A variable comes into existence, or ____, when you declare it.
A term denoting the encapsulation of data and behaviors into a single package or unit; class is the template from which many objects are instantiated; like a blueprint for a house and a single house built from that being an instance.
Class
After the class diagram is created, add the names of data members or fields and methods using the_________________ section.
Class Details
False
Class diagrams show the data, method, and property members of a class.
false
Classes and class diagrams are used most often with the structured procedural approach to software development.
true
Decide whether the following statement is true or false: Very analogous to method overloading constructors can be overloaded, too.
Base-10 numbering system; uses 10 symbols ranging from 0 to 9 to represent a value.
Decimal System
The use of simple data to verify programming algorithms by mimicking or walking through each step the computer will take to solve the algorithm.
Desk Check
False
IDEs include a number of useful development tools such as Sensitive Windows, pop-up windows with completion options.
false
In C#, it is tradition to name the file containing the class the same name as the class name, except the file name will have a .c# extension affixed to the end of the name.
Collection of one or more statements combined to perform an action; how behaviors are implemented in C#; similar to functions found in other languages (such as C++); they communicate with each other by sending arguments inside parentheses or as return values; sometimes no argument is sent, as is the case when nothing appears inside the parentheses.
Method
A mock-up of screens depicting the look of the final output of a program.
Prototype
False
Pseudocode must be written in an editor capable of understanding it and the language to which it pertains.
Software Development Kit; a software development kit (SDK or "devkit") is typically a set of software development tools that allows the creation of applications for a certain software package, software framework, hardware platform, computer system, video game console, operating system, or similar development platform.
SDK
The meaning of a programming instruction statement rather than the rules for how it should be written; a specific way in which each instruction statement should be used.
Semantic Meaning
False
Semicolons are placed at the end of method headings.
Set of rules of the programming language.
Syntax
All of these
The parameter list in the method header and the arguments in the method call must agree in:
Controls that are treated as objects, complete with data, behaviors, and properties; the Web server has access to these controls; also referred to as Web controls, or ASP server controls; part of the ASP.NET technology; using Web Forms, programmable Web pages can be built that serve as a UI for Web applications.
Web Forms (Server Controls)
Creates a double array containing 14 elements
What do the following statements do? double[] array; array = new double[ 14 ];
namespaces, classes, methods
What does the Framework Class Library hold?
Both arrays reference the same memory location
What happens when you assign one array to another using the assignment operator?
-34.0
What is Math.floor(-33.6)?
If a class contains multiple methods with the same name
What is method overloading
method_name(ref String[] array)
What is the method header for passing in the variable that holds a reference to an array of Strings?
0
What is the output of the following Java code? int num = 15; while (num > 0) num = num - 3; System.out.println("num");
5
What is the output of the following code? int count; int num = 2; for (count = 1; count < 2; count++) { num = num + 3; System.out.print(num + " "); } System.out.println();
5
What is the output of the following code? int count; int num = 2; for (count = 1; count < 2; count++) { num = num + 3; System.out.print(num + " "); } System.out.println();
-
What is the private visibility symbol in the UML class diagram?
inheritance
What object-oriented feature enables you to define subclasses that share some of the characteristics of other classes?
goes out of scope
When a variable ceases to exist at the end of a method, programmers say the variable ____.
After the solution has been coded
When should test plans be developed?
True
When you overload a Java method, you write multiple methods with a shared name. True/False?
False
When you pass an array to a method, by default, a copy of each element in the array is made and passed to the method.
False
When you write your own constructors, you cannot write versions that receive parameters. True/False?
\
Which character is called the escape character in C#?
loopCount = 1; while (loopCount < 3); { System.out.println("Hello"); }
Which is an infinite loop?
ReadLine()
Which method of the Console class allows multiple characters to be input via the keyboard?
Floor( )
Which method returns the largest whole number less than or equal to the specified number?
multiple methods within a class that share the same name
Which of the following best describes method overloading
Book[13]
Which of the following correctly accesses element 13 of array Book?
Math.Sqrt(36);
Which of the following correctly calls the Math class method Sqrt with a value of 36?
a += 3
Which of the following correctly represents the expression a = a + 3?
d. All of the above
Which of the following formats the first argument to display an amount with two digits to the right of the decimal? a. {0:C} b. {0:c} c. {0:f2} d. All of the above
None of these
Which of the following generates a syntax error?
Ensure that each method has its unique name
Which of the following is NOT a good reason to use method overloading
in
Which of the following is NOT a parameter type -out -in -ref -params
A. yield
Which of the following is a contextual keyword in C#? A. yield B. bool C. const D. Write
C. decimal
Which of the following is a reserved keyword? A. program B. System C. decimal D. Console
True
With only eight bits, you can represent 2^8 or 256 different decimal values
block
Within any class or method, the code between a pair of curly braces is called a(n) ____.
WriteLine( ) advances to the next line after it finishes displaying output
WriteLine( ) differs from Write( ) in that ____.
This is an advanced documentation technique used for XML-style comments; a C# compiler reads the comments and generates XML documentation from them; Three forward slashes are used ///.
XML documentation comments
true
Xamarin is included with the latest version of Visual Studio.
Which character is called the escape character in C#?
\
Double quote is printed
\"
Backslash is printed
\\
Alert signal (short beep)
\a
Curser advances to the beginning of the current line
\r
Cursor advances to the next horizontal tab stop (tab indention)
\t
Mutators
____ are special methods used to read the current state or value of an object member's data
Making sure you understand the problem definition
____ is normally part of the analysis phase of software development.
Formal
____ parameters are variables in a method declaration that accept the values from the actual parameters.
Class
____ variables are variables that are shared by every instantiation of a class.
Which of the following would be the most appropriate identifier for a memory location that will store the amount of rainfall for a given period of time?
amountOfRain
Methods that use the static modifier are called _________ methods
class
Using the object-oriented approach, a(n) ____ is a combined set of attributes and actions.
class
void printTriangle () void printTriangle(char c) they have the same method but have different parameters
give an example of this in code
5
if (a > 10) ...if (b > 10) ......if (c > 10) .........result = 1; ......else .........if (b > 100) ............result = 2; ........else ...........result = 3; ...else ......result = 4; else ...result = 5; What is stored in result when a is equal to zero, b and c are equal to 100?
7
public int mystery(int x, int y) { if (x >= y) return x - y; else return x + y; } Based on the code above, what would be the output of the following statement? System.out.println(mystery(8, mystery(2, 1));
The term ____________ is often used to indicate where an identifier has meaning and can be used
scope, visible
An IDE enables you to ____.
all of the above
Constructors ____.
all of the above.
arguments
Data items you use in a call to a method are called ____.
commas
How are various parameters separated in the method header?
All of these
How can a private variable be accessed?
False
The C# operator ^ can be used for exponentiation.
A. =
The assignment operator used in C# is ______. A. = B. assign C. const D. store
Call by ____________ is the default parameter type.
value
True
An application's main() method must have a void return type. True/False?
name
Overloaded methods share the same
True
Braces are normally included with do...while statements even when unnecessary to avoid confusion with the while statement.
What would be stored in answer after the following arithmetic expression involving only integers, if the sign of the dividend is negative? int answer = -19 % -4;
-3
Avoid writing long methods. Consider refactoring when the method exceeds ____________ lines of code
25
can be overloaded, do not have to be written, and do not return a value
3 properties of Constructors
Instructions for the computer which follow a set of syntax or rules.
Programming Language
False
A case with no statements is called an empty case, and requires only the break statement.
False
A class is an instance of an object.
entity
A class is normally associated with a(n) ____, which often describes a person, place, or thing and is normally a noun.
A. data and behaviors
A class is used in C# to represent the encapsulation of ___________. A. data and behaviors B. packages C. types and objects D. integers and floating point values
The Microsoft programming framework that enables the creation of applications that run on a Web server and delivers functionality through a browser, such as Internet Explorer.
ASP.NET
____ are special methods used to read the current state or value of an object member's data.
Accessors
True
After completing the program, you should compare the results produced with the desk checked calculated results.
A subset of Unicode, in which the first 128 characters correspond to the Unicode character set; consists of the alphabet for the English language, plus numbers and symbols.
American Standard Code for Information Interchange (ASCII)
Compile, Debug, Type your program statements into an editor
An IDE (Integrated Development Environment) enables you to ____.
True
An alternative to importing a class is to import an entire package of classes. True/False?
Sets of instructions telling the computer exactly what to do.
Programs
True
Any variables declared in a for statement header have block scope within that statement.
Consists of programs developed to perform a specific task. Ex) Word, Excel, SQL Server, Access, eBay Programs written for this C# class will be these.
Application Software
Performs the actual computations and comparisons on the data; executes.
Arithmetic Logic Unit (ALU)
true
As far as the compiler is concerned, you could actually type the entire program without touching the Enter key.
False
Base 16, also called the octal numbering system, uses powers of sixteen.
Base-2 numbering system used by computers; consists of two symbols, the values 0 and 1; Ex) 01101001 is equivalent to the number 105 in decimal.
Binary Numbering System
A shortening of the words "Binary digIT"; Binary means two; thus, a binary digit can hold one of two values: 0 or 1.
Bit
True
Both out and ref parameter types cause a method to refer to the same variable that was passed into the method.
True
Both static and constant are keywords in C#.
Start Without Debugging Holds command windows instead of needing to type: Console.Read();
Ctrl-F5
A range of values that a data item can store. Ex) for letter grades: domain is A thru F
Domain
True
Each instruction statement has a semantic meaning—a specific way in which it should be used.
Start Debugging
F5 shortcut
True
It is illegal to declare the same variable name more than once within a block. True/False?
Reads the IL code and translates or produces the machine code that runs on the particular platform; after the code is translated in this second step, results can be seen.
Just-in-time Compiler (JITer)
Predefined reserved identifiers that have specially defined meanings for the compiler.
Keywords
var
Local variables can be implicitly typed by replacing their type with keyword ________.
A logic error (or logical error) is a mistake in a program's source code that results in incorrect or unexpected behavior. It is a type of runtime error that may simply produce the wrong output or may cause a program to crash while running. Ex) assigning a value to the wrong variable may cause a series of unexpected program errors or multiplying two numbers instead of adding them together.
Logic Error
Microsoft Intermediate Language; what the compiler turns the C# code into when compiled; after the compiler creates the IL, the code can be executed on any machine that has the .NET Framework installed.
MSIL or IL
Plans or approaches for solving computer-related problems.
Methodologies
True
Methods are the members of a class that perform an action, and through writing methods you describe the behavior of data.
False
Methods can have only zero parameters or one parameter.
False
Misspelling a name or forgetting to end a statement with a semicolon are examples of runtime errors.
An approach to programming that focuses on determining the data characteristics and the methods or behaviors that operate on the data.
Object-Oriented Approach (methodology)
The Base 8 numbering system that uses powers of eight with symbols 0-7.
Octal Numbering System
private
On a class diagram, the minus symbol shown beside the data member indicates the member is ____.
System
One class predefined as part of .NET is ____.
c. The first letter be uppercase with the first letter of each subsequent word capitalized.
One convention used for naming identifiers is called Pascal case. This convention required that _______. a. The first letter be lowercase with the first letter of each subsequent word capitalized. b. All letters appear in uppercase characters. c. The first letter be uppercase with the first letter of each subsequent word capitalized. d. All letters appear in lowercase with words separated by an underscore.
C. the first letter be uppercase with the first letter of each subsequent word capitalized.
One converntion used for naming identifiers is called Pascal case. This convention requires that _____. A. the first letter be lowercase with the first letter of each subsequent word capitalized. B. all letters appear in uppercase characters C. the first letter be uppercase with the first letter of each subsequent word capitalized. D. all letters appear in lowercase with words separated by an underscore.
A. keywords
Programmers follow the rules for constructing identifiers for naming all of the following items EXECPT _____. A. keywords B. data items C. classes D. namespaces
produces a null empty bodied true statement
Placing a semicolon onto the end of the conditional one-way if statement ____.
True
Placing the two plus symbols (++) before an identifier causes one to be added to the memory location referenced by the variable prior to any other statement's execution.
be descriptive and select a meaningful name
Probably the most important rule for naming identifiers is ____.
d. Be descriptive and select a meaningful name
Probably the most important rule for naming identifiers is ____. a. Do not use over 12 characters for the identifier. b. Number the identifier and being each identifier with an numeric character representing its number c. Use a lowercase for the first character of the identifier d. Be descriptive and select a meaningful name
true
Problem specifications often include the desired output of the program in terms of what is to be displayed, saved, or printed.
A programming approach that is process-oriented and focuses on the processes that data undergo from input until meaningful output; this approach is effective for small, stand-alone applications.
Procedural Programming (methodology)
True
Procedural and object-oriented are the two commonly used design methods.
true
Procedural programming is also called structured programming.
Specifying the order in which the statements are executed
Program control is best defined as:
the last statement in Main( ) is executed
Program execution halts in a C# program when ____.
A method in the Console class; often used in a C# program to keep the output screen displayed until the user presses a key on the keyboard.
Read( )
One option to holding the screen at the end of a program is to invoke Console.Read( ). Another option is to call ____________. It obtains the next character or function key from the user.
ReadKey()
A smaller version of .NET Framework used for deploying applications only; Microsoft offers this for free.
Redistributable Version
H
The Hexadecimal numbering system uses all of the following symbols EXCEPT _____.
True
The Parse( ) method returns the number representation of its string argument.
True
The Read() method is different from the ReadLine() method in that the Read() returns an int and the ReadLine() returns a string argument.
True
The System namespace contains classes that define commonly used types or classes.
Write( ) method
The ToString() method is automatically invoked when an object reference is made in the
True
The Visual Studio IDE is an interactive environment that enables you to type the source code, compile, and execute without leaving the IDE program.
False
The Write( ), WriteLine( ), Read( ), and ReadLine( ) methods are all overloaded.
main()
The ____ method executes first in an application, regardless of where you physically place it within its class.
java.lang
The ____ package contains frequently used classes and is implicitly imported into Java programs.
continue
The ________ statement, when executed in a while loop, skips the remaining statements in the body of the statement and begins the next iteration of the loop.
final
The keyword ____ indicates that a field value is unalterable.
True
The base-2 number system is also called the binary number system.
True
The binary value for ten is 00001010.
False
The body of a method can include statements that declare other methods.
False
The bool data type can take on values of true/false or on/off.
syntax rule violations
The compiler checks for ____.
signature
The compiler determines which version of a method to call by the method's ____.
translating high-level programming language into machine-readable form.
The compiler is responsible for ____.
True
The keyword new is used as an operator to call constructor methods.
False
The following are examples of the access modifiers available in C#: public, personal, protected.
True
The following for loop executes 21 times. (Assume all variables are properly declared.) for (i = 1; i <= 20; i = i + 1) System.out.println(i); True/False?
False
The following for loop executes 21 times. (Assume all variables are properly declared.) for (i = 1; i <= 20; i = i + 1) System.out.println(i);
static methods
The following members of the Math class, (Round(), Max(), Exp()), must be called using the class name, because they are all
True
The for repetition statement handles the details of counter-controlled repetition.
storing the value of each element that is traversed
The foreach repetition statement requires that you provide an array and a variable for the purpose of:
declaration
The method ____ is the first line of a method.
D. private
The most restrictive access modifier that offers accessibility only within the body of the class is ____. A. internal B. public C. protected D. private
False
The number 00001001 is binary is equivalent to the number 2 in decimal.
True
The number 11111111 is binary is equivalent to the number 255 in decimal.
c. floating point
The number 3.45 is an example of a(n) ____ type. a. bool b. int c. floating point d. char
False
The output of the Java code, assuming that all variables are properly declared is: 2 3 4 5 6. n = 2; while (n >= 6) { System.out.print(n + " "); n++; } System.out.println();
False
The output of the Java code, assuming that all variables are properly declared, is 32. num = 10; while (num <= 32) num = num + 5; System.out.println(num); True/False?
False
The output of the Java code, assuming that all variables are properly declared, is: 2 3 4 5 6. n = 2; while (n >= 6) { System.out.print(n + " "); n++; } System.out.println(); True/False?
True
The result of "123" + "321" is "123321".
B. 47.1
The result of the following expression is ______. double ans, v1 = 45.7, v2 = 10.5; int v3 = 5; ans = (int) v1 + v2 / (double) v3; A. 48.8 B. 47.1 C. 48 D. 47
False
The return keyword may not be included with a non-value returning method (void method).
A. immediately preceding the name of the method
The return type is physically placed ________. A. immediately preceding the name of the method B. inside the method C. as the first entry in the method heading D. immediately following the name of the method
true
The rule that every statement should end with a semicolon is an example of a syntax rule.
True
The symbols +=, -=, and *=, compound operators in C#, are used to provide a shortcut way to write assignment statements using the result as part of the computation.
a. bool
The value "true" could be stored in a variable of ____ type. a. bool b. decimal c. char d. floating point
False
The while statement is the only type of loop construct that can be used to develop a sentinel-controlled loop.
int [] an Array = new int[10]{100,100,100};
There are several ways to do a compile-time initialization of arrays. All of the following are valid ways EXCEPT ____.
False
Values in an array can be totaled by using the ArrayTotal method.
False
Values produced by random-number generating methods are truly random. There is no way to predict the next result.
True
Values returned by the Random class method Next are pseudo-random numbers.
Return type; if a method does not return a value, this keyword is included to signal that no value is returned.
Void
9.0 4.0 4.0 10.0
What are the output of the following code segment: System.out.println("Math.round(8.5)); System.out.println(Math.rint(4.5)); System.out.println(Math.ceil(3.5)); System.out.println(Math.rint(9.5));
c. 29
What is stored in ans as a result of the arithmetic expression, given the following declarations? a. 27 b. 12 c. 29 d. None of the Above
C. 29
What is stored in ans as a result of the arithmetic expression, given the following declarations? int ans = 5, v1 = 2, v2 = 10, v3 = 18; ans += v1 + 10 * (v2-- / 5) + v3 / v2; A. 27 B. 12 C. 29 D. none of the above
False
When nesting loops, the variable in the outer loop changes more frequently.
False
When nesting loops, the variable in the outer loop changes more frequently. True/False?
methods
When they have the same name, variables within ____ of a class override the class's fields.
Parallel
When two or more arrays have a relationship such that you are able to use the same subscript or index to refer to related elements in the arrays, you have ____ arrays.
True
When using the prewritten equals() method, a true or false comparison between two Strings is returned, but you do not know how the code looks behind the scenes.
Optional parameter
When you assign a default value to a parameter, it then becomes a(an): ____.
False
When you create an application that has two files, both must have a Main( ) method.
B. sets aside a location in memory to store the value.
When you declare a variable in C#, the computer ___. A. displays the contents of the memory location. B. sets aside a location in memory to store the value. C. does a compile-time initialization of the memory location. D. stores a value in the memory location.
True
When you define a class and determine what data members it should have, you are declaring instance variables or fields that will represent the state of an object.
counter-controlled
When you know how many times a loop will execute in advance, a ________ loop should be used.
for (i==3)
Which of the following for headers is syntactically incorrect?
C. Main()
Which of the following is a user-defined method? A. Parse() B. Write() C. Main() D. Pow()
True
You can write your own constructor methods; but when you don't write a constructor method for a class object, Java writes one for you. True/False?
Single quote is printed
\
are special methods used to read the current state or value of an object member's data
accessor
The first step found in most software development methodologies is ____.
analysis
Another way to write the following expression is ____. ans *= v1 - 1;
ans = ans * --v1;
Which statement subtracts 100 from the original value of an answer?
answer -= 100;
Local variables ____.
are defined inside Main( ) and other methods
When you define the class, you describe its ____________, or characteristics or fields, in terms of data.
attributes
Probably the most important rule for naming identifiers is ____.
be descriptive and select a meaningful name
A(n) ____ version of software has not been fully tested and may still contain bugs or errors.
beta
A computer that has 8 GB of RAM can store approximately eight ____ characters.
billion
The value true could be stored in a variable of ____ type.
bool
parameter lists
but they need to have different
When naming local variable identifiers and parameters, use ____________.
camel casing
A property resembles a(n) ____, but is more closely aligned to a(n) ____.
data field, method
The ____________ constructor does not have any parameters and normally has no body, just opening and closing curly braces.
default
Instance methods manipulate data by ____.
directly accessing private data members.
For a mixed expression equation involving an integer and a double, the result is a(n) ____.
double
9
double answer = Math.Pow(3, 2); The result of the call to Math.Pow( ) in the above statement is to store ____ in answer:
True
double represents a double-precision floating-point number, while float represents a single-precision floating-point number.
Packaging data characteristics and behaviors into a class is called ____.
encapsulation
Which of the following is a valid identifier?
finalGrade
the number 3.45 is an example of a(n) ____ type.
floating point
is out of scope when the loop terminates
for (int i = 0; i < 10; i++) { Console.WriteLine("counter " + i); } The variable i defined in the program segment above ____.
is written following the first semicolon
for (int i = 0; i < 5; i++) Console.Write(i + "\t"); The conditional expression used with the for statement ____.
False
for statements cannot be represented as while statements
10
int [ ] anArray = new int [10]; int [ ] anotherArray = {6, 7, 4, 5, 6, 2, 3, 5, 9, 1}; anotherArray.Length returns ____.
Array.Copy(anotherArray, 0, anArray, 0, 10);
int [ ] anArray = new int [10]; int [ ] anotherArray = {6, 7, 4, 5, 6, 2, 3, 5, 9, 1}; Which of the following would copy all of the elements from anotherArray to anArray?
0
int counter = 0; while (counter < 100) { Console.WriteLine(counter); counter++; } The first value printed with the program segment above is ____.
5
int loopVariable = 0; do { Console.WriteLine("Count = {0:}", ++loopVariable); }while (loopVariable < 5); How many times will be loop body be executed?
When naming a(n) ____________, use an action verb phrase.
method
Class methods manipulate data by ____.
passing information as arguments through parameters.
secret
public static double secret(int first, double second) { double temp; if (second > first) temp = first * second; else temp = first - second; return temp; } What is the name of the above method?
secret(5, 4.8);
public static double secret(int first, double second) { double temp; if (second > first) temp = first * second; else temp = first - second; return temp; } Which of the following is a valid call statement to the method given above?
public
public static void Main() The access modifier in the heading above is the keyword
To define a property to change a data member of a class include a ____ clause.
set
Which of the following integral type can NOT be used to store negative values?
uint
Calls to ____________ methods must be placed at a location in your code where the value could be accepted when the method is finished.
value-returning
Every method that has a return type other than ________ must have a return statement in the body.
void
It needs to have different parameter lists so the compiler knows which method should be called -could mean different amounts of parameters or differ type(s) of parameters
what must an overloaded method have ?