Programming Final

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/74

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

75 Terms

1
New cards

A practical difference between strings and integers is that

You can do math on integers but not strings

2
New cards

greeting = “hello world”

print(greeting[:4])

“hell”

3
New cards

In conditional testing using if statements, which keyword should be used to handle all the cases which do not match conditions being tested?

else

4
New cards

Which of the following creates a list

numbers = [1,2,3]

5
New cards

which of the following create a set

numbers = {1, 2, 3}

6
New cards

A set can have elements removed from it

True

7
New cards

movie = “ A New Hope”

movie[2:5]

8
New cards

numbers = [10,25,3,4]

for i in range(o,4):

print(_)

numbers[i]

9
New cards

a dictionary is meant for storing

a series of values, where each value is paired with a name or description

10
New cards

What is the correct syntax for defining a function in python

def functionName():

11
New cards

What is the difference between print() and return in a function

print() prints the output, while return sends a value back to the caller

12
New cards

by default, when looping through a dictionary, each item in a dictionary is a

key 

13
New cards

[{5,6,7}, {8,9,10}]

The structure above is a

list of sets 

14
New cards

An append method typically adds a value to

the end of list

15
New cards

What will the following code output

def my_function(x):

my_var = x*2

return my_var

answer = my_var(5)

print(answer)

10

16
New cards

What numbers would be generated by range (11,4,-3)

11,8,5

17
New cards

for i in range (50,10,10):

print(i,end= "")

what would the output be 

No output 

18
New cards

To test is a character is contained within a string, the best and easiest way to use the keyword 

in

19
New cards

What numbers would be generated by range(7,13,2)

7,9,11

20
New cards

phrase = "AZ AR AK CO IL WA PA"

the function calls return a total of 3 elements 

phrase.partition(" ")

21
New cards

state = "Pennsylvania"

which of the following will return the substring “Penn” in Python?

state[0:4]

22
New cards

person={"name": "John", "city":"Chicago")

to get a list containing "John" and "Chicago", use

person.values()

23
New cards

person={"name": "John", "city":"Chicago")

How would you change the city to "Pittsburgh"?

person['city'] = "Pittsburgh"

24
New cards

What will be the output of the following lines of code 

ssn="982-23-2324"

print(ssn.replace("-",""))

982232324

25
New cards

number_list = [5,10,15,20]

print(number_list[1]-1)

What would be the output of the statements above

9

26
New cards

How many numbers would be gnerated by the following range?

range(0,5,1)

5

27
New cards

for i in range (1,13,4):

print(i,end=" ")

1 5 9

28
New cards

list1 = [43,78,43,34]

list2 = [34,78,89]

set1 = set(list1)

set2 = set(list2)

set3 = {78, 908}

seta = set1.intersection(set2) 

What elements does SetA contain 

34 78

29
New cards

def describe_pet(animal_type, pet_name):

print(f "I have  a {animal_type}.") 

print(f "My {animal_type}’s name is {pet_name}.") 

What code would be used to call the function?

describe_pet(animal_type = "Dog", pet_name = "Charlie")

30
New cards

customers = [{‘name’:'Peter','Zip':'23467'},{‘name’:'Xia','Zip':'12344'}]

which code would give 

23467

12344

print(each_item['zip'])

31
New cards

my_list= [98,73,29,24,23]

Write code to print only those values less than or equal to 50. Format to 2 decimal places. 

print(each_item[<50].2f)

32
New cards

To link multiple tables together, you typically try to create a relationship between  _____.

Two columns with identical column names

33
New cards

In Tableau, a numeric float column from a CSV will typically be considered a ____

measure

34
New cards

To change the value in one cell, use ____.

df.loc[row, col ] = value

35
New cards

To make sure data change in a data source such as an Excel file is reflected in a Tableau visualization, connections to data sources should be configured as ____.

live

36
New cards

df['length'].isna() will return ___.

a boolean series

37
New cards

Which method can show you a variety of statistics for a DataFrame?

describe()

38
New cards

To open a CSV file in Pandas, use ___.

read_csv(url)

39
New cards

Abbreviate a Python module with a 'nickname' using the ____ keyword

as

40
New cards

Data about data is known as _____.

metadata

41
New cards

Add a reference to a python library using the keyword ____.

import

42
New cards

Which of the following can properly drop a column 'name'?

df.drop(columns='name')

43
New cards

Rows and columns of data are represented as a _____, in Pandas.

DataFrame

44
New cards

Which of the following drops row with index 250 correctly?

df2 = df.drop(index=250)

45
New cards

The first 5 rows of data in a DataFrame could be seen using ___.

head(5)

46
New cards

In Python method that has a loop, the return keyword should ideally be placed inside the for loop.

False 

47
New cards

For the code below, what would be printed out?

person = {"name": "John","city": "Chicago", }

for each_item in person:

print(each_item)

name

city

48
New cards

Two sets are being joined, Set 1 and Set 2. What method would join these sets such that it includes all elements of Set 1 and Set 2?

union

49
New cards

person={"name": "John", "city":"Chicago")

to get a list containing "name" and "city", use

person.keys()

50
New cards

A list can have elements added to it 

True

51
New cards

How many partitions will result from the following?

line = "Mary had a little lamb"

partitions = line.partition(" ")

3

52
New cards

number_list  = [5, 10, 15, 20]

print(number_list[3])

What would be the output of the statements above?

20

53
New cards

Which of the following creates a tuple?

numbers = (1, 2, 3)

54
New cards

Which of the following is a correct formulation of an if statement that tests if x is greater than 10.

if x > 10:

print("x is greater than 10")

55
New cards

You can test multiple conditions in Python conditional statements using ____ keyword

elif

56
New cards

A boolean value can have up to _ different values.

2

57
New cards

% is the ____ operator.

remainder

58
New cards

The value 34.23 should be a ____ type in Python.

float

59
New cards

= FunctionA ( FunctionB ( 2, 2.5 ) )

First the Inside function FunctionB, then the outside function FunctionA

60
New cards

Assume a formula in a cell C2 has the cell reference $A2.
The formula is copied over to the cell D3.
The formula in D3 will be  ____.

$A3

61
New cards

Assume a formula in a cell B2 has the cell reference $C2.
The formula is copied over to the cell B3.
The formula in D3 will be  ____.

$C3

62
New cards

To convert a cell to capitalize the first letter of each word in the cell text (convert the first letter of each word to uppercase), use function ____.

proper

63
New cards

A function with zero arguments requires parentheses.

True

64
New cards

If you want to visually emphasize data cells that meet a certain rule, use ___.

Conditional Formatting 

65
New cards

If you want to find out the number of times the value "In Stock" occurs in a column, use ____.

COUNTIF

66
New cards

A CSV is _____.

comma separated value

67
New cards

Which of the following is the correct way to write a formula to add up cells C1 through C3?

=Sum(C1:C3)

68
New cards

How many cells are included in B3:B9? Enter a numeral, e.g., 1 or 2

7

69
New cards

If Katya writes "Product(B2, 5)" into cell C2, she would see ____.

Product(B2, 5) displayed in cell C2.

70
New cards

In class, we discussed that a SSN Number__.

Should be treated like a Text because you don't want to do math on it

71
New cards

Considering the cell value "=Sum(C2:D3)", the range in the formula is ____

C2:D3

72
New cards
73
New cards
74
New cards
75
New cards