Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Test #1 Solutions. Multiple Choice 1. B) the grammar of the coding language 2. C) String 3. A) Single 4. C) 2Burgers4Me 5. B) Design Time.

Similar presentations


Presentation on theme: "Programming Test #1 Solutions. Multiple Choice 1. B) the grammar of the coding language 2. C) String 3. A) Single 4. C) 2Burgers4Me 5. B) Design Time."— Presentation transcript:

1 Programming Test #1 Solutions

2 Multiple Choice 1. B) the grammar of the coding language 2. C) String 3. A) Single 4. C) 2Burgers4Me 5. B) Design Time 6. A) 1 100 \ 24 / 4 mod 3 =100 \ 6 mod 3 =16 mod 3 =1

3 Multiple Choice (continued) 7. B) num mod 3 = 0 Line 1dim sidelength as integer Line 2dim area as integer Line 3sidelength = 4 Line 4area = sidelength ^ 2 Line 5lbloutput.text = “The area of your square is” & area 8. A) line 1 9. C) line 5 10. D) The area of your square is16

4 Short Answer #1 It is called the Solution Explorer. We use the buttons to show Code Window or Design Window. OR We use this window to give our form and application filenames. OR We use this window to view all parts of our project.

5 Short Answer # 2 To explain to others what our code is doing. -- other programmers, the teacher, other students Explains the logic and clarifies our code.

6 Short Answer #3 1. Input from User 2. Output to User 3. Mathematical Calculations 4. Storing Data (Variables) 5. Conditional Statements (If) 6. Repeating Statements (Loops)

7 Short Answer #4 a) What is an event? Clicking a button, loading a form, changing the text in the textbox … something the user does to interact with our program b) What is an event procedure? The section of code for an object c) How are the two connected? The event must occur to execute the code in the event procedure.

8 Code Writing *(simple logic) ‘declare variables Dim total as single Dim pepperoni as single Dim cheese as single Dim onion as single Etc. Private Sub chkPepperoni … If chkPepperoni.checked = true then pepperoni = 2 End if Private Sub optLarge … If optLarge.checked = true then large = 15.5 End if Private Sub cmdCalculateCost … total = pepperoni + large + small + cheese + onion + tomato + olive + bacon lblOutputCost.text = “The cost of your pizza is $” & total

9 Code Writing **(better way) ‘declare variables Dim cost as single Private Sub chkPepperoni … If chkPepperoni.Checked = True then cost = cost + 2 Else cost = cost - 2 End If Private Sub optLarge … If optLarge.Checked = True then cost = cost + 15.5 Else cost = cost - 2 End If Private Sub btnCalculateCost lblOutputCost.Text = “The cost of your pizza is $” & cost **stuff in Pink was extra … level 3 without it – customers may change mind, and you uncheck.. the Pink code will then subtract the amount from the total **also earned extra marks for only using one variable


Download ppt "Programming Test #1 Solutions. Multiple Choice 1. B) the grammar of the coding language 2. C) String 3. A) Single 4. C) 2Burgers4Me 5. B) Design Time."

Similar presentations


Ads by Google