Question & Answer: What is computed in results of executing [3, 5, 5] + a. [4, 7, 8] b. [1, 2, 3, 3, 5, 5] c. [3, 5, 5, 1, 2,…..

What is computed in results of executing [3, 5, 5] + a. [4, 7, 8] b. [1, 2, 3, 3, 5, 5] c. [3, 5, 5, 1, 2, 3] d. [3, 1, 5, 2, 5, 3] e. None of the above a. “” b. “D” c. “Dog” d. An error occurs e. None of the above. What does the following expression evaluate to in Python: 5**2 % 4? a. 2 b. 25 c. 10 d. 1 e. None of the above Consider the list A = [1, ‘a’, ‘b’, 2, 4, 3, ‘c’, ‘d’, 5, 6]. Which expression would a. A[1: 7: 3] b. A[0: 4: 2] c. A[1: 3] + A[6: 8: 2] d. A[1] + A[2] + A[6] e. None of the above. Which of the following slices reverses the non-empty string B? a. B[0: len(B): -1) b. B[-len(B): 0] c. B[-1: -1: -1] d. B[:: -1] e. None of the above. Consider the list A = [1, ‘a’, ‘b’, 2, 4, 3, ‘c’, ‘d’, 5, 6]. Which of the following random sample(A, 3) not return? a. [1, 2, 3] b. [‘a’, 3, 6] c. [2, 4, ‘b’] d. [‘d’, 6, ‘c’] e. None of the above. What is the value of the expression “Hello, world!”. find(‘1’0)? a. True b. 2 c. 3 d. [2, 3, 10] e. None of the above.

Expert Answer

 

Hey,

I am answering all of your questions point by point giving explaination as when required.

(1) [3,5,5] + [1,2,3]

using + on lists results in joining of lists. so its result will be a list [3,5,5,1,2,3]. Therefore option c is correct.

(2) Option a will be correct. Multiplying a string with 0 results in empty string.

(3) Answer will be 1 because priority of ** is higher than % so 5 ** 2 % 4 will result in 25 % 4 which is 1.

(4) Cannot answer this because the question is cut by the image bounds. Please reupload the image or provide complete question in comment.

(5) Option d will be correct because of providing -1 as step in slice operation.

(6) Cannot answer this because the question is cut by the image bounds. Please reupload the image or provide complete question in comment.

(7) find method finds the index of the first string provided. Since the first ‘l’ occurs at 2nd index, correct option will be b.

Still stressed from student homework?
Get quality assistance from academic writers!