Deck 2: Data Types and Expressions
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/75
Play
Full screen (f)
Deck 2: Data Types and Expressions
1
Both static and constant are keywords in C#.
False
2
An appropriate identifier used to store the total transaction amount is total$Amount.
False
3
If aNumber is declared to be of type int with a value of 50, Console.out.WriteLine( aNumber++); displays 51.
False
4
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.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
5
The result of "123" + "321" is "123321".
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
6
The assignment operators (=, +=, -=, *=, and /=) represent operations that appear at the top of the hierarchy in the order of operations.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
7
The bool data type can take on values of true/false or on/off.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
8
The decimal equivalent for 3.42e-5 in scientific notation is .00342.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
9
The decimal value type is appropriate for storing monetary data items because it provides for greater precision.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
10
Classes are actually implemented through types in C#.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
11
moreData = true;
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.
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.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
12
C# allows you to mix numeric integral types and floating-point types in an expression.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
13
When you desk check the algorithm, you can compare the results obtained from the program with calculator results.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
14
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.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
15
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.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
16
float totalAmount = 23.57;
The float compile-time initialization above will produce an error because it is missing the type specifier (f or F).
The float compile-time initialization above will produce an error because it is missing the type specifier (f or F).
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
17
Constants are normally named using all lowercase characters, separating second and subsequent words with the underscore character.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
18
The result of 25 % 4 is 6.25.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
19
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.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
20
Classes, methods, namespaces, and properties follow the Pascal case naming convention, which indicates that the first letter in the identifier is in lowercase and the first letter of each subsequent concatenated word is capitalized.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
21
The number 11111111 in binary is equivalent to the number 255 in decimal.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
22
Base 16, also called the octal numbering system, uses powers of sixteen.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
23
The special character that can be used with an identifier is ____.
A) -
B) _
C) *
D) #
A) -
B) _
C) *
D) #
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
24
The number 3.45 is an example of a(n) ____ type.
A) bool
B) int
C) floating point
D) char
A) bool
B) int
C) floating point
D) char
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
25
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
A) {0:C}
B) {0:c}
C) {0:f2}
D) all of the above
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
26
Given the following declarations, what is stored in ans as a result of the arithmetic expression?

A) 1.3333
B) 1.6
C) 2
D) 3

A) 1.3333
B) 1.6
C) 2
D) 3
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
27
The binary value for ten is 00001010.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
28
Which of the following is a valid identifier?
A) score#1
B) amount owed by student
C) finalGrade
D) 4thExam
A) score#1
B) amount owed by student
C) finalGrade
D) 4thExam
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
29
The value $78,888.90 is printed as output when the {0:c) format specifier is used in the following Write statement: Console.Write("{0:c}", 78888.894);
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
30
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

A) 27
B) 12
C) 29
D) none of the above
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
31
With only eight bits, you can represent 28 or 256 different decimal values.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
32
A machine that has a 64-bit processor can process 64 characters at one time.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
33
One convention 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) 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
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
34
Which statement subtracts 100 from the original value of an answer?
A) 100 -= answer;
B) answer = 100 -;
C) answer =- 100;
D) answer -= 100;
A) 100 -= answer;
B) answer = 100 -;
C) answer =- 100;
D) answer -= 100;
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
35
Probably the most important rule for naming identifiers is ____.
A) do not use over 12 characters for the identifier
B) number the identifiers and begin each identifier with an numeric character representing its number
C) use a lowercase character for the first character of the identifier
D) be descriptive and select a meaningful name
A) do not use over 12 characters for the identifier
B) number the identifiers and begin each identifier with an numeric character representing its number
C) use a lowercase character for the first character of the identifier
D) be descriptive and select a meaningful name
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
36
Hexadecimal uses the symbols 1, 2, 3, 4, 5, 6, 7 8, 9, A, B, C, D, E, F ,G.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
37
The value true could be stored in a variable of ____ type.
A) bool
B) decimal
C) char
D) floating point
A) bool
B) decimal
C) char
D) floating point
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
38
The base-2 number system is also called the binary number system.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
39
Unicode includes representation of 28 or 256 unique characters.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
40
When you think about a machine that has 60 gigabytes of hard disk space, you can store 60 million characters.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
41
For a mixed expression equation involving an integer and a double, the result is a(n) ____.
A) error
B) double
C) int
D) float
A) error
B) double
C) int
D) float
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
42
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( ) ____.
A) "{0:$,2}"
B) "{C:0}"
C) "{0:C}"
D) "{0:F,2,$}"
A) "{0:$,2}"
B) "{C:0}"
C) "{0:C}"
D) "{0:F,2,$}"
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
43
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;
A) -3
B) 3
C) 4.75
D) -4.75
Int answer = -19 % -4;
A) -3
B) 3
C) 4.75
D) -4.75
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
44
The binary equivalent of 24 is ____.
A) 00000011
B) 11000000
C) 00011000
D) 00001111
A) 00000011
B) 11000000
C) 00011000
D) 00001111
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
45
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?
A) amountDue = 0;
B) amountDue = '0';
C) amountDue = 0m;
D) amountDue = 0f;
A) amountDue = 0;
B) amountDue = '0';
C) amountDue = 0m;
D) amountDue = 0f;
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
46
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
A) time
B) amount of rain
C) amountOfRain
D) amountofrainforsomeperiodoftime
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
47
A valid string literal representing the last month of the year is ____.
A) 12
B) "December"
C) lastMonthOfTheYear
D) December
A) 12
B) "December"
C) lastMonthOfTheYear
D) December
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
48
The decimal equivalent of 00011111 is ____.
A) 5
B) 10
C) 31
D) 32
A) 5
B) 10
C) 31
D) 32
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
49
The value stored in answer after the following expression is evaluated is
Int v1 = 10, v2 = 5, ans =3;
Ans += --v1 * v2++;
A) 39
B) 48
C) 57
D) none of the above
Int v1 = 10, v2 = 5, ans =3;
Ans += --v1 * v2++;
A) 39
B) 48
C) 57
D) none of the above
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
50
Another way to write the following expression is ____.
Ans *= v1 - 1;
A) ans = v1 * ans - 1;
B) ans = v1 * (ans - 1);
C) ans = ans * v1--;
D) ans = ans * --v1;
Ans *= v1 - 1;
A) ans = v1 * ans - 1;
B) ans = v1 * (ans - 1);
C) ans = ans * v1--;
D) ans = ans * --v1;
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
51
The Hexadecimal numbering system uses all of the following symbols EXCEPT _____.
A) 0
B) A
C) F
D) H
A) 0
B) A
C) F
D) H
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
52
Following standard conventions used by many programmers, the identifier REBATE would be defined as a(n) ____.
A) class
B) object
C) namespace
D) constant
A) class
B) object
C) namespace
D) constant
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
53
Which of the following integral type can NOT be used to store negative values?
A) sbyte
B) long
C) int
D) uint
A) sbyte
B) long
C) int
D) uint
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
54
The value 3.42e-4 is equivalent to _____.
A) 3420000
B) .000342
C) -3.420000
D) -.000342
A) 3420000
B) .000342
C) -3.420000
D) -.000342
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
55
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
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
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
56
A computer that has 8 GB of RAM can store approximately eight ____ characters.
A) million
B) trillion
C) gillion
D) billion
A) million
B) trillion
C) gillion
D) billion
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
57
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 = 0d;
A) amountDue = 0;
B) amountDue = '0';
C) amountDue = 0m;
D) amountDue = 0d;
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
58
Which of the following expressions would be evaluated first?
Ans += v1 + v2 * v3 % 2;
A) ans += v1
B) v1 + v2
C) v2 * v3
D) v3 % 2
Ans += v1 + v2 * v3 % 2;
A) ans += v1
B) v1 + v2
C) v2 * v3
D) v3 % 2
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
59
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;
A) char letterGrade;
B) string grade;
C) int letterGrade;
D) double letterGrade;
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
60
A variable of type bool can store ____.
A) "true"
B) TRUE
C) true
D) all of the above
A) "true"
B) TRUE
C) true
D) all of the above
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
61
A(n) ____________ represents an area in the computer memory where a value of a particular data type can be stored. When you declare a(n) ____________, you allocate memory for that data item in your program.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
62
____________ operators provide a shortcut way to write assignment statements using the result as part of the computation.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
63
____________ are predefined reserved identifiers that have special meanings to the compiler.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
64
____________ is the universal character-encoding schema that provides a unique number for every character in many different languages.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
65
A megabyte is approximately a(n) ____________ bytes.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
66
The ____________ data type is a whole number, between a certain range of values, and contains no decimal point.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
67
The C# category of ____________ operators appear at the top of the precedence table with the order of operations.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
68
Every time you declare a variable in the C# language, you are actually ____________ a class.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
69
The @ symbol in the following string, @ "C:\MyProjects", is called a(n) ____________ character.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
70
When you add the keyword ____________ to a declaration, it becomes a constant.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
71
The ____________ is sometimes referred to as the remainder operator.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
72
____________ makes a variable temporarily behave as if it is a different type.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
73
The ____________ data type was added to the language to eliminate the problems of loss of precision in mathematical operations that occurred in previous languages.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
74
One of the rules for creating a(n) ____________ is to use a combination of alphabetic characters, numeric digits and the underscore character.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
75
In order to place a value in memory that cannot be changed, you add the keyword ____________ to the declaration.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck