Quiz 1

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Which of statements is false?

A variable name, such as x, is an name (identifier). Python is case insensitive, so studentID and studentId are the same identifier despite the fact that one begins with a lowercase letter and the other begins with an uppercase letter. Each identifier may consist of letters, digits and underscores (_) but may not begin with a digit. student_3 is a valid vairale name (identifier)

Which of the following statements is false?

If both operands are integers, the result is an integer�except for the true-division (/) operator, which always yields a floating-point number. Expressions containing an integer and a floating-point number are mixed-type expressions�these always produce an integer. Each arithmetic operator may be used with integers and floating-point numbers. If both operands are floating-point numbers, the result is a floating-point number.

Which of the following statements is false?

In expressions with nested parentheses, such as (a/(b-c)), the expression in the innermost parentheses (that is, b-c) evaluates first. Python applies the operators in arithmetic expressions according to the rules of operator precedence, which are generally the same as those in algebra. 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. If an expression contains multiplication and exponentiaition operations, Python applies them from left to right.

The value of the expression '7' + '3' is the ________.

String '10' Integer 10 Integer 73 string '73'

Which of the following statements is false?

The expression -13 / 4 evaluates to -3.25. True division (/) divides a numerator by a denominator and yields a floating-point number with a decimal point. Floor division (//) divides a numerator by a denominator, yielding the highest integer that's not greater than the result. The expression -13 // 4 evaluates to -3.

Which of the following statements is false?

The following assignment statement adds the values of variables x and y and assigns the result to the variable total: total = x + y The snippet in Part (a) is read, "total is assigned the value of x + y." The right side of the = symbol always executes first, then the result is assigned to the variable on the symbol's left side. You can write it as: x + y = total

Which of the following statements is false?

You can use the remainder operator for applications such as determining whether one number is a multiple of another. The value of the following expression is 3: 17 % 5 You can use the remainder operator to determine whether a number is odd or even. The value of the following expression is 0.5: 7.5 % 3.5

Triple-quoted strings are used to create:

multiline strings docstrings, which are the recommended way to document the purposes of certain program components. strings containing single or double quotes All of the above

Which of the following statements is false?

print does not display a string's quotes, though there is a way to display quotes in strings. When print completes its task, it positions the screen cursor at the beginning of the next line by default. Python uses \n to represent a tab character You also may enclose a string in double quotes (") like "Hello"

In a print statement, you can set the __________ argument to a space or empty string to stop the output from advancing to a new line.

stop end separator newLine


Set pelajaran terkait

PSY 200 Final Exam Question Bank

View Set

Scarcity, Choice, and Economic System

View Set

Match the term and definition (Prelab Exercise 5)

View Set

chapter 5 - marketing management

View Set

Unit 5 (chapter 22) History of Graphic Design

View Set