CSC-Exam One

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

How many times does a loop with the header for count in range(10): execute the statements in its body? A.)9 times B.)10 times C.)11 times

B.) 10 times

What will the following code display? Start = ["Gunter", "Glieben", "Glauten", "Globen"] myList = Start[1:3] print(myList) A.) ["Glauten", "Globen"] B.) ["Glieben", "Glauten"] C.) ["Gunter", "Glieben"]

B.) ["Glieben", "Glauten"]

The primary difference between a tuple and a list is that A.) you do not use commas to separate elements in a tuple B.) once a tuple is created, it cannot be changed C.) a tuple can only include string elements D.) a tuple cannot include lists as elements

B.) once a tuple is created, it cannot be changed

A for loop is convenient for. A.) making choices in a program B.) running a set of statements a predictable number of times C.) counting through a sequence of numbers D.) describing conditional iterations

B.) running a set of statements a predictable number of times

What is the output of the loop for count in range(5): print(count, end = " ") A.)1 2 3 4 5 B.)1 2 3 4 c.)0 1 2 3 4

C.) 0 1 2 3 4 5

A(n) __________ structure is a logical design that controls the order in which a set of statements execute. A.) Iteration B.) Function C.) Control D.) Sequence

C.) control

What is the out put produced? count = 5 while count > 1: print(count, end = " ") count -=1 A.) 1 2 3 4 5 B.) 2 3 4 5 C.) 5 4 3 2 1 D.) 5 4 3 2

D.) 5 4 3 2

What built in function returns the length of a sequence?

Len

What is the main difference between a list and a tuple? What do they look like in python.

Lists are mutable and tuples are immutable. So, you can add or remove stuff. List are good for being dynamic. Python: myList = [item1,item2, item3] Mytuple = (item1,item2, item)

A Boolean variable can reference one of two values which are

True or False

This term refers to an individual item in a list.

element

This is a number that identifies an item in a list.

index

This built-in function returns the highest value in a list.

max

When using the __________ logical operator, one or both of the subexpressions must be true for the compound expression to be true.

or


Kaugnay na mga set ng pag-aaral

Chapter 7- Small Business and Entrepreneurship

View Set

General Psychology - Chapter 2 Exam

View Set

Money, Credit, and FI Ch. 2 HW Review

View Set