Programming Theory Exam 2

Programming Theory Exam 2

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

16. A ____________ is a variable that is declared inside a class but not inside of any method.

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (50)

Section 1

(50 cards)

16. A ____________ is a variable that is declared inside a class but not inside of any method.

Front

a. named constant b. field c. namespace d. property

Back

30. A(n) ____________ is a storage location in memory that is represented by a name.

Front

a. declaration b. sector c. variable d. instance

Back

17. A(n) ____________ specifies how a class member can be accessed by code located outside the class

Front

a. variable name b. access modifier c. namespace d. class name

Back

25. A(n) ____________ control is a rectangular area on a form that accepts keyboard input from the user.

Front

a. Label b. PictureBox c. Input d. TextBox

Back

33. Fundamental types of data, such as integers and real numbers are known as ____________.

Front

a. fundamental data types b. primitive data types c. natural data types d. basic data types

Back

14. A ____________ is a identifier for a value that cannot be modified during the program's execution.

Front

a. sentinel b. literal c. keyword d. named constant

Back

5. A numeric literal such as 3.5 is considered by the compiler to be a ____________.

Front

a. real number b. floating-point value c. decimal literal d. double literal

Back

19. A ____________ is a field whose value cannot be modified at runtime.

Front

a. literal field b. constant field c. sentinel field d. common field

Back

26. When a user types something into a TextBox control, the input is stored in the control's ____________ property.

Front

a. Text b. Input c. String d. Value

Back

38. The ____________ operator produces a string that is the combination of the two strings used as its operands.

Front

a. + b. = c. * d. &

Back

9. The ____________ contains statements that can potentially throw an exception.

Front

a. break block b. catch block c. try block d. run block

Back

20. The .NET Framework provides a class named ____________ containing numerous methods for performing advanced mathematical operations.

Front

a. Linq b. Trig c. Math d. Calc

Back

11. If a statement in the try block throws an exception, the program immediately jumps to a ____________.

Front

a. catch block b. try block c. run block d. break block

Back

36. Assuming a string variable named city has already been declared, which one of the following statements assigns the string literal "Vienna" to the variable?

Front

a. "Vienna" = city; b. city + "Vienna"; c. city("Vienna"); d. city = "Vienna";

Back

41. A(n) ____________ variable belongs to the method in which it is declared, and only statements inside that method can access the variable.

Front

a. limited b. local c. global d. static

Back

35. Which one of the following statements declares a string variable named message?

Front

a. message string; b. string = message; c. string message; d. string + message;

Back

50. Which one of the following statements initializes the color variable with the string "red"?

Front

a. color = "red"; b. string color = "red"; c. "red" = string color; d. string color("red");

Back

18. If you do not initialize a(n) ____________ field, it begins with a special value known as null.

Front

a. int b. decimal c. double d. string

Back

21. When an application is running, the control having the ____________ is the one that receives the user's keyboard input

Front

a. focus b. scope c. data d. tab index

Back

15. Which one of the following statements declares a named constant named GRAVITY with an initialization value of 9.8?

Front

a. double GRAVITY = 9.8 const; b. const double GRAVITY = 9.8; c. double const GRAVITY = 9.8; d. double GRAVITY const = 9.8;

Back

31. A(n) ____________ specifies a variable's name and data type.

Front

a. variable declaration b. data indicator c. object tag d. source entity

Back

2. A ____________ is a number that is directly written into a program's code.

Front

a. numeric literal b. binary constant c. real value d. source digit

Back

39. Assuming a string variable named movieTitle has already been declared, which one of the following statements combines the strings "The " and "Hobbit" and then assigns the resulting string to the variable?

Front

a. movieTitle("The ", "Hobbit"); b. "The " + "Hobbit" = moveTitle; c. movieTitle = "The " & "Hobbit"; d. movieTitle = "The " + "Hobbit";

Back

37. A common operation performed on strings is ____________, or appending one string to the end of another string.

Front

a. extending b. combination c. concatenation d. affixing

Back

3. A numeric literal that is assumed to be an integer is called a(n) ____________.

Front

a. real number b. integer literal c. natural literal d. common value

Back

24. Clicking View and then Tab Order on the Visual Studio menu bar will cause the form to be displayed in __________ mode.

Front

a. design b. tab order selection c. default focus d. compile

Back

44. A variable's ____________ is the time period during which the variable exists in memory while the program is executing.

Front

a. span b. lifetime c. instance d. latency

Back

29. Which one of the following statements clears the Text property of a TextBox control named addressTextBox?

Front

a. addressTextBox.Text = Text.Clear; b. addressTextBox.Text = ""; c. addressTextBox = Nothing; d. addressTextBox.Empty();

Back

12. When an exception is thrown, an object known as a(n) ____________ is created in memory.

Front

a. exception object b. debug variable c. try object d. state object

Back

23. The ____________ property contains an integer value that indicates the control's position in the tab order

Front

a. TabIndex b. FocusIdex c. OrderIndex d. IndexValue

Back

46. You can assign a value to a variable only if the value is compatible with the variable's ____________.

Front

a. data type b. name c. scope d. lifetime

Back

13. Assuming an application has an exception object named ex, which one of the following statements would cause the exception's default error message to be displayed in a message box

Front

a. MessageBox(ex.Message); b. ex.Message = MessageBox.Text; c. MessageBox.Show(ex.Message); d. MessageBox.Text = ex.Message;

Back

47. A ____________ holds only one data value at any given moment in time.

Front

a. program b. data type c. method d. variable

Back

4. Which one of the following statements initializes a variable with an integer literal?

Front

a. int score = 2500; b. decimal total = 156.78m; c. double rate = 0.00435; d. string name = "Michelle";

Back

28. Which one of the following statements assigns the value contained in the Text property of a TextBox control named ageTextBox to the Text Property of a Label control named ageLabel?

Front

a. ageLabel = ageTextBox; b. ageTextBox.Text = ageLabel.Text; c. ageLabel.Text = ageTextBox.Text; d. ageTextBox = ageLabel;

Back

45. You cannot declare two variables with the same ____________ in the same scope.

Front

a. lifetime b. data type c. name d. value

Back

1. The ____________ is commonly used in financial applications because it can store real numbers with a large number of digits to the right of the decimal point.

Front

a. string b. int c. double d. decimal

Back

43. A ____________ variable's scope begins at the variable's declaration and ends at the end of the method in which the variable is declared.

Front

a. global b. static c. local d. basic

Back

10. In a try-catch statement, the ____________ keyword appears immediately after the try block.

Front

a. try b. catch c. break d. continue

Back

32. Which one of the following is the general format for a variable declaration statement?

Front

a. VariableName DataType; b. DataType VariableName; c. DataName VariableType; d. NameType VaraibleData;

Back

40. Inside a method, a variable's declaration statement must appear ____________ any other statements that use the variable.

Front

a. after b. before c. near d. in

Back

22. The order in which controls receive the focus is called the ____________.

Front

a. focus index b. tab order c. order element d. tab index

Back

6. Which one of the following statements initializes a variable with a double literal?

Front

a. string modelNumber = "R2C32"; b. double percentage = 23.59; c. int width = 150; d. decimal bonus = 0.99m

Back

8. Which one of the following statements initializes a variable with a decimal literal?

Front

a. string displayPrice = "$14.99"; b. decimal budget = 450m; c. int inventory = 150; d. double volume = 30.25;

Back

7. Appending the letter M or m to a numeric literal causes the number to be considered a ____________.

Front

a. monetary literal b. double literal c. decimal literal d. mnemonic literal

Back

48. When coding most statements, you can press the ____________ key when you reach an appropriate point to continue the statement on the next line

Front

a. Enter b. Tab c. X d. Shift

Back

34. A variable of the ____________ data type can hold any sequence of characters, such as a person's name, address, or password.

Front

a. int b. double c. string d. decimal

Back

49. One way to make sure a variable has been assigned a value is to ___________ the variable with a value when you declare it.

Front

a. initialize b. instantiate c. concatenate d. compare

Back

42. Programmers use the term ____________ to describe the part of a program in which a variable may be accessed.

Front

a. scope b. lifetime c. method d. accessibility

Back

27. The TextBox control is located in the ____________ group of the Toolbox

Front

a. Common Controls b. Dialog c. Components d. Containers

Back