Question

Question 1 ) Select all true statements about a Python slice of a list. (Wrong answers...

Question 1 ) Select all true statements about a Python slice of a list. (Wrong answers carry penalties.)

Select one or more:

a. It is created in Theta(1) time.

b. It is created in Theta(n) time where n is the length of the list.

c. It is a shallow copy of a fragment of the list.

d. It is a deep copy of a fragment of the list.

e. It is created in Theta(n) time where n is the length of the slice.

Question 2) RAM cells are 1 byte in size. A Python string of Unicode characters (each 2 bytes in size), starts at RAM address 6805. What is the RAM address of the Unicode character at index 62? (The addresses in the question are written in the decimal system.)

Answer:

Homework Answers

Answer #1

Solution:question 1

the statements which are true about a Python slice of a list are
It is a deep copy of a fragment of the list.
It is created in Theta(n) time where n is the length of the slice.

So, answers are options D, E
Answer

options D, E

Solution :question 2

let the string name is s
then
ram address of s[0] = 6805
ram address of s[1] = s[0]+ 2 since reach character is 2 bytes of size = 6807
ram address of s[2] = s[0]+ 2*2 since reach character is 2 bytes of size = 6809
ram address of s[3] = s[0]+ 2*3 since reach character is 2 bytes of size = 6811
.........................
ram address of s[62] = s[0]+ 2*62 since reach character is 2 bytes of size = 6805 + 124 = 6929

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT