CS_105

Ace your homework & exams now with Quizwiz!

if s = 'the' what letter in the string does s[2] represent?

'e'

In the python statement is the variable 'x' being read, written or both? x = 10*w

10*w is being written into the variable x

In the following python statement is the variable x being read, written or both? x = 16

16 is being WRITTEN into x

True or False: In HTML,You cannot nest an ordered list inside an unordered list in or vice versa

FALSE, any way is fine

True or false:Spreadsheets can only sort individual columns at a time

False

True or False:Anything written in a while loop can be implemented in a for loop.

False - for example an infinite loop can be a while loop but a 'for' loop cannot be infinite

True of False: The enumerate function allows a while loop to be used where a for loop should be. used.

False because enumerate function needs a 'for' loop so when you say enumerate, you have access to both the value s in the list but also that index at where the value is located

True or False: A loop will always execute at least once

False because the loop could be "while false" will never execute any loop at all

True of False: sort() makes a new list with the value sorted

False the sort() modifies the existing list in place

When Sorting data it is important to not select any header row to avoid it getting sorted into the data?

False, YOU Can select the header row but specify that your data has a header row to prevent the header from being moved.

True of False: Python FUNCTIONS can never modify a parameter?

False, functions change the parameter (num_list) sometimes

True of False: After the statement x = "hi!" is executed we would say that the variable x is a string literal

False, it says x is a variable and contains a string

Write an INDEX function that reads the contents of cell B7 from region B5:F7

INDEX(B5:F7, (row)3, (col)1) you actually write it INDEX(B5:F7, 3, 1)

Accessing a single character out of a string is called:

Indexing

How can you recognize a formula in Excel?

It begins with an = sign (like =count(A1:B5) this counts the number of cells that have some kind of value in them in the range of cells given in the brackets

Tick marks are placed in plots in the X, Y location specified by the data?

No tick marks are along the xaxis and the yaxis

when does the value of an actual parameter of a function change?

only when you parameter is a mutable type and you mutate the parameter - such as if the parameter is a list and you append something to that list, you are mutating the actual parameter of the function

An Algorithm must be:

precise, none of the other answers (written in a programming language such as Python, written in English, executed by a computer)

what is the difference between list.remove() and list.pop()

the .remove() command will remove what. you want it to remove when you specify it in the brackets, .pop() removes whatever index you specify in the bracket.

What is the difference between: {"Eve":"[email protected]", "Charlie:"[email protected]"} and {"Eve":"[email protected]" "Charlie":"[email protected]"}

the comma

if a list is list_1 = [2, 5, 9] and you code list_1[1] = 4 what does it do to this list?

the list_1 becomes [2, 4, 9]

Before reading or writing to a file, a file object must be created using?

variable_name = open("filename", "r")

What should the value of y be so that the following Boolean expression evaluates to TRUE? The expression is y < 'rat'

y = 'andrewtate', although he is barely less than a rat

True of False: outcome = sorted(findings) if findings is the name of your given list

True (test it in Jupyter)

True of False: In Python, a single value can be shared by all instances of a class

True because the there is only 1 copy of these attributes, so all instances see the same value. the value can be read using the class name, like classname.attribute_name

What date type does the string's split method return?

a list of strings like ["The", "sun", "is", "out."], after you have split the string: "The sun is out."

WHich of the following is not a file-reading in Python? a) readall b) readline c) read d) readlines

a) readall

if the num_list = [196, 236, 698, 987, 578,837], what comparison could be put in this boolean to make it true? max(num_list) ____ 735 a) >= b)<= c)!= d) > e)==

a), c), d)

The term semantics refers to a) the meaning of statements b) the rules for forming legal statements c) a step-by-step set of instructions (this is an algorithm I believe) d) a type of programming language

a)meaning of statements

what is wrong with this code: def get_largest_of_nums(nums): largest = dict() for num in nums: if (type(num) not in largest or (largest[type(num] < num): largest[type(num) ] = num return largest

an indentation issue

The best structure for implementing a multi-way decision in Python is: a) try b) if c) if-elif-else d) if-else

c) if-elif-else

What does an assignment statement do? a) it outputs the result of the statement's expression to the screen b) it asks the user to enter a value for the assignment's expression c) it represents an algebraic equation d)It causes the computer to store the result of the statement's expression in memory with a variable name that you give it, so you can use that variable again in another python statement.

d)

The expression x == 3 or 4 is a) invalid statement b) it will be true if x = 3 or x = 4 and false for any other values c) It will always be false d) it will always be true

d) It will always be true

write a statement that creates a NEW LIST called employees_sorted, that is a sorted version of the list employees, without changing the contents of the list employees

employees_sorted = sorted(employees)

explain the following code in English: y = list_1[0] for val in list_1: if val > y: y = val print(y)

ends up printing the largest value in the list_1

fragments of code that produce or calculate new data values are called: like x = 6*8+(7/1)

expressions

x = 8 means x is being written sum_num = x means x is being read (into variable sum_num) x += 16 means ?

for x += 16, x is both, being read and written

Accessing a single character out of a string is called:

indexing

a loop that never terminates is called?

infinite

A loop pattern that asks the user whether to continue on each iteration is called an

interactive loop

A loop pattern that asks the user whether to continue on each iteration is called?

interactive loop

True or False: Every python function returns some value

True (because even None is some value)

HTML (Hypertext Markup Language) has been standarized to help ensure that WEB pages work properly and are rendered similarly on all. browsers. So if you are looking at a website in safari, it will look the same as looking at the website if you are in Chrome

True

In HTML, image elements don't need a closing </img> tag.

True

True of False: A For Loop may have an IF statement nested below it

True

True of False: A problem is intractable when it is not practical to solve

True

True of False: All functions do NOT need to end with a return

True

True of False: An IF statement may have a for loop nested beneath it

True

True of False: An IF statement may have another IF statement indented below it.

True

True of False: String formatting let's python programs be read by humans. example: fmt = "Hi { } Welcome!" and we can tell python what to put in the brackets: print(fmt.format("Craig"))

True

True of False: Variable names in python cannot start with a number, a dollar sign character, and cannot have ^ in the middle of the variable name. Test it out in jupyter if you are unsure if the variable name is valid

True

True or False: Every computer on the Internet has a unique numeric address called AP address

True

True or False: In excel $D8 is going to hold the column fixed if you move the formula associated with this cell. It is called column reference absolute. and D$8 would hold the row fixed. It is called ROW reference absolute.

True

True or False: Multiple Variable names can be bound to the same list.

True

True or False: finding.sort() sorts the list called findings in place

True

True or False: in EXCEL, when copying a cell of a spreadsheet, a RELATIVE reference will change which cell it is referring to; but an absolute reference will not change the row D$9 or column $D9 or both $D$9

True

True or False:Because lists in Python are sequences, slicing behaves the same for lists as it does for strings, including the use of negative offsets.

True

True or false: Algorithm is basically a fancy word for 'recipe'.

True

True or false: Function calls are a kind of expression

True

True or false: Python lists are a special construct called a sequence type

True

in HTML, image elements can specify an alt attribute that describes the image for BLIND PEOPLE

True

num_list = [764, 455, 764, 764] is num_list.count(764) == 3 True of False?

True


Related study sets

Legal Aspects of healthcare Ch. 9 Confidentiality

View Set

Chapter 24: Newborn Nutrition and Feeding

View Set

Αλλοτρίωση πλαγιότιτλοι

View Set

Lesson 3: Input/Output and Storage Devices

View Set