Quiz 02

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What is the value of the following expression: "12" + "34"

"1234" , a string

Given the following statement: line = 'The quick brown fox' What is the value of the following expression: line[2]

'e'

Given the following statement: x = 'he' What is the value of the following expression? Make sure to use quotes if your answer is a string. x * 3

'hehehe' "hehehe"

Given the following statement: word = 'conquistador' What is the value of the following expression? Make sure to use quotes if your answer is a string. word[3:8]

'quist' "quist"

Which operator raises a number to an exponent?

**

What is the value of the following expression: 5 % 2

1

What is the value of the following expression: 5 // 2

2

Given the following statement: x = 'cold' What is the value of the following expression? math.sqrt(len(x))

2.0 or 2

What is the value of the following expression:

2.5

What is the value of the following Python expression? 6 + 8 / 2 * (5 - 1)

22

Which expression would correctly evaluate to the square root of 9? 1. 9**1/2 2. 9**(1/2) 3. 9**(1.0/2.0) 4. Either b or c

4. Either b or c

Given the following statement: x = 'picture' What is the value of the following expression? len(x)

7

What is the second step of the program development cycle discussed in the supplemental reading?

Design the algorithm to solve the problem

What is displayed by the following code? phrase = "hello there" print( phrase, "student")

hello there student

In order to use the math module, which statement must we include in our file?

import math

This built-in function can be used to truncate a float value to an int value

int()

If a program runs but the results are incorrect, what type of error does the program contain?

logic error

If you wanted to use the value of Pi in your Python program, and you've imported the math module, what is the correct syntax?

math.pi

When you want to concatenate a string and a number, what function must you use?

str()

Given the Python statement: price = "99.0" what is the data type of the price variable?

string


Ensembles d'études connexes

History of Mass Communication and Culture revision

View Set

la possession (les composantes et les effets)

View Set

unit 8 Earth in Space vocabulary

View Set

Tumor Suppressor Genes and Oncogenes

View Set

Science: What does DNA look like?

View Set

Intro to Professional Nursing: Chapter 16 Client-Centered Care

View Set