Programming, Lists, and Procedures Flashcards

1
Q

words= [“MY”, “EX”, “JUMPS”]
INSERT words, 2, fat
APPEND words, “ferociously”

What will execute?

A

words= [“MY”, “fat”, “EX,” “JUMPS,” “ferociously”]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
words = ["the"]
insert (words, 1, "poop")
append (words, "monster")
append (words, "dino")
append (words, "peter")
insert (words, 1, "peep")

What will execute?

A

words= [“peep” , “poop”, “the”, “monster”, “dino”, “peter”]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

1: words= [ “saloni”, “aarav”, “ritvik”, “diya”, “mrigas”, “aadi”, “rujuta”]
2: DISPLAY(LENGTH(words))
3: REMOVE(words, 1)
4: DISPLAY(LENGTH(words))

What will line 2 and 4 display?

A

LINE 2: 7

LINE 4: 7-1 = 6

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

scores= [87, 54, 76, 98, 0, 7]
n=0
REAPEAT LENGTH scores TIMES
DISPLAY LENGTH scores - n

n=n+1

A

scores[length] = 6

6-0 = 6 = 7
6-1 = 5 = 0
6-2 = 4= 98
6-3 = 3 = 76
6-4 = 2 = 54
6-5 = 1 = 86

scores= 7, 0, 98, 76, 54, 86

How well did you know this?
1
Not at all
2
3
4
5
Perfectly