Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON - THANK YOU! ignore the blank boxes.... Which of the following function returns a sequence 0, 1, 2, 3? More than one answer may

PYTHON - THANK YOU! ignore the blank boxes....

Which of the following function returns a sequence 0, 1, 2, 3? More than one answer may apply.

range(0, 3)

range(0, 4)

range(3)

range(4)

  1. How many times will the following code print "Welcome to Python"?

    count = 0 while count < 10: print("Welcome to Python")

    8

    9

    10

    11

    infinite number of times

What values could x hold. ?

x = random()

0 < x < 1000

0 <= x <= 1

0 < x < 1

0 <= x < 1

A list ____.

is 3 variables concatenated together.

is a collection of values separated by commas and enclosed in curly braces that can be referred to with a single variable.

is a collection of values separated by commas and enclosed in square brackets that can be referred to with a single variable.

none of the above

____ is the format operator.

&

%

^

$

For-loops and loops that count through a range of numbers are also called ____ loops.

range-delimited

numbering

iterative

definite

Using the ____ statement within the body of a loop will cause an exit from the loop.

exit

break

stop

continue

What is the output for y?

y = 0

for i in range(5, 8): y += i print(y)

10

11

12

18

46

What happens when this runs?

x = -5 y = 9 m = 8 if x >1 or y < 15: m = 3

m = 8

m = 3

m = 5

m = -5

Which of the following relational operators are used correctly. Choose all that apply.

if (h =< 9)

if (m = 5)

if (x >= y)

if (p => v)

if (m <= k)

if (h != 15)

The user enters 44, 22, and 11, in that order. what is printed?

num1 = int(input("Enter a number: ")) num2 = int(input("Enter a number: ")) num3 = int(input("Enter a number: ")) if num1 > num2 : if num1 > num3 : print(num1) else : print(num3) else : if num2 > num3 : print(num2) else : print(num3)

0

11

22

44

What is the value held by the variable length in this statement.

length = len("Good Morning")

10

11

12

13

The function ____ returns a random whole number from among the numbers between the two argument a and b, inclusive.

randgen(a, b)

randrange(a, b)

random(a, b)

randint(a, b)

If temp = 20, then this expression,

if temp >= 32 and temp <= 100:

has the test short-circuited and the result is False

has both conditions tested and the result is True

What happens when the following code executes?

fn = "Monty" n = len(fn)

you get an error

n holds the value 5

n holds the value "Monty"

none of the above

Nested loops are often used to print tables of values

True

False

"In programming, a ____ consists of a set of values and a set of operations that can be performed on those values."

class

data structure

data type <-- pick this answer

literal

To use Python's random numbers you must first ____.

import random

import math

import crypto

both a and b above

What will the following loop print on the screen?

for count in range(4): print(count, end = " ")

0 1 2 3

1 2 3 4

3

4

To create an empty list you can use ____.

it can't be done

cars = [0]

cars = [None]

cars = []

Programmers create a ____ to save a value for later use.

number

character

variable

boolean

"The ____ data type consists of only two data values, true and false."

digital

binary

logical

Boolean

To add a data item to the end of a list you use the append() method.

True

False

What makes this expression 'short-circuit'?

if x > 0 and y < 8:

x = 0

y = 5

x = 5

y = 14

Consider this code. the variable named total in is called _____.

for x in range(7): total = total + 3

a locator

a sentinel

an accumulator

a capacitor

What is y?

y = round(5.64)

56

5

5.6

6

What happens when this runs?

x = 4 y = 11 m = 83 if (x < 0 or y > 12) and m == 83: m = 6 else: m = 4

m = 83

m = 6

m = 11

m = 4

What is the output for y?

y = 0 for i in range(10, 1, -2): y += i print(y)

10

40

30

20

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions