Chapter 3, T/F

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

A local variable cannot be accessed by code that appears inside the same method, but before the variable's declaration.

True

A variable of the decimal data type can hold real numbers with greater precision that the double data type.

True

An error occurs if a statement in one method tries to access a local variable declared inside another method.

True

An error occurs if you attempt to use a string that is set to null.

True

Any data the user enters into a TextBox control is stored in the control's Text property as a string, even if it is a number.

True

Because decimal is the preferred data type for storing monetary amounts, remembering that "m" stands for "money" might help you to remember that decimal literals must end with the letter M or m.

True

C# does not allow operations that mix the decimal and double data types unless you use a cast operator to explicitly convert one of the operands.

True

Each numeric format string can optionally be followed by an integer that indicates how many digits to display after the decimal point.

True

If a field is a variable of a numeric data type, it will be initialized to 0 by default if you do not explicitly initialize it with a value.

True

If all statements in a try block execute with no exception, the catch block is skipped.

True

If you need to store numbers and perform mathematical operations on them, you have to use a numeric data type.

True

In C#, a variable must be assigned a value before it can be used on the right side of an assignment statement.

True

In C#, the + operator has two uses: string concatenation and numeric addition.

True

In C#, you must declare a variable in a program before you can use it to store data.

True

It is usually best to break a long statement into multiple lines so you can read the code without scrolling the programming editor sideways.

True

Once you have assigned a value to a variable, you can use the variable in other operations.

True

Rounding can occur when the number of digits you have specified after the decimal point in the format string is smaller than the precision of the numeric value.

True

The C# language provides many data types for storing fundamental types of data, such as strings, integers, and real numbers.

True

The GroupBox control is found in the Toolbox window's Containers section.

True

The Math class provides two predefined named constants, Math.PI and Math.E, which are assigned mathematical values for pi and e.

True

The contents of a control's Text property is always a string.

True

The keyword const is a qualifier that tells the compiler to make the variable read-only.

True

The modulus operator (%) performs division between two integers, but rather than returning the quotient, it returns the remainder.

True

The purpose of a variable declaration is to tell the compiler you plan to use a variable of a specified name to store a particular type of data.

True

The same rules for identifiers that apply to control names also apply to variable names.

True

The using System; directive is required for any program that uses the Parse methods.

True

To get out of break mode in Visual Studio, click the Stop Debugging button on the standard toolbar or press Shift + F5 on the keyboard.

True

When you divide an integer by an integer in C#, the result is always an integer.

True

When you perform a math operation on two operands of the same data type, the result will always be of that data type.

True

When you store a data in a variable, the value replaces any data previously stored inside the variable.

True

When you write a catch clause, you can optionally assign a name to the exception object.

True

You assign an access key to a control through its Text property by placing an ampersand (&) before the letter you want to assign as an access key.

True

You can clear the contents of a TextBox control in the same way that you clear the contents of a Label control, by assigning an empty string to the control's Text property.

True

You cannot assign a decimal value to a double variable because the decimal data type allows for much great precision than the double data type.

True

You cannot assign a numeric value to a control's Text property because only strings can be assigned to the Text property.

True

GroupBox controls do not have their own TabIndex property.

False

If you don't write an access modifier in a field declaration, an error will occur.

False

If you want to display an ampersand character in the Text property of a control, use three ampersands in a row, such as (&&&).

False

In C#, a variable's data type is automatically determined by the type of value that is stored in the variable.

False

In C#, you use the & operator to concatenate strings.

False

Mathematical expressions involving multiple operators are always evaluated from left to right.

False

Only TextBox controls have a TabIndex property.

False

Primitive data types are not supported in the C# language.

False

Programs use data types to store data in memory.

False

Some operations can be performed on strings, but not on a control's Text property.

False

The C# compiler will compile code that attempts to use an unassigned variable.

False

The Parse methods work even if the string being converted contains an invalid numeric value.

False

Variables having the same name cannot be declared in different methods.

False

When a cast operator is applied to a variable, it changes the contents of a variable.

False

When a method ends, its local variables retain their values.

False

When you assign a double value to a decimal variable, the double value is implicitly converted to a decimal with no loss of data.

False

When you declare a named constant, an initialization value is not required.

False

You can assign integer constants to int, double, and decimal variables.

False

You can declare multiple variables of different data types in one program statement.

False

You can use a cast operator to convert a string to a numeric type.

False

After a variable has been declared, you can use the + operator to store a value in the variable.

False

Constant names must always be written in uppercase letters.

False

A constant field's value can only be changed by other statements inside the class.

False

A variable declaration specifies three things about a variable: its data type, name, and location in memory.

False

A variable is visible only to statements outside the variable's scope.

False

A variable of the int data type can hold numbers with a fractional part, such as 22.1 or −4.9.

False

A Panel control cannot display a title and does not have a Text property.

True

A Panel's border can be specified by its BorderStyle property.

True

A cast operator is the name of the desired data type, written inside parentheses and placed to the left of the value that you want to convert.

True

A double variable is stored in a format that programmers call double precision floating-point notation.

True

A field is visible to all methods within the same class.

True

A form's BackgroundImageLayout property is similar to the PictureBox control's SizeMode property.

True

A form's field values remain in memory as long as the form itself.

True


Kaugnay na mga set ng pag-aaral

GI Clinical Questions (Clin Med Exam 3)

View Set

Chapter 12-Individual Policy Provisions

View Set

Real Estate U - Exam Answers (Part 1)

View Set

Disease Conditioning Final CH 12

View Set

how to tell you're reading a gothic novel

View Set

Anxiety, Depression, and Suicide

View Set