CS 160 EXAM 1 (TRUE/FALSE)

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

F

Assignment operators appear at the top of the hierarchy in the operator precedence table

T

Both out and ref parameter types cause a method to refer to the same variable that was passed into the method

T

C# offers both call by value and call by reference parameters. Call by value is the default type.

T

Constructors are methods

T

In order to use the MessageBox.Show() method, you need to not only add a reference to the namespace which includes the class, but also add a using directive to the program statements

F

Methods can be defined globally outside of a class in C#

T

Scope refers to the region in the program in which you can use the variable

T

The do...while loop can be used to implement a counter-controlled, sentinel-controlled, or state-controlled loop

T

The result of "123" + "321" is "123321"

F

The rule for lining up, or matching, elses is that the else is matched with the first if, from top to bottom

F

The value $78,888.90 is printed as output when the {0:c} format specifier from the program with calculator results.

T

When you desk check the algorithm, you can compare the results obtained from the program with calculator results

F

With nested loops, the outermost loop is always totally completed before the innermost loop is executed.

T

Without incrementing the counter used in the conditional expression with counter controlled loops, the loop would go indefinetely

F

in C#, both the break and default are optional entries found with a switch statement

F

int sum = 0; int number = 0; while( number < 10) { sum = sum + number; Console.WriteLine(sum); } The statement above prints the value of 0 through 9 on separate lines.

F

s = num.Next(7); The statement above produces seven random numbers.

F

the conditional expression true || false produces false

F

A semicolon is placed on the end of a method heading following the parameter list.

F

A standard convention used by C# programmers is to use the Pascal case style for class, data member identifiers, and method identifiers.

F

A state-controlled loop should be designed when you know the number of times the statements must be executed

T

An advantage of sentinel-controlled loops s you do not need to know how many times the loop will be performed.

F

If aNumber is declared to be of type int wit ha value of 50, Console.out.WriteLine(aNumber++); displays 51.

F

In C# curly braces must be added to surround all loop bodies.

T

In C#, the && and || operators are also called the short-circuiting logical operators

T

Methods that use the static modifier are called class methods

F

The do...while statement is a posttest loop, which means that the conditional expression is tested before any of the statements in the body of the loop are performed

T

Unlike the sentinel-controlled loop, the variable used with a state controlled loop differs from the variable used to store the data that is being processed

F

When you have a single variable being tested for equality against four or more values, a one-way selection statement is the most appropriate type of conditional expression to use

F

You often need to so a "prime the read" for counter controlled loops which means that you would input a value before going into the body of the loop

F

a class is an instance of an object

T

a class named River will have a constructor named River

F

a constructor is used to instantiate a class from an object

F

a sentinel controlled is also called a flag-controlled loop.

F

if a numeric variable is being changed by a consistent amount with each iteration through the loop, the while statement is the best choice constructs


Set pelajaran terkait

Traditions and Encounters Chapter 38: A World without Borders

View Set

Chapter 3: A First Look at Classes and Objects

View Set

Unit 8 Questions (COMFORT PAIN, SLEEP, MOBILITY, SAFETY, CARING INTERVENTION)

View Set

FINAL EXAM INTERNATIONAL MARKETING

View Set

Bios 242 Week 1 Concepts: The Cell

View Set