




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































Question: What is Python? Option 1: A high-level programming language Option 2: A low-level programming language Option 3: A database management system Option 4: A data analysis tool Correct Response: 1
Explanation: Python is a high-level, interpreted, and general- purpose dynamic programming language.
Question: What is the purpose of PYTHONPATH environment variable? Option 1: To set the location of the Python interpreter Option 2: To set the location of the Python libraries Option 3: To set the location of the Python modules Option 4: To set the location of the Python scripts Correct Response: 2 Explanation: The PYTHONPATH environment variable is used to set the location of the Python libraries.
Question: What is the purpose of PYTHONSTARTUP environment variable? Option 1: To set the location of the Python interpreter Option 2: To set the location of the Python libraries Option 3: To set the location of the Python scripts that will run automatically when the Python interpreter starts Option 4: To set the location of the Python modules Correct Response: 3 Explanation: The PYTHONSTARTUP environment variable is used to set the location of the Python scripts that will run automatically when the Python interpreter starts.
Question: What are the supported data types in Python? Option 1: Integer Option 2: Float Option 3: String Option 4: All of the above Correct Response: 4 Explanation: Python supports several data types, including integers, floating-point numbers, and strings.
Question: What is the output of print str if str = 'Hello World!'? Option 1: Error Option 2: None Option 3: 'Hello World!' Option 4: 'Hello world!' Correct Response: 3 Explanation: The output of the print statement will be 'Hello World!', as the value of the variable 'str' is assigned the string 'Hello World!'.
Question: What is the output of print str[2:5] if str = 'Hello World!'? Option 1: 'llo' Option 2: 'llo World' Option 3: 'Hello World' Option 4: 'llo Wo' Correct Response: 1 Explanation: The slice of the string starts at index 2 and goes up to but not including index 5, so the result is 'llo'
Question: What is the output of print str[2:] if str = 'Hello World!'? Option 1: 'llo' Option 2: 'Hello World' Option 3: 'llo World!' Option 4: 'llo Wo' Correct Response: 3 Explanation: The slice of the string starts at index 2 and goes up to the end of the string, so the result is 'llo World!'
Question: What is the output of print str + "TEST" if str = 'Hello World!'? Option 1: 'Hello World!TEST' Option 2: 'Hello WorldTEST' Option 3: 'Hello World!' Option 4: 'Hello Wo' Correct Response: 1 Explanation: The "+" operator concatenates the two strings, so the result is 'Hello World!TEST'
Question: What is the output of print list if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]? Option 1: [ 'abcd', 786 , 2.23, 'john', 70.2 ] Option 2: 'abcd, 786, 2.23, john, 70.2' Option 3: 'abcd 786 2.23 john 70.2' Option 4: 'abcd786john70.2' Correct Response: 1 Explanation: The "print" function outputs the entire list, so the result is [ 'abcd', 786 , 2.23, 'john', 70.2 ]
Question: What is the output of print list[1:3] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]? Option 1: [786, 2.23] Option 2: [786, 'john'] Option 3: [2.23, 'john'] Option 4: [786, 2.23, 'john'] Correct Response: 1 Explanation: The slice of the list from index 1 to 3 is [786, 2.23]
Question: What is the output of print list[2:] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]? Option 1: [2.23, 'john', 70.2] Option 2: [2.23, 'john'] Option 3: [70.2] Option 4: [786, 2.23, 'john'] Correct Response: 1 Explanation: The slice of the list starting from index 2 is [2.23, 'john', 70.2]
Question: What is the output of print list1 + list2, if list1 = [ 'abcd', 786 , 2.23, 'john', 70.2 ] and ist2 = [123, 'john']? Option 1: [ 'abcd', 786 , 2.23, 'john', 70.2, 123, 'john'] Option 2: [123, 'johnabcd', 786 , 2.23, 'john', 70.2] Option 3: [ 'abcd', 786 , 2.23, 'john', 70.2, 123] Option 4: [ 'abcd', 786 , 2.23, 'john', 70.2] Correct Response: 1 Explanation: The two lists are concatenated to give [ 'abcd', 786 , 2.23, 'john', 70.2, 123, 'john']
Question: What are tuples in Python? Option 1: A type of list Option 2: A type of dictionary Option 3: An ordered and unchangeable collection of elements Option 4: An unordered and changeable collection of elements Correct Response: 3 Explanation: Tuples are an ordered and unchangeable collection of elements.