Python Midterm

Ace your homework & exams now with Quizwiz!

The proper style for variable names in Python is camelCase.

False

Variable names can have spaces.

False

A variable is really a pointer to an object

True

In Python, for variable names, lower case is frequently used.

True

In Python, for variable names, underscores can be used.

True

It is possible to change the data type of a variable.

True

The standard style in Python for variable names is lower case

True

This expression will yield which data type: False

bool

Choose the correct data type name in Python: bool, Boolean, boolean

correct: bool

Choose the correct data type name in Python: long, int, short, integer

correct: int

What is the name of the built-in function to read data from the user:

input()

name 8 built in functions

len(), input(), int(), print(), split(), bool(), map(), swapcase()

What is the name of the built-in function to display output:

print()

This expression will yield which data type: "python"

str

This expression will yield which data type: true

this will cause an error

Strings can be indicated with double quotes or single quotes.

true

Data types must be included in all variable declarations

False

The standard style in Python for variable names is camel case

False

This is a proper variable name: 1value

False

Data types must be mentioned when declaring variables.

True

Python is an interpreted language.

True

Python is case-sensitive.

True

Python will allow the data type for a variable to be changed

True

The standard style in Python for variable names is to use underscores when needed

True

Variable names cannot begin with a number

True

Variable names cannot have spaces

True

We can use single quotes or double quotes for strings.

True

We must state the data type of all variables

True

This expression will yield which data type: 'python'

str

This expression will yield which data type: 'true'

str

What is the name of the built-in function to convert a value to a string:

str()

- What data type must we always pass to the input() function?

string

Give an example of the result if we were to print what the type function returns?

string

What data type does the input() function always return?

string

All types in Python are considered to be "classes"

true

This is a proper variable name: value1

true

What are the two reserve words for bool?

true, false

What is the name of the built-in function to return the type of an object:

type()

Write the statement to ask the user to enter their name and save into a variable called username:

Username = input("Enter your name")

This expression will yield which data type: True

bool

Which of these is the valid Python data type: bool, char, double, short

correct: bool

Choose the correct data type name in Python: float, double, real

correct: float

Choose the correct data type name in Python: string, str, String

correct: str

This expression will yield which data type: 32.4

float

What is the name of the built-in function to convert a value to a floating-point number:

float()

This expression will yield which data type: 32

int

What is the name of the built-in function to convert a vlue to a whole number:

int()

name 5 built in data types

integers, strings, complex numbers, boolean, floating point numbers


Related study sets

"First Aid- Chapter 11: Musculoskeletal Injuries"

View Set

Экономика организации предприятия

View Set

Economic and Business Statistics week 11+

View Set

Business & Government Relations Final

View Set