click below
click below
Normal Size Small Size show me how
Quiz 4
COP1000C into comp prog blended 621782
| Question | Answer |
|---|---|
| In python typing 2 equal signs like in this example means: if a == b: | is equal to |
| An expression that evaluates to either true or false is called | Boolean |
| A statement that controls the execution of other statements is called a super structure branch control structure boss structure | control structure |
| Placing a decision inside of another decision is indicated by spooning cloning procastination nesting | nesting |
| Which of the following statements is true? There is often more than one way to solve a problem but they are all equally efficient. There is often more than one way to solve a problem and some ways may be more efficient than others. | There is often more than one way to solve a problem and some ways may be more efficient than others. |
| Which of the following calculations would require the use of an if statement? | A program that asks a user to enter two values and adds up the even numbers between the first entered value and the second entered value including the first entered value but not including the second entered value. |
| What is the purpose of an if statement? | To assign a bool value. |
| Which of the following statements is true?There is often more than one way to solve a problem but they are all equally efficient. There is often more than one way to solve a problem and some ways may be more efficient than others. There is usually only | There is often more than one way to solve a problem and some ways may be more efficient than others. |
| Which of the following Python statements is invalid? Question 8 options: if x == 4: if 2 < x < 4: if x = 4: if x != 4: | if 2 < x < 4: |
| Which of the following statements is true? All except statements must have a corresponding try statement. A try statement may have multiple statements indented underneath it. none of the above | All except statements must have a corresponding try statement. |
| Which of the following statements are true?An if statement must have both an elif and an else statement. An if statement must have an elif statement. An if statement must have an else statement. else statement must have a matching if statement. | d |
| The best structure for implementing a multi-way decision in Python is Question 1 options: if-elif-else if try if-else | if- else-elif |
| What is the purpose of the statement if name == 1 main 1:? check if the name of a Python program is main check if a Python file was executed or imported It may be an error unless the program included a line that set name to a string | check if a Python file was executed or imported |
| What is the purpose of exception handling? Question 5 options: To handle errors gracefully so the program does not crash. none of the above To make a program crash. To make algorithms more efficient. | o handle errors gracefully so the program does not crash. |
| cannot be compared; only numbers may be compared strings are less than longer strings.Strings that begin with the letter 'a' are less than strings that begin with A.Strings that begin with the letter 'A' are less than strings that begin with the letter | |
| Which of the following statement A for loop may have an if statement nested inside it.An if statement may have another if statement indented beneath it.An if statement may have a for loop nested inside it | An if statement may have another if statement indented beneath it. |