Unit 4 CMU coding academy test
Unit 4 CMU coding academy test Which of the functions is called when z = 12? if (z 12): drawPolygon(z) elif (z == 12): sayHi() else: drawOval('yellow') a. drawOval b. sayHi c. drawPolygon d. None - Answer-b. Which of the following is true about if-elif-else statements? a. After using if, an elif can be added as an additional test. b. The bodies of multiple elif's can run. c. You can use an elif without an if. d. Code in an else body runs if all the tests before it were True. - Answer-a. Which of the following results in a call to onKeyPress? a. Pressing the 'b' key. b. Releasing the 'b' key. c. Calling onKeyRelease('b') in a test case. d. All of the above. - Answer-a. Which of the following is drawn when we press the 'h' key and then release it? def onKeyPress(key): if (key == 'h'): Circle(200, 200, 20, fill='green') def onKeyRelease(key): Star(100, 200, 30, 7, fill='red') a. A green circle and red star are drawn. b. A green circle is drawn. c. A red star is drawn. d. Nothing is drawn. - Answer-a. Which of the following is the correct way to bring a circle named c to the front of the canvas?
Document information
- Uploaded on
- March 13, 2024
- Number of pages
- 3
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers