Computer Science > QUESTIONS & ANSWERS > Questions and Answers > University of the People - AY 2019: CS 1101 - AY2019-T4 Graded Quiz Unit 3.  (All)

Questions and Answers > University of the People - AY 2019: CS 1101 - AY2019-T4 Graded Quiz Unit 3. With all the correct answers provided.

Document Content and Description Below

CS 1101 - AY2019-T4 Graded Quiz Unit 3 Question 1 In Mark 0.00 out of 1.00 Flag question Question text Consider the following text from a Python interpreter. >>> print(2 + 2) 4 What is the ... text ">>>" called? Select one: a. a function b. an operator c. a prompt d. a statement e. a value Question 2 In Mark 0.00 out of 1.00 Flag question Question text Which one of the following Python expressions has the value 64? Select one: a. 8 ^ 2 b. 8 ** 2 c. 8 +- 2 d. 8 += 2 e. 8 -+ 2 Question 3 In Mark 0.00 out of 1.00 Flag question Question text What is python’s response to the command: type("0.123") Select one: a. <class 'float'> b. <class 'bool'> c. SyntaxError: invalid syntax d. <class 'int'> e. <class 'str'> Question 4 In Mark 0.00 out of 1.00 Flag question Question text Consider the following text from a Python interpreter. >>> print(2 + 2) 4 What is the text "print" called? Select one: a. a function b. an operator c. a prompt d. a statement e. a value Question 5 Flag question Question text Which one of the following Python expressions computes the number of miles in 5 km, where one mile is 1.61 km? Select one: a. 5 * 1.61 b. 5 / 1.61 c. 1.61 / 5 d. 1.61 + 5 e. miles = "5 km" Question 6 Flag question Question text A program is a sequence of instructions that specifies how to perform a computation. Select one: True False Question 7 Flag question Question text string is a Python type that represents sequences of numeric values. Select one: True False Question 8 Flag question Question text Consider the following text from a Python interpreter. >>> print(2 + 2) 4 What is the text "+" called? Select one: a. a function b. an operator c. a prompt d. a statement e. a value Question 9 In Mark 0.00 out of 1.00 Flag question Question text Which one of the following Python expressions has the value 10? Select one: a. 8 ^ 2 b. 8 ** 2 c. 8 +- 2 d. 8 += 2 e. 8 -+ 2 Question 10 Flag question Question text What does the following text indicate in a Python interpreter? >>> Select one: a. A syntax error has occurred. b. One value is much greater than another. c. Shift a value to the right. d. The interpreter is ready for you to enter code. e. The emoji for "food chain". Question 1 Flag question Question text Which one of the following Python expressions computes the total number of seconds in 21 minutes and 21 seconds? Select one: a. 21 + 21 b. 21 + 60 c. "21 minutes" + "21 seconds" d. 21 * 60 + 21 e. seconds = 21 + "21 minutes" Question 2 Flag question Question text What is Python’s response to the command: type(123) Select one: a. <class 'float'> b. <class 'bool'> c. SyntaxError: invalid syntax d. <class 'int'> e. <class 'str'> Question 3 In Mark 0.00 out of 1.00 Flag question Question text Portability means the program is written in small chunks of code. Select one: True False Question 4 Flag question Question text Consider the following text from a Python interpreter. >>> print(2 + 2) 4 What is the text "print(2 + 2)" called? Select one: a. a function b. an operator c. a prompt d. a statement e. a value Question 5 Flag question Question text What is Python’s response to the command: type(0.123) Select one: a. <class 'float'> b. <class 'bool'> c. SyntaxError: invalid syntax d. <class 'int'> e. <class 'str'> Question 6 Flag question Question text Programming languages are ______ languages that have been designed to express computations. Select one: a. informal b. mathematical c. formal d. natural e. logical Question 7 Flag question Question text Which of the following is not a valid Python numeric literal: Select one: a. 123 b. 0123 c. 0.00 d. 12.3 e. 0.75 Question 8 In Mark 0.00 out of 1.00 Flag question Question text What does the Python interpreter output for the following input? >>> 1,234.567,890 Select one: a. 1234 b. 1234.6 c. 1234.56789 d. (1, 234.567, 890) e. SyntaxError: invalid token Question 9 Flag question Question text True or False: Learning to debug can be frustrating, but it is a valuable skill that is useful for many activities beyond programming. Select one: True False Question 10 Flag question Question text Consider the following text from a Python interpreter. >>> print(2 + 2) 4 What is the text "4" called? Select one: a. a function b. an operator c. a prompt d. a statement e. a value Question 1 In Mark 0.00 out of 1.00 Flag question Question text Which one of the following words best describes formal languages? Select one: a. ambiguity b. literalness c. poetry d. prose e. redundancy Question 2 In Mark 0.00 out of 1.00 Flag question Question text Which one of the following Python expressions generates a syntax error? Select one: a. 8 ^ 2 b. 8 ** 2 c. 8 +- 2 d. 8 += 2 e. 8 -+ 2 Question 3 Partially Mark 0.73 out of 1.00 Flag question Question text Match concepts with their definition! An error in a program. Answer 1 The process of finding and removing any of the three kinds of programming errors. Answer 2 Any one of the languages that people have designed for specific purposes, such as representing mathematical ideas or computer programs; all programming languages are these kinds of languages. Answer 3 A programming language like Python that is designed to be easy for humans to read and write. Answer 4 A program that reads another program and executes it. Answer 5 A programming language that is designed to be easy for a computer to execute; also called machine language or assembly language. Answer 6 Any one of the languages that people speak that evolved naturally. Answer 7 To examine a program and analyze the syntactic structure. Answer 8 A property of a program that can run on more than one kind of computer. Answer 9 An instruction that causes the Python interpreter to display a value on the screen. Answer 10 The process of formulating a problem, finding a solution, and expressing the solution. Answer 11 A sequence of instructions that specifies to a computer actions and computations to be performed. Answer 12 A program stored in a file (usually one that will be interpreted). Answer 13 The structure of a program. Answer 14 One of the basic elements of the syntactic structure of a program, analogous to a word in a natural language. Answer 15 Question 4 Flag question Question text Which of the following is not a valid Python numeric literal: Select one: a. 123 b. 0123 c. 0.00 d. 12.3 e. 0.75 0123 Question 5 Flag question Question text Programming languages are ______ languages that have been designed to express computations. Select one: a. informal b. mathematical c. formal d. natural e. logical Question 6 In Mark 0.00 out of 1.00 Flag question Question text Which one of the following Python expressions has the value 64? Select one: a. 8 ^ 2 b. 8 ** 2 c. 8 +- 2 d. 8 += 2 e. 8 -+ 2 Question 7 Flag question Question text Consider the following text from a Python interpreter. >>> print(2 + 2) 4 What is the text "+" called? Select one: a. a function b. an operator c. a prompt d. a statement e. a value Flag question Question text What does the following text indicate in a Python interpreter? >>> Select one: a. A syntax error has occurred. b. One value is much greater than another. c. Shift a value to the right. d. The interpreter is ready for you to enter code. e. The emoji for "food chain". Question 9 Flag question Question text What is Python’s response to the command: type(123) Select one: a. <class 'float'> b. <class 'bool'> c. SyntaxError: invalid syntax d. <class 'int'> e. <class 'str'> Question 10 Flag question Question text A program is a sequence of instructions that specifies how to perform a computation. Select one: True False Question 1 Flag question Question text Which one of the following words best describes formal languages? Select one: a. ambiguity b. literalness c. poetry d. prose e. redundancy Question 2 Flag question Question text What is python’s response to the command: type("0.123") Select one: a. <class 'float'> b. <class 'bool'> c. SyntaxError: invalid syntax d. <class 'int'> e. <class 'str'> Question 3 Flag question Question text What is Python’s response to the command: type(0.123) Select one: a. <class 'float'> b. <class 'bool'> c. SyntaxError: invalid syntax d. <class 'int'> e. <class 'str'> Question 4 Flag question Question text string is a Python type that represents sequences of numeric values. Select one: True False Question 5 Flag question Question text True or False: Learning to debug can be frustrating, but it is a valuable skill that is useful for many activities beyond programming. Select one: True False Question 6 Flag question Question text Portability means the program is written in small chunks of code. Select one: True False Question 7 Flag question Question text Which one of the following Python expressions computes the total number of seconds in 21 minutes and 21 seconds? Select one: a. 21 + 21 b. 21 + 60 c. "21 minutes" + "21 seconds" d. 21 * 60 + 21 e. seconds = 21 + "21 minutes" Question 8 Flag question Question text Which one of the following Python expressions computes the number of miles in 5 km, where one mile is 1.61 km? Select one: a. 5 * 1.61 b. 5 / 1.61 c. 1.61 / 5 d. 1.61 + 5 e. miles = "5 km" Question 9 Flag question Question text Consider the following text from a Python interpreter. >>> print(2 + 2) 4 What is the text "4" called? Select one: a. a function b. an operator c. a prompt d. a statement e. a value Question 10 Partially Mark 0.87 out of 1.00 Flag question Question text Match concepts with their definition! An error in a program. Answer 1 The process of finding and removing any of the three kinds of programming errors. Answer 2 Any one of the languages that people have designed for specific purposes, such as representing mathematical ideas or computer programs; all programming languages are these kinds of languages. Answer 3 A programming language like Python that is designed to be easy for humans to read and write. Answer 4 A program that reads another program and executes it. Answer 5 A programming language that is designed to be easy for a computer to execute; also called machine language or assembly language. Answer 6 Any one of the languages that people speak that evolved naturally. Answer 7 To examine a program and analyze the syntactic structure. Answer 8 A property of a program that can run on more than one kind of computer. Answer 9 An instruction that causes the Python interpreter to display a value on the screen. Answer 10 The process of formulating a problem, finding a solution, and expressing the solution. Answer 11 A sequence of instructions that specifies to a computer actions and computations to be performed. Answer 12 A program stored in a file (usually one that will be interpreted). Answer 13 The structure of a program. Answer 14 One of the basic elements of the syntactic structure of a program, analogous to a word in a natural language. Answer 15 Question 1 In Mark 0.00 out of 1.00 Flag question Question text What output will the following Python statements produce? >>> print ((1+1)**(5-2)) Select one: a. 16 b. 8 c. 4 d. 2 8 Question 2 In Mark 0.00 out of 1.00 Flag question Question text Using Python keywords for variable names will result in a ________________ Select one: a. runtime error b. compile error c. syntax error d. semantic error Question 3 In Mark 0.00 out of 1.00 Flag question Question text Which of the following is an invalid Python assignment statement? Select one: a. a = b = 123 b. ‘3’ = 3 c. x = int(“123”) d. y = None e. z = “hi” * 10 Question 4 Flag question Question text An expression is a combination of values, variables, and operators. If you type an expression on the command line, the interpreter evaluates it and displays the result. Select one: True False Question 5 In Mark 0.00 out of 1.00 Flag question Question text The acronym PEMDAS is a way to remember the order of operations in Python. Select one: True False Question 6 In Mark 0.00 out of 1.00 Flag question Question text When defining a Python function that has no parameters, the parentheses that follow the function’s name are optional. Select one: True False Question 7 In Mark 0.00 out of 1.00 Flag question Question text What is the output of the following statements? pi = float(3.14159) print (pi) Select one: a. 3 b. 3.0 c. 3.14159 d. 0 Question 8 In Mark 0.00 out of 1.00 Flag question Question text In Python, the ‘+’ operator can be used with numbers and with strings. What is a property that number addition has, but string concatenation does not? Select one: a. numeric addition is allowed on right-hand side of assignment statement b. more than one numeric addition per expression is allowed c. expression value does not depend on the order of numeric addition operands d. numeric addition is fast to execute e. numeric addition needs 2 operands Question 9 Flag question Question text What output will the following Python statement produce? >>> print ((1,000,000)) Select one: a. 1,000 b. 1,000,000 c. (1, 0, 0) d. Error invalid type Question 10 Flag question Question text Python functions may or may not take arguments and may or may not return a result. Select one: True False Question 1 In Mark 0.00 out of 1.00 Flag question Question text When a Python function is called, inside the function, the arguments are assigned to variables called parameters. Select one: True False Question 2 Flag question Question text An error that is detected while the program is running is referred to as: Select one: a. a syntax error b. an exception c. a compilation error d. a semantic error e. a late error Question 3 In Mark 0.00 out of 1.00 Flag question Question text What is the output of the Python code below when run in script mode? y = 3 x = 5 x + y “x + y” Select one: a. 8 b. x + y c. no output d. run-time error e. compile error Question 4 In Mark 0.00 out of 1.00 Flag question Question text What output will the following Python statements produce? >>> n = 17 >>> print (n) Select one: a. (n) b. 17.0 c. n d. 17 17 Question 5 In Mark 0.00 out of 1.00 Flag question Question text What do we call the value provided to a function when the function is called (which is assigned to the corresponding parameter in the function)? Select one: a. argument b. return value c. method d. the special value None e. global variable Question 6 In Mark 0.00 out of 1.00 Flag question Question text 1. What is the output of the code below assuming that global variable x has value 2 and global y has value 3? def f1(): return "ab" def f2(): return f1() * x def f3(): return f2() + f1() * y print(f3()) Select one: a. ababababababababab b. abababababab c. abababab d. ababab e. ababababab Question 7 In Mark 0.00 out of 1.00 Flag question Question text Programmers generally choose names for their variables that are meaningful and document what the variable is used for. Select one: True False Question 8 In Mark 0.00 out of 1.00 Flag question Question text What output will the following Python statements produce? >>>percentage = ( 60.0 * 100.0 ) / 55.0 >>>print (percentage) Select one: a. percentage b. 109 c. 109.0909090909091 d. 109.0 Question 9 Flag question Question text What output will the following Python statements produce? >>> print (2*(3 - 1)) Select one: a. 6 b. 5 c. 4 d. 3 4 Question 10 Flag question Question text A program is a sequence of instructions that specifies how to perform a computation. Select one: True False Question 1 In Mark 0.00 out of 1.00 Flag question Question text In Python, the expression “a ** (b ** c)” is the same as “(a ** b) Select one: True False Question 2 Partially Mark 0.07 out of 1.00 Flag question Question text Match concepts with their definition! A statement that creates a new variable and gives it a value. Answer 1 Information in a program that is meant for other programmers (or anyone reading the source code) and has no effect on the execution of the program. Answer 2 The ability to combine simple expressions and statements into compound statements and expressions in order to represent complex computations concisely. Answer 3 To join two operands end-to-end. Answer 4 What the Python interpreter does to an expression to find its value. Answer 5 A combination of variables, operators, and values that represents a single result value. Answer 6 A Python data type that stores floating-point numbers. Answer 7 A Python data type that holds positive and negative whole numbers. Answer 8 A reserved word that is used by the interpreter to parse programs. Answer 9 One of the values on which an operator operates. Answer 10 A special symbol that represents a simple computation like addition, multiplication, or string concatenation. Answer 11 A unit of code that the Python interpreter can execute. Answer 12 A Python data type that holds a string of characters. Answer 13 A number or letter that can be stored in a variable or evaluated in an expression. Answer 14 A name that refers to a value. Answer 15 Question 3 Flag question Question text In a script, an expression all by itself is a legal statement, but it does not do anything. Select one: True False Question 4 Flag question Question text A property of a program that can run on more than one kind of computer is called portability. Select one: True False Question 5 Flag question Question text The * operator also works on strings for which it performs repetition. Select one: True False Question 6 Flag question Question text What is the output of the following statements? pi = int(3.14159) print (pi) Select one: a. 3 b. 3.0 c. 3.14159 d. 0 3 Question 7 In Mark 0.00 out of 1.00 Flag question Question text What output will the following Python statements produce? >>> print (2*3-1) Select one: a. 6 b. 5 c. 4 d. 3 5 Question 8 Flag question Question text A script usually contains a sequence of statements. If there is more than one statement, the results appear one at a time as the statements execute. Select one: True False Question 9 Flag question Question text As programs get bigger and more complicated, they get more difficult to read. This is one reason why programmers should use comments in their code. Select one: True False Question 10 In Mark 0.00 out of 1.00 Flag question Question text What is the output of the following statements? pi = float(3.14159) print (pi) Select one: a. 3 b. 3.0 c. 3.14159 d. 0 Question 1 In Mark 0.00 out of 1.00 Flag question Question text What is the output of the following statements? pi = int(3.14159) print (pi) Select one: a. 3 b. 3.0 c. 3.14159 d. 0 3 Question 2 In Mark 0.00 out of 1.00 Flag question Question text What output will the following Python statement produce? >>> print ((1,000,000)) Select one: a. 1,000 b. 1,000,000 c. (1, 0, 0) d. Error invalid type Question 3 Flag question Question text The * operator also works on strings for which it performs repetition. Select one: True False Question 4 Flag question Question text An expression is a combination of values, variables, and operators. If you type an expression on the command line, the interpreter evaluates it and displays the result. Select one: True False Question 5 Flag question Question text In a script, an expression all by itself is a legal statement, but it does not do anything. Select one: True False Question 6 Flag question Question text The acronym PEMDAS is a way to remember the order of operations in Python. Select one: True False Question 7 Flag question Question text As programs get bigger and more complicated, they get more difficult to read. This is one reason why programmers should use comments in their code. Select one: True False Question 8 In Mark 0.00 out of 1.00 Flag question Question text What output will the following Python statements produce? >>>percentage = ( 60.0 * 100.0 ) / 55.0 >>>print (percentage) Select one: a. percentage b. 109 c. 109.0909090909091 d. 109.0 Question 9 Partially Mark 0.07 out of 1.00 Flag question Question text Match concepts with their definition! A statement that creates a new variable and gives it a value. Answer 1 Information in a program that is meant for other programmers (or anyone reading the source code) and has no effect on the execution of the program. Answer 2 The ability to combine simple expressions and statements into compound statements and expressions in order to represent complex computations concisely. Answer 3 To join two operands end-to-end. Answer 4 What the Python interpreter does to an expression to find its value. Answer 5 A combination of variables, operators, and values that represents a single result value. Answer 6 A Python data type that stores floating-point numbers. Answer 7 A Python data type that holds positive and negative whole numbers. Answer 8 A reserved word that is used by the interpreter to parse programs. Answer 9 One of the values on which an operator operates. Answer 10 A special symbol that represents a simple computation like addition, multiplication, or string concatenation. Answer 11 A unit of code that the Python interpreter can execute. Answer 12 A Python data type that holds a string of characters. Answer 13 A number or letter that can be stored in a variable or evaluated in an expression. Answer 14 A name that refers to a value. Answer 15 Question 10 In Mark 0.00 out of 1.00 Flag question Question text What is the output of the Python code below when run in script mode? y = 3 x = 5 x + y “x + y” Select one: a. 8 b. x + y c. no output d. run-time error e. compile error Question 1 In Mark 0.00 out of 1.00 Flag question Question text One way to generalize a function is to replace a variable with a value. Select one: True False Question 2 Flag question Question text How many different values can a Boolean expression have? Select one: a. 3 b. 2 c. infinite number d. 1 e. not defined Question 3 Flag question Question text What output will the following python commands produce: x=1 y=2 if x == y: print (x, "and", y, "are equal") else: if x < y: print (x, "is less than", y) else: print (x, "is greater than", y) Select one: a. 1 and 2 are equal b. 1 is less than 2 c. 1 is greater than 2 d. 2 is greater than 1 Question 4 Flag question Question text What is the output of the following statements? pi = float(3.14159) print (pi) Select one: a. 3 b. 3.0 c. 3.14159 d. 0 Question 5 Partially Mark 0.60 out of 1.00 Flag question Question text Match the following terms and definitions The order in which statements are executed during a program run. Answer 1 The first part of a compound statement, begins with a keyword and ends with a colon ( : ) Answer 2 A statement that executes a function. It consists of the name of the function followed by a list of arguments enclosed in parentheses. Answer 3 A variable defined inside a function that can only be used inside its function. Answer 4 A graphical representation of functions, their variables, and the values to which they refer. Answer 5 Question 6 Flag question Question text What output will the following python command produce: >>> percentage = float ( 60 * 100) / 55 >>> print (percentage) Select one: a. percentage b. 109 c. 109.0909090909091 d. 109.0 Question 7 In Mark 0.00 out of 1.00 Flag question Question text Occasionally, it is useful to have a body of an if statement that does nothing. In that case, you can use the following statement: Select one: a. # do nothing b. 0 = 0 c. Null d. pass e. Void Question 8 In Mark 0.00 out of 1.00 Flag question Question text What is the output of the following Python statements? percentage = ( 60 * 100) // 55 print (percentage) Select one: a. percentage b. 109 c. 109.0909090909091 d. 109.0 Question 9 In Mark 0.00 out of 1.00 Flag question Question text What is the output of the following Python statements? def recurse(a): if (a == 0): print(a) else: recurse(a) recurse(1) Select one: a. 0 b. 1 c. no output d. RuntimeError: maximum recursion depth exceeded Question 10 In Mark 0.00 out of 1.00 Flag question Question text What is the output of the following Python statements? def recurse(a): if (a == 0): print(a) else: recurse(a) recurse(0) Select one: a. 0 b. 1 c. no output d. RuntimeError: maximum recursion depth exceeded What is the output of the following Python statements? x = 5 if x % 2 == 1: print (x) else: print (x, x%2) Select one: a. 5 b. (5, 1) c. 2 d. (5, 0) Question 2 Flag question Question text True/False: The % or modulus operator returns the remainder present when two integers do not divide evenly into one another Select one: True False Question 3 Flag question Question text If you assign the result a void function to a variable in Python, you get: Select one: a. an empty string b. the value -1 c. the value 0 d. the special value None e. an exception Question 4 Flag question Question text What output will the following python commands produce: x = 5 if x % 2 == 0: print (x) else: print (x, x%2) Select one: a. 5 b. 5 1 c. 2 d. 5 0 Question 5 In Mark 0.00 out of 1.00 Flag question Question text Expressions evaluate to either true or false. What will the output of the following code be when the expression “Ni!” is evaluated? if "Ni!": print ('We are the Knights who say, "Ni!"') else: print ("Stop it! No more of this!") Select one: a. Stop it! b. We are the Knights who say, "Ni!" c. Stop it! No more of this!" d. No output will be produced Question 6 Flag question Question text What is the output of the following statements? pi = int(3.14159) print (pi) Select one: a. 3 b. 3.0 c. 3.14159 d. 0 Question 7 Flag question Question text What is the output of the following Python statements? pi = int(3.14159) print (pi) Select one: a. 3 b. 3.0 c. 3.14159 d. 0 Question 8 Flag question Question text Functions allow the programmer to encapsulate and generalize sections of code. Select one: True False Question 9 Flag question Question text Match the following terms and definitions The order in which statements are executed during a program run. Answer 1 The first part of a compound statement, begins with a keyword and ends with a colon ( : ) Answer 2 A statement that executes a function. It consists of the name of the function followed by a list of arguments enclosed in parentheses. Answer 3 A variable defined inside a function that can only be used inside its function. Answer 4 A graphical representation of functions, their variables, and the values to which they refer. Answer 5 Question 10 Flag question Question text What output will the following python commands produce: x=1 y=2 if x == y: print (x, "and", y, "are equal") else: if x < y: print (x, "is less than", y) else: print (x, "is greater than", y) Select one: a. 1 and 2 are equal b. 1 is less than 2 c. 1 is greater than 2 d. 2 is greater than 1 Question 1 Flag question Question text What is the output of the following Python statements? x = 5 if x % 2 == 1: print (x) else: print (x, x%2) Select one: a. 5 b. (5, 1) c. 2 d. (5, 0) Question 2 Flag question Question text Occasionally, it is useful to have a body of an if statement that does nothing. In that case, you can use the following statement: Select one: a. # do nothing b. 0 = 0 c. Null d. pass e. Void Question 3 Flag question Question text What is the output of the following statements? pi = int(3.14159) print (pi) Select one: a. 3 b. 3.0 c. 3.14159 d. 0 Question 4 Flag question Question text What is the output of the following Python statements? pi = int(3.14159) print (pi) Select one: a. 3 b. 3.0 c. 3.14159 d. 0 Question 5 Flag question Question text What is the output of the following Python statements? def recurse(a): if (a == 0): print(a) else: recurse(a) recurse(1) Select one: a. 0 b. 1 c. no output d. RuntimeError: maximum recursion depth exceeded Question 6 Flag question Question text Functions allow the programmer to encapsulate and generalize sections of code. Select one: True False Question 7 Flag question Question text True/False: The % or modulus operator returns the remainder present when two integers do not divide evenly into one another Select one: True False Question 8 Flag question Question text One way to generalize a function is to replace a variable with a value. Select one: True False Question 9 Flag question Question text What is the output of the following Python statements? percentage = ( 60 * 100) // 55 print (percentage) Select one: a. percentage b. 109 c. 109.0909090909091 d. 109.0 Question 10 Flag question Question text What output will the following python commands produce: x = 5 if x % 2 == 0: print (x) else: print (x, x%2) Select one: a. 5 b. 5 1 c. 2 d. 5 0 Question 1 Flag question Question text If you assign the result a void function to a variable in Python, you get: Select one: a. an empty string b. the value -1 c. the value 0 d. the special value None e. an exception Question 2 Flag question Question text What output will the following python command produce: >>> percentage = float ( 60 * 100) / 55 >>> print (percentage) Select one: a. percentage b. 109 c. 109.0909090909091 d. 109.0 Question 3 Flag question Question text What is the output of the following statements? pi = float(3.14159) print (pi) Select one: a. 3 b. 3.0 c. 3.14159 d. 0 Question 4 Flag question Question text Expressions evaluate to either true or false. What will the output of the following code be when the expression “Ni!” is evaluated? if "Ni!": print ('We are the Knights who say, "Ni!"') else: print ("Stop it! No more of this!") Select one: a. Stop it! b. We are the Knights who say, "Ni!" c. Stop it! No more of this!" d. No output will be produced Question 5 In Mark 0.00 out of 1.00 Flag question Question text What is the output of the following Python statements? def recurse(a): if (a == 0): print(a) else: recurse(a) recurse(0) Select one: a. 0 b. 1 c. no output d. RuntimeError: maximum recursion depth exceeded Question 6 Flag question Question text How many different values can a Boolean expression have? Select one: a. 3 b. 2 c. infinite number d. 1 e. not defined Question 7 Flag question Question text What output will the following python commands produce: x = 5 if x % 2 == 0: print (x) else: print (x, x%2) Select one: a. 5 b. 5 1 c. 2 d. 5 0 Question 8 Flag question Question text What is the output of the following Python statements? def recurse(a): if (a == 0): print(a) else: recurse(a) recurse(1) Select one: a. 0 b. 1 c. no output d. RuntimeError: maximum recursion depth exceeded Question 9 Flag question Question text What is the output of the following statements? pi = int(3.14159) print (pi) Select one: a. 3 b. 3.0 c. 3.14159 d. 0 Question 10 In Mark 0.00 out of 1.00 Flag question Question text Functions allow the programmer to encapsulate and generalize sections of code. Select one: True False Question 1 Flag question Question text What is the output of the following statements? pi = float(3.14159) print (pi) Select one: a. 3 b. 3.0 c. 3.14159 d. 0 Question 2 Flag question Question text Match the following terms and definitions The order in which statements are executed during a program run. Answer 1 The first part of a compound statement, begins with a keyword and ends with a colon ( : ) Answer 2 A statement that executes a function. It consists of the name of the function followed by a list of arguments enclosed in parentheses. Answer 3 A variable defined inside a function that can only be used inside its function. Answer 4 A graphical representation of functions, their variables, and the values to which they refer. Answer 5 Question 3 Flag question Question text How many different values can a Boolean expression have? Select one: a. 3 b. 2 c. infinite number d. 1 e. not defined Question 4 Flag question Question text What is the output of the following Python statements? x = 5 if x % 2 == 1: print (x) else: print (x, x%2) Select one: a. 5 b. (5, 1) c. 2 d. (5, 0) Question 5 Flag question Question text If you assign the result a void function to a variable in Python, you get: Select one: a. an empty string b. the value -1 c. the value 0 d. the special value None e. an exception Question 6 Flag question Question text One way to generalize a function is to replace a variable with a value. Select one: True False Question 7 Flag question Question text Occasionally, it is useful to have a body of an if statement that does nothing. In that case, you can use the following statement: Select one: a. # do nothing b. 0 = 0 c. Null d. pass e. Void Question 8 Flag question Question text What is the output of the following Python statements? pi = int(3.14159) print (pi) Select one: a. 3 b. 3.0 c. 3.14159 d. 0 Question 9 Flag question Question text What is the output of the following Python statements? percentage = ( 60 * 100) // 55 print (percentage) Select one: a. percentage b. 109 c. 109.0909090909091 d. 109.0 Question 10 Flag question Question text What output will the following python command produce: >>> percentage = float ( 60 * 100) / 55 >>> print (percentage) Select one: a. percentage b. 109 c. 109.0909090909091 d. 109.0 [Show More]

Last updated: 2 years ago

Preview 1 out of 69 pages

Buy Now

Instant download

We Accept:

We Accept
document-preview

Buy this document to get the full access instantly

Instant Download Access after purchase

Buy Now

Instant download

We Accept:

We Accept

Reviews( 0 )

$13.00

Buy Now

We Accept:

We Accept

Instant download

Can't find what you want? Try our AI powered Search

352
0

Document information


Connected school, study & course


About the document


Uploaded On

Dec 01, 2020

Number of pages

69

Written in

Seller


seller-icon
QuizMaster

Member since 6 years

1187 Documents Sold

Reviews Received
185
56
29
11
17
Additional information

This document has been written for:

Uploaded

Dec 01, 2020

Downloads

 0

Views

 352

Document Keyword Tags


$13.00
What is Scholarfriends

In Scholarfriends, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.

We are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Scholarfriends · High quality services·