Engr 102 - Exam 1 Review Collection of quizzes an answers Latest Update - Exam Questions and 100% Verified Correct Answers Guaranteed A+ Verified by Professor
Application - CORRECT ANSWER: Another word for program.
Assembly Language - CORRECT ANSWER: Human-readable processor instructions
BOOLEAN - Operators
- not
- and
3. or - CORRECT ANSWER: 1. none #Not true returns false
- both #true and true returns true
- only one #true and false returns true
Compiler - CORRECT ANSWER: Translates a high-level language program into low-
level machine instructions.
Create a dictionary that stores the ages of Ed, Edd, and Eddy. Their ages are 11, 12, and 12, respectfully. - CORRECT ANSWER: eds_ages = { 'Ed' : 11
'Edd':12,
'Eddy':13
}
Create a list of number 1,9,5, and 2. Create a list of numbers 1-50 - CORRECT
ANSWER: nums_list = [ ]
for i in range(1, 50 + 1):
----nums_list.append(i) 1 / 3
Data type:
tuple - CORRECT ANSWER: An immutable container with ordered elements
Determine what type of loop to use for each of the following scenarios:
- Getting user input until they enter a certain value
- Approximating a function to a user-inputted number of terms
- Doing an operation on each element of a list
- Repeating an operation until the result is within a tolerance - CORRECT ANSWER: 1.
- For
- For
- While
While
Dictionary - CORRECT ANSWER: Iterable
Unordered collection key value { }
Division
' / ' - CORRECT ANSWER: Ex.
20 / 10 is 2.0.50 / 50 is 1.0.
- / 10 is 0.5.
Do lists start at index 0 or 1? - CORRECT ANSWER: Lists start at index 0
Do you spend more time typing of looking at code? - CORRECT ANSWER: Looking. 2 / 3
Edit the dictionary to reflect the passing of four years. (Add 4 to each age) - CORRECT ANSWER: for kid in eds_ages: ----eds_ages[kids]+=4
EXAMPLE:
List the three main conversion specifiers and write what the code would output - CORRECT ANSWER: print("I told her %d times that I have a %.2f percent success rate with any %s." % (7, 92.8, dog) >>>I told her 7 times that I have a 92.80 percent success rate with any dog
Floored division
' // ' - CORRECT ANSWER: Ex.
20 // 10 is 2.50 // 50 is 1.
- // 10 is 0. (5/10 is 0 and the remainder 5 is thrown away).
5.0 // 2 is 2.0
How can you translate your step-by-step plans into sections for your code? - CORRECT
ANSWER: Put the steps into code
How do we implement logic in python? - CORRECT ANSWER: Use conditionals
--> if/elif/else
How do you change the type of variable? - CORRECT ANSWER: Typecasting.
Use the desired type and then some parenthesis Ex. .float('72.6') return 72.6
How do you get a user to enter a string, integer, float, boolean? - CORRECT ANSWER: 1.String
- / 3