Take a look at the snippet, and choose the true statements: (Select two answers)

Take a look at the snippet, and choose the true statements: (Select two answers) nums = [1, 2, 3] vals = nums del vals[1:2]A . nums is longer than vals B. nums and vals refer to the same list C. vals is longer than nums D. nums and vals are...

April 27, 2023 No Comments READ MORE +

Which of the following expressions is equivalent to the expression in the function?

You develop a Python application for your company. You have the following code. def main(a, b, c, d): value = a + b * c - d return value Which of the following expressions is equivalent to the expression in the function?A . (a + b) * (c - d)...

April 27, 2023 No Comments READ MORE +

The digraph written as #! is used to:

The digraph written as #! is used to:A . tell a Unix or Unix-like OS how to execute the contents of a Python file. B. create a docstring. C. make a particular module entity a private one. D. tell an MS Windows OS how to execute the contents of a...

April 26, 2023 No Comments READ MORE +

What is the output of the following snippet?

What is the output of the following snippet? def fun(x, y, z): return x + 2 * y + 3 * z print(fun(0, z=1, y=3))A . the snippet is erroneous B. 9 C. 0 D. 3View AnswerAnswer: B Explanation: Topics: positional parameter keyword parameter operator precedence Try it yourself: def...

April 26, 2023 No Comments READ MORE +

What is the expected output of the following code?

What is the expected output of the following code? def func(p1, p2): p1 = 1 p2[0] = 42 x = 3 y = [1, 2, 3] func(x, y) print(x, y[0])A . 3 1 B. The code is erroneous. C. 1 42 D. 3 42 E. 1 1View AnswerAnswer: D Explanation:...

April 26, 2023 No Comments READ MORE +

What is the expected output of the following code?

What is the expected output of the following code? def func(text, num): while num > 0: print(text) num = num - 1 func('Hello', 3)A . An infinite loop. B. Hello Hello Hello C. Hello Hello Hello Hello D. Hello HelloView AnswerAnswer: A Explanation: Topics: def while indentation Try it yourself:...

April 26, 2023 No Comments READ MORE +

Assuming that the tuple is a correctly created tuple,

Assuming that the tuple is a correctly created tuple, the fact that tuples are immutable means that the following instruction: my_tuple[1] = my_tuple[1] + my_tuple[0]A . can be executed if and only if the tuple contains at least two elements B. is illegal C. may be illegal if the tuple...

April 26, 2023 No Comments READ MORE +

What are the four fundamental elements that make a language?

What are the four fundamental elements that make a language?A . An alphabet, phonetics, phonology, and semantics B. An alphabet, a lexis, phonetics, and semantics C. An alphabet, morphology, phonetics, and semantics D. An alphabet, a lexis, a syntax, and semanticsView AnswerAnswer: D Explanation: Topics: language alphabet lexis syntax semantics...

April 26, 2023 No Comments READ MORE +

What is the expected output of the following code?

What is the expected output of the following code? data = ['Peter', 404, 3.03, 'Wellert', 33.3] print(data[1:3])A . None of the above. B. ['Peter', 404, 3.03, 'Wellert', 33.3] C. ['Peter', 'Wellert'] D. [404, 3.03]View AnswerAnswer: D Explanation: Topic: list indexing Try it yourself: data = ['Peter', 404, 3.03, 'Wellert', 33.3]...

April 26, 2023 No Comments READ MORE +

What is the output of the following snippet?

What is the output of the following snippet? dct = {} dct['1'] = (1, 2) dct['2'] = (2, 1) for x in dct.keys(): print(dct[x][1], end='')A . 21 B. (2,1) C. (1,2) D. 12View AnswerAnswer: A Explanation: Topics: dictionary tuple indexing for dict.keys() print() Try it yourself: dct = {} dct['1']...

April 26, 2023 No Comments READ MORE +