Docsity

Python Programming Midterm Exam Study Guide, Exams of Programming Languages

Toggle sidebar
bg1
Programming Midterm Study Guide
1. True or False; 1,500 is a valid integer literal in Python.:
False
2. True or False; A variable associates a name with a value,
making it easy to remember and use the value later in a
program.: True
3. True or False; A while loop can be used for a count-
controlled loop.: True
4. True or False; An algorithm describes a process that ends
with a solution to a problem.: True
5. True or False; Computer scientists refer to the process of
planning and organizing a program as software
development.: True
6. True or False; Conditional iteration requires that a condition
be tested within the loop to determine whether the loop
should continue.: True
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Python Programming Midterm Exam Study Guide and more Exams Programming Languages in PDF only on Docsity!

Programming Midterm Study Guide

  1. True or False; 1,500 is a valid integer literal in Python.: False
  2. True or False; A variable associates a name with a value, making it easy to remember and use the value later in a program.: True
  3. True or False; A while loop can be used for a count- controlled loop.: True
  4. True or False; An algorithm describes a process that ends with a solution to a problem.: True
  5. True or False; Computer scientists refer to the process of planning and organizing a program as software development.: True
  6. True or False; Conditional iteration requires that a condition be tested within the loop to determine whether the loop should continue.: True
  1. True or False; Each individual instruction in an algorithm is well defined.: - False
  2. True or False; If A is True, what will the statement "not A" return?: False
  3. True or False; In Python, % is the exponentiation operator.: False
  4. True or False; In Python, = means equals, whereas == means assignment.- : False
  5. True or False; In Python, a floating-point number must be written using scientific notation.: False
  6. In Python, what data type is used to represent real numbers between -10^308 and 10^308 with 16 digits of precision?: float
  7. In Python, what does the "%" operator do in the expression 6 % 4?: It returns a remainder or modulus.
  1. Inside of a loop, after a termination condition has been met, what statement can be used to cause an exit from the loop and execute the remainder of the script?: break
  2. True or False; Loop statements allow a computer to make choices.: False
  3. Regardless of whether print is passed a single or multiple expressions, what does output always end with by default?: A newline.
  4. True or False; Simple Boolean expressions consist of the Boolean values True or False, variables bound to those values, function calls that return Boolean values, or comparisons.: True
  5. True or False; The + operator allows you to build a string by repeating another string a given number of times.: True
  6. True or False; The decimal number system is also called the base ten number system.: False
  1. True or False; The if-else statement is the most common type of selection statement.: True
  2. True or False; The not operator expects a single operand and returns its logical negation, True, if it's false, and False if it's true.: True
  3. True or False;The or operator returns True if and only if both of its operands are true, and returns False otherwise.: False
  4. True or False;The simplest form of selection is the if-else statement.: False
  5. True or False; The statements in the loop body need not be indented and aligned in the same column.: False
  6. True or False; The statements within a while loop can execute one or more times.: True
  7. True or False; The two digits in the base two number system are 0 and 1.: True
  1. What statement regarding the structure of strings is accurate?: A string is a sequence of zero or more characters.
  2. What would be the output if you were to print the variable named value as declared by this statement: value = "2" + "2"?:The string "22".
  3. Which of the following literals would be considered a float type in Python?- : 3.
  4. True or False; You can use parentheses to change the order of evaluation in an arithmetic expression.: True
  5. Which statement about the Python range() function is correct?:The itera- tive sequence produced by range(4, 12) is 4, 5, 6, 7, 8, 9, 10, 11.

Which pseudocode statement correctly initializes the Boolean variable paid_in_full using an assignment statement?:paid_in_full = True

What Python statement should you place in the blank to display "quiet" when this code executes? speech = "QUIET"

print(speech): speech = speech.lower()

  1. True or False; Using the int() function to convert floating- point numbers to integers may result in lost information.: True
  2. The operation 9 + 4 * 6 / 2 = 21 because of the order of operations. What mathematical expression produces an output of 39 by adding parentheses?- : (9 + 4) * 6 / 2
  3. The arithmetic operators used in mathematical expressions are as follows .: addition uses +, subtraction uses -, multiplication uses *, division uses /, and modulo division uses %
  4. Suppose you want to make sure that a person's middle initial is stored as an uppercase letter. What Python method