You are on page 1of 9

Chapter 4 and 5 Sample Test

Section 4.2 Sub Procedures, Part II 1. The value of an argument in a call statement can be changed by a Sub procedure only if the same name is used in the Sub procedure's parameter list. a. True b. False Section 5.1 Relational and Logical Operators 2. Which value for x would make the following condition true: x >= 5 a. x is equal to 7 b. x is equal to 5 c. x is equal to 5.001 d. all of the above Section 4.2 Sub Procedures, Part II 3. What will be displayed when the button is clicked?

a. tin can b. can tin c. tin tin d. can can Section 4.1 Sub Procedures, Part I 4. Arguments and parameters can be used to pass values to Sub procedures from event procedures or other Sub procedures. a. True b. False

Section 4.1 Sub Procedures, Part I 5. What will be the output of the following program when the button is clicked?

a. progr b. r c. e d. progre Section 4.4 Modular Design 6. A GoTo statement can always be replaced by a combination of the three logical structures of structured programming. a. True b. False Section 5.3 Select Case Blocks 7. The Case Else part of a Select Case block is optional. a. True b. False Section 5.3 Select Case Blocks 8. Which Case clause will be true whenever the value of the selector in a Select Case block is between 1 and 5 or is 8? a. Case 1 To 8 b. Case 1 To 5, 8 c. Case 1 To 8, 5 d. Case 1 To 5; 8 Section 5.2 If Blocks 9. Constructs in which an If block is contained inside another If block are called: a. multi-If blocks b. nested If blocks c. sequential If blocks d. none of the above

Section 4.1 Sub Procedures, Part I 10. The process of transmitting values to a Sub procedure is known as ______________. a. passing b. conveying c. evaluating d. referencing Section 4.2 Sub Procedures, Part II 11. Sometimes the statements Tally(num) and Tally((num)) have the same effect. a. True b. False Section 5.2 If Blocks 12. What will be displayed by the following program when the button is clicked?

a. 1 b. 2 c. 3 d. None of the above. Section 4.1 Sub Procedures, Part I 13. Each parameter defined for a Sub procedure corresponds to an argument passed in a call statement for that procedure. a. True b. False Section 5.3 Select Case Blocks 14. You can specify a range of values in a Case clause by using the To keyword. a. True b. False

Section 4.4 Modular Design 15. A(n) __________ is an encapsulation of data and code that operates on the data. a. object b. driver c. decision d. module Section 4.3 Function Procedures 16. Although a function can return a value, it cannot directly display information in a text box. a. True b. False Section 4.1 Sub Procedures, Part I 17. Items appearing in the parentheses of a call statement are known as _______________. a. call variables b. call strings c. parameters d. arguments Section 4.1 Sub Procedures, Part I 18. Consider the following Sub procedure.

What will be the output when TruncateSum is used in the following lines of code? Dim num1, num2, num3 As Double num1 = 3.5 num2 = 6.75 num3 = 1 TruncateSum(num1, num2, num3) a. 10 b. 12 c. 0 d. 11

Section 4.1 Sub Procedures, Part I 19. What will be the output when the button is clicked?

a. AAB b. BAA c. abc d. ABA Section 4.4 Modular Design 20. In modular programming, a driver is a. another name for the team leader of a project. b. a "dummy" program designed solely to call a single procedure and examine its returned values. c. one of the event procedures that a user can invoke. d. never to be used. Section 5.3 Select Case Blocks 21. Every Select Case block can be replaced by If blocks. a. True b. False Section 5.2 If Blocks 22. What will be displayed when the button is clicked?

a. 0

b. 3 c. 6 d. An error will occur. Section 4.1 Sub Procedures, Part I 23. Which one of the following is true about arguments and parameters? a. Arguments appear in call statements; parameters appear in Sub statements. b. Parameters appear in call statements; arguments appear in Sub statements. c. They are synonymous terms. d. They are completely unrelated in a program. Section 5.1 Relational and Logical Operators 24. Which of the following is a valid VB.NET conditional statement? a. 2 < n < 5 b. 2 < n Or < 5 c. 2 < n Or 5 d. (2 < n) Or (n < 5) Section 5.1 Relational and Logical Operators 25. Which value for x would make the following condition true: (x >= 5) And (x <= 6) a. x is equal to 7 b. x is equal to 5 c. x is equal to 5.001 d. x is equal to 5 and x is equal to 5.001 Section 5.3 Select Case Blocks 26. One may use an If block within a Select Case block. a. True b. False Section 4.3 Function Procedures 27. A Function may return up to two values. a. True b. False Section 4.1 Sub Procedures, Part I 28. Both constants and expressions can be used as arguments in call statements. a. True

b. False Section 4.4 Modular Design 29. Most modern programmers use a blend of traditional structured programming along with object-oriented design. a. True b. False Section 4.4 Modular Design 30. Stepwise refinement refers to a. the process whereby a malfunctioning program is fixed by correcting one "bug" at a time. b. any procedure that calls another procedure (and so on) to accomplish a task. c. breaking a large task into smaller tasks. d. the belief that increasing the number of people working on a project decreases the time it will take to complete the project. Section 5.2 If Blocks 31. When an If block has completed execution, the program instruction immediately following the If block is executed. a. True b. False Section 5.3 Select Case Blocks 32. What will be the output of the following program when the button is clicked?

a. Federal Aviation Administration b. Drug Enforcement Agency c. Syntax error d. Unknown acronym. Sorry.

Section 5.1 Relational and Logical Operators

33. When using the logical operator "Or", what part of the expression must be true? a. only the left part. b. only the right part. c. either the left or right part, but not both. d. either the left or right part. Section 4.3 Function Procedures 34. The declaration line of a Function procedure must include parameters. a. True b. False Section 5.2 If Blocks Section 5.3 Select Case Blocks 35. One may use a Select Case block within an If block. a. True b. False Section 4.2 Sub Procedures, Part II 36. When the button is clicked, the output of the following program will be 20.

a. True b. False Section 5.1 Relational and Logical Operators 37. Which value for x would make the following condition true: Not (x >= 5) a. x is equal to 7 b. x is equal to 4 c. x is equal to 5.001 d. all of the above

Section 4.1 Sub Procedures, Part I

38. What is wrong with the following call statement and its corresponding Sub statement?

a. It is not valid to pass something like "The Jetsons." b. Constant values like 1000 cannot be passed, only variables. c. var1 is not of the same data type as "The Jetsons." d. Nothing is wrong with them. Section 4.3 Function Procedures 39. Function names should be suggestive of the role performed. The names also must conform to the rules for naming variables. a. True b. False Section 4.1 Sub Procedures, Part I 40. Sub procedures can be called only once during the execution of a program. a. True b. False Question 46 (2 points) 41. Section 5.1 Relational and Logical Operators The three main logical operators are ________, _________, and ________. a. And, Or, Not b. And, Not, If c. Or, Not, If d. False, And, True Section 4.3 Function Procedures 42. Suppose you want to write a procedure that takes three numbers, num1, num2, and num3; and returns their sum, product, and average. It is best to use a Function procedures for this task. a. True b. False

You might also like