Variables and Data Types

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

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

list2=['computer science', 'math', 'psychology'] list4=('summer', 'fall', 'winter', 'spring') list5=[52, 24, 71, 72, 56]

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

tup1=('computer science', 'math', 'psychology') tup2="Programming 101", "Intro to Python" tup4=('laptop', 'computer', 'hard drive')

Use the drop-down menus to correctly complete these sentences about common data types. A variable that is used in programming and can hold a true or false value is a(n) global ___ data type. A variable that can hold a mixed sequence of letters and numbers is a(n) ___ data type. A variable that can hold positive or negative whole-number values is a(n) ___ data type. A variable that can be used with moveable decimal points is a(n) ___ data type.

✔ Boolean ✔ alphanumeric string ✔ integer ✔ floating-point number

Use the drop-down menu to correctly complete these sentences about the five standard Python data types. ____ are numeric values in Python data types. A ___ is a large and changeable list that can contain any number of Python objects. ____ are connected sets of characters separated by quotation marks " ". ____ are sets of data separated by a comma between two parenthesis ( ). ____ are sets of data separated by a comma between two brackets [ ].

✔ Numbers ✔ dictionary ✔ Strings ✔ Tuples ✔ Lists

Use the drop-down menus to correctly complete these sentences about how variables can be defined. ____ types are single numbers or values, which may include integers, floating-point decimals, or strings of characters. A(n) ___ is a group of scalar or individual values that are stored in one entity. A(n) ___ is a data type that is assigned a true or false value by a programmer. A(n) ___ is a data type that can be assigned multiple values.

✔ Scalar values ✔ array ✔ user-defined type ✔ abstract data type

Identify Characteristics of Python Data Types Which of these are characteristics of a Python data type? Check all that apply.

A Python data type is weakly typed. A Python data type can have numeric values. A Python data type can be shown by keys and values within brackets [ ]. A Python data type can be a string, a list, or a tuple with items that can be repeated using the asterisk ( * ). A Python data type can be a dictionary that can be updated, changed, or removed.

Identify the correct characteristics of a Python dictionary. Check all that apply.

A Python dictionary is a container. A Python dictionary has keys and corresponding values. A Python dictionary is enclosed in curly braces { }. A Python dictionary can store any combination of Python objects.

Which of the following statements are true of an integer data type? Check all that apply.

It can be a whole number. It can be a negative number. It cannot hold a fraction or a decimal number.

Which of the following are characteristics of the Boolean data type? Check all that apply.

It uses operators such as AND, OR, and NOT. It holds a TRUE or FALSE value. It is named after a nineteenth-century mathematician and logician

Identify the correct characteristics of Python lists. Check all that apply.

Python lists contain items separated by commas. Python lists are versatile Python data types. Python lists may use single quotes, double quotes, or no quotes.

Identify the correct characteristics of Python numbers. Check all that apply.

Python numbers can be large integers. Python numbers can be complex values such as 12B16cd. Python numbers can be floating-point numbers. Python numbers have numeric values.

Identify the correct characteristics of Python strings. Check all that apply.

Python strings connect sets of characters inside quotation marks. Python strings can be used to store text. Python strings use either single quotes or double quotes.

Identify the correct characteristics of Python tuples. Check all that apply.

Python tuples are similar to Python lists. Python tuples are versatile. Python tuples are read-only lists.

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

They are accessible from anywhere in the program. They are accessible during the entire time the program is running.

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

Variables can be local or global. Variables have names, extents, and scopes.

Identify Facts about Variables and Values Which of the following statements about variables or values are true? Check all that apply.

Variables store values. Values are the result of functions.

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

dict = {'Name': 'Matthew', 'Age': 14, 'School': 'ABC School'}; dict = {'season': 'fall', 'weather': 'cool'};

Which of the following are common data types? Check all that apply.

integers characters floating point numbers Boolean alphanumeric strings

Complete each sentence by choosing the correct answer from the drop-down menu. The data type in a strongly typed language ___ before the variable can be used. An example of a strongly typed language is ___. The data type in a weakly typed language___ before the variable can be used. An example of a weakly typed language is ___.

✔ has to be stated ✔ JavaScript ✔does not have to be stated ✔Python

The ___ data type can hold whole positive and negative numbers. The terms TRUE and FALSE are usually associated with ___ data types. Values such as 9.0, -1245.1, and 0.777 are examples of ___data types.

✔ integer ✔ Boolean ✔ floating-point

Complete each statement by choosing the correct answer from the drop-down menu. An array can have more than one ____ User-defined types allow programmers to ___ The ___ of a variable means that the variable has a beginning and an ending in time. A(n) ___ is accessible only in a specific region of a program or within a declared function.

✔ scalar value ✔ define their own data type ✔ extent ✔ local variable


Ensembles d'études connexes

Ch. 1 Intro to the Internet and World Wide Web

View Set

Chapter 18 - Health Insurance Underwriting

View Set

Chapter 9: Operating System, Managing Coordinating and Monitoring Resources

View Set