Variables and Data Types Answers

20 verified answers3 views
1
Free Preview

Which of these are characteristics of variables? Check all that apply.

A
Variables can be local or global.
B
Variables cannot be changed.
C
Variables have keys and values within brackets [ ].
D
Variables have connected sets of characters.
E
Variables have names, extents, and scopes.
6

Which of the following are characteristics of global variables? Check all that apply.

A
They are accessible from anywhere in the program.
B
They are accessible only in specific regions of a program.
C
They are accessible only within a declared function.
D
They are accessible during the entire time the program is running.
7

Use the drop-down menus to correctly complete these sentences about how variables can be defined.✔ Scalar valuesArraysUser-defined typesAbstract data types are single numbers or values, which may include integers, floating-point decimals, or strings of characters.

Answers:
are single numbers or values, which may include integers, floating:Scalar values
is a group of scalar or individual values that are stored in one entity.:array
is a data type that is assigned a true or false value by a programmer.:user-defined type
is a data type that can be assigned multiple values.:abstract data type
9

Which of these are characteristics of a Python data type? Check all that apply.

A
A Python data type is weakly typed.
B
A Python data type can have numeric values.
C
A Python data type can be shown by keys and values within brackets [ ].
D
A Python data type must be stated before it can be used in a program.
E
A Python data type can be a string, a list, or a tuple with items that can be repeated using the asterisk ( * ).
F
A Python data type can be a dictionary that can be updated, changed, or removed.
G
A Python data type cannot have connecting sets of characters separated by commas.
10

Use the drop-down menu to correctly complete these sentences about the five standard Python data types.✔ NumbersStringsListsTuples are numeric values in Python data types.

Answers:
are numeric values in Python data types.:Numbers
is a large and changeable list that can contain any number of Python objects.:dictionary
are connected sets of characters separated by quotation marks " ".:Strings
are sets of data separated by a comma between two parenthesis ( ).:Tuples
are sets of data separated by a comma between two brackets [ ].:Lists
11

Which of these are correctly formatted Python lists? Check all that apply.

A
list1=(race, cars, trucks, bikes)
B
list2=[‘computer science’, ‘math’, ‘psychology’]
C
list3=[“Programming 101”, “Intro to Python”]
D
list4=(‘summer’, ‘fall’, ‘winter’, ‘spring’)
E
list5=[52, 24, 71, 72, 56]
12

Which of these are correctly formatted Python dictionaries? Check all that apply.

A
dict = {‘Name’: ‘Matthew’, ‘Age’: 14, ‘School’: ‘ABC School’};
B
dict = (‘Name’: ‘Mary’, ‘Age’: 13, ‘School’: ‘XYZ School’)
C
dict = [“Programming Basics”, “Introduction to Python”]
D
dict = {‘season’: ‘fall’, ‘weather’: ‘cool’};
E
dict = ’[‘laptop’, ‘computer’, ‘hard drive’]
13

Which of these are correctly formatted Python tuples? Check all that apply.

A
tup1=(‘computer science’, ‘math’, ‘psychology’)
B
list1=[“final”, “complete”, “finish”]
C
tup2=“Programming 101”, “Intro to Python”
D
tup3=[“MacBook”, “Dell”, “IBM”]
E
tup4=(‘laptop’, ‘computer’, ‘hard drive’)
14

Question text not available

Answers:
is a data type that is assigned a true or false value by a programmer.:user-defined type
is a data type that can be assigned multiple values.:abstract data type

Did you find these answers helpful?