Quiz 1
interactive mode
In which IPython interpreter mode do you enter small bits of Python code called snippets and immediately see their results? A. program mode B. interactive mode C. script mode D. None of the above
All of the above
Which of the following popular Python data science libraries are central to machine learning, deep learning and/or reinforcement learning: Select one: A. keras and tensorflow B. scikit-learn C. OpenAIGym D. All of the above
All of the above statements are true.
Which of the following statements a), b) or c) about the Jupyter Notebook is false? A. To execute the current cell's code, type Ctrl + Enter (or control + Enter).JupyterLab executes the code in IPython, then displays the results below the cell. B. By default, a new notebook contains one cell, but you can add more. C. The unit of work in a notebook is a cell in which you can enter code snippets. D. All of the above statements are true.
Bit
A(n) ________ is the smallest data item in a computer. It can have the value 0 or 1. Select one: A. field B. bit C. byte D. record
floating-point number
The value 10.5 is a(n) ________ (that is, a number with a decimal point). Select one: A. string B. integer C. floating-point number D. None of the above
Most exception names end with Exception.
Which of the following statements is false? Select one: A. Most exception names end with Exception. B. In IPython interactive mode, the line that begins with ----> shows the code that caused the exception. C. Python reports an exception with a traceback. D. Dividing by zero with / or // is not allowed and results in an exception-an indication that a problem occurred.
Every statement stops at the end of the line in which it begins.
Which of the following statements is false? Select one: A. Once x and y are created and assigned values, you can use the values in expressions like:x + y B. Variables store values for later use in your code. C. Every statement stops at the end of the line in which it begins. D. The following statement creates x and uses the assignment symbol (=) to give x a value. x = 7
The expression -13 // 4 evaluates to -3.
Which of the following statements is false? Select one: A. The expression -13 / 4 evaluates to -3.25. B. The expression -13 // 4 evaluates to -3. C. Floor division (//) divides a numerator by a denominator, yielding the highest integer that's not greater than the result. D. True division (/) divides a numerator by a denominator and yields a floating-point number with a decimal point.
The value of the following expression is 3: 17 % 5
Which of the following statements is false? Select one: A. You can use the remainder operator to determine whether a number is odd or even. B. The value of the following expression is 3: 17 % 5 C. The value of the following expression is 0.5: 7.5 % 3.5 D. You can use the remainder operator for applications such as determining whether one number is a multiple of another.
R
Python recently surpassed the programming language ________ as the most popular data-science programming language. Select one: A. R B. C++ C. DSPL D. Java
21.75
What value is produced when Python evaluates the following expression? 5 * (12.7 - 4) / 2 A. 29.5 B. 21.75 C. 21 D. None of the above.
Python is case insensitive, so number and Number are the same identifier despite the fact that one begins with a lowercase letter and the other begins with an uppercase letter.
Which of statements a), b) or c) is false? Select one: A. Python is case insensitive, so number and Number are the same identifier despite the fact that one begins with a lowercase letter and the other begins with an uppercase letter. B. A variable name, such as x, is an identifier. C. Each identifier may consist of letters, digits and underscores (_) but may not begin with a digit. D. All of the above statements are true.
All of the above.
Which of the following are reasons why Python is popular and everyone should consider learning it? Select one: A. It's easier to read than many other popular programming languages. B. It's open source, free and widely available with a massive open-source community. C. It's easier to learn than languages like C, C++, C# and Java, enabling novices and professional developers to get up to speed quickly. D. All of the above.
All of the above statements are true.
Which of the following statements a), b) or c) is false? A. The JupyterLab interface enables you to manage your notebook files and other files that your notebooks use (like images and videos). B. Jupyter Notebooks use IPython by default. C. The Anaconda Python Distribution comes with the Jupyter Notebook-an interactive, browser-based environment in which you can write and execute code and intermix the code with text, images and video. D. All of the above statements are true.
To square a number, you can use the exponent 1/2 (that is, 0.5), as in: 9 ** (1 / 2)
Which of the following statements a), b) or c) is false? Select one: A. Python uses the asterisk (*) as the multiplication operator (e.g., 7 * 4). B. To square a number, you can use the exponent 1/2 (that is, 0.5), as in: 9 ** (1 / 2) C. The exponentiation (**) operator raises one value to the power of another (e.g., 2 ** 10). D. All of the above statements are true.
Expressions containing an integer and a floating-point number are mixed-type expressions-these always produce an integer.
Which of the following statements about arithmetic operators is false? Select one: A. If both operands are integers, the result is an integer-except for the true-division (/) operator, which always yields a floating-point number. B. Expressions containing an integer and a floating-point number are mixed-type expressions-these always produce an integer. C. If both operands are floating-point numbers, the result is a floating-point number. D. Each arithmetic operator may be used with integers and floating-point numbers.
Rather than developing lots of original code-a costly and time-consuming process-you can simply create an object of a pre-existing library class, which takes only three Python statements.
Which of the following statements about libraries is false? Select one: A. Rather than developing lots of original code-a costly and time-consuming process-you can simply create an object of a pre-existing library class, which takes only three Python statements. B. Libraries help you perform significant tasks with modest amounts of code. C. Using existing libraries helps you avoid "reinventing the wheel," thus leveraging your program-development efforts. D. All of the above statements are false.
The parentheses in Part (b) above are redundant.
Which of the following statements is false? Select one: A. Algebraic expressions must be typed in straight-line form using Python's operators. B. The following code multiplies 10 times the quantity 5 + 3, yielding the result 80: 10 * (5 + 3) C. Parentheses in an expression are said to be redundant (unnecessary) if removing them yields the same result. D. The parentheses in Part (b) above are redundant.
If an expression contains several exponentiation operations, Python applies them from left to right.
Which of the following statements is false? Select one: A. In expressions with nested parentheses, such as (a/(b-c)), the expression in the innermost parentheses (that is, b-c) evaluates first. B. If an expression contains several exponentiation operations, Python applies them from left to right. C. Parentheses have the highest level of precedence, so expressions in parentheses evaluate first-thus, parentheses may force the order of evaluation to occur in any sequence you desire. D. Python applies the operators in arithmetic expressions according to the rules of operator precedence, which are generally the same as those in algebra.
In the following expression, the addition operators (+) group as if we parenthesized the expression as a+(b+c).
Which of the following statements is false? Select one: A. In the following expression, the addition operators (+) group as if we parenthesized the expression as a+(b+c). B. All Python operators of the same precedence group left-to-right except for the exponentiation operator (**), which groups right-to-left. C. You can use redundant parentheses to group subexpressions to make expressions clearer. For example, the second-degree polynomialy = a * x ** 2 + b * x + ccan be parenthesized, for clarity, asy = (a * (x ** 2)) + (b * x) + c D. When we say that Python applies certain operators from left to right, we are referring to the operators' grouping.