Data Science · Python What is the output of print('xxhello'.lstrip('x')) in Python? print('xxhello'.lstrip('x')) A hello Correct answer B helo C olleh D Error MCQSEXAM Show answer Read explanation
Data Science · Python What is the output of print('Programming'[::-1]) in Python? print('Programming'[::-1]) A gnimmargorP Correct answer B Programming C Prog D Error MCQSEXAM Show answer Read explanation
Data Science · Python What is the output of the following Python code snippet? a = [1, 2, 3, 4] a[1:3] = [5, 5] print(a) A [1, 5, 4] B [1, 5, 5, 4] Correct answer C [5, 5, 4] D Error MCQSEXAM Show answer Read explanation
Data Science · Python What does the pip freeze command output in Python? A Frozen processes B A frozen virtual environment C The Python version D Installed packages with their versions Correct answer MCQSEXAM Show answer Read explanation
Data Science · Python What is the correct order of logging levels from lowest to highest severity in Python? A INFO, DEBUG, ERROR, WARNING, CRITICAL B DEBUG, INFO, WARNING, ERROR, CRITICAL Correct answer C DEBUG, WARNING, INFO, ERROR, CRITICAL D CRITICAL, ERROR, WARNING, INFO, DEBUG MCQSEXAM Show answer Read explanation
Data Science · Python What is the output of print(list(reversed([3, 2, 1]))) in Python? print(list(reversed([3, 2, 1]))) A [3, 2, 1] B [1, 3, 2] C [1, 2, 3] Correct answer D None MCQSEXAM Show answer Read explanation
Data Science · Python What is the output of print(5 ^ 6) in Python? print(5 ^ 6) A 7 B 4 C Error D 3 Correct answer MCQSEXAM Show answer Read explanation
Data Science · Python What is the output of the following Python code snippet? for i in range(5): pass print(i) A 4 Correct answer B None C NameError D 0 MCQSEXAM Show answer Read explanation
Data Science · Python What is the output of print('abc'.isalpha()) in Python? print('abc'.isalpha()) A True Correct answer B False C None D Error MCQSEXAM Show answer Read explanation
Data Science · Python What is the output of print(f'{0.5:.2%}') in Python? print(f'{0.5:.2%}') A 0.5% B 50% C 0.50 D 50.00% Correct answer MCQSEXAM Show answer Read explanation
Data Science · Python Which module is used for secure random tokens and passwords in Python? A random B tokens C secrets Correct answer D crypto MCQSEXAM Show answer Read explanation
Data Science · Python Which module provides the fast heap-based priority queue in Python? A queue.List B priority C sortedlist D heapq Correct answer MCQSEXAM Show answer Read explanation
Data Science · Python What is the output of the following Python code snippet? try: '1' A True B TypeError Correct answer C False D None MCQSEXAM Show answer Read explanation
Data Science · Python What Python value does JSON null become after json.loads? A None Correct answer B 'null' C 0 D False MCQSEXAM Show answer Read explanation
Data Science · Python What is the output of print((1, 2, 3) < (1, 3)) in Python? print((1, 2, 3) A True Correct answer B False C None D Error MCQSEXAM Show answer Read explanation
Data Science · Python What is bytecode in Python? A Machine code for the CPU B The source text C Intermediate instructions compiled from source and run by the Python virtual machine Correct answer D An encrypted file MCQSEXAM Show answer Read explanation
Data Science · Python What is the output of the following Python code snippet? from datetime import date print(date(2024, 3, 5).strftime('%m/%d/%y')) A 03/05/24 Correct answer B 2024-03-05 C 05 Mar 2024 D Error MCQSEXAM Show answer Read explanation
Data Science · Python What does generator.close() do in Python? A Deletes the generator B Restarts it C Prints a message D Raises GeneratorExit inside the generator to end it Correct answer MCQSEXAM Show answer Read explanation
Data Science · Python What happens to hashing when you define __eq__ without __hash__ in Python? A It stays hashable by id B Hash equals zero C Python raises at definition time D The class becomes unhashable Correct answer MCQSEXAM Show answer Read explanation
Data Science · Python What module can profile where a Python program spends time? A profiler_ext B timeit only C cProfile Correct answer D debugpy MCQSEXAM Show answer Read explanation
Data Science · Python What is the result of np.array([1, 2, 3]) * 2 in Python? A array([1, 2, 3, 1, 2, 3]) B array([2, 4, 6]) Correct answer C 6 D Error MCQSEXAM Show answer Read explanation
Data Science · Python What is the output of the following Python code snippet? from datetime import datetime print(datetime.strptime('2024-03-05', '%Y-%m-%d').year) A 24 B 2024-03 C 2024 Correct answer D Error MCQSEXAM Show answer Read explanation
Data Science · Python What does the send() method of a generator do in Python? A Sends a value into the generator at the yield expression Correct answer B Sends data over a socket C Closes the generator D Resets the generator MCQSEXAM Show answer Read explanation
Data Science · Python What does sys.path contain in Python? A The current working directory only B The Python executable path C The list of directories searched for imported modules Correct answer D Environment variables MCQSEXAM Show answer Read explanation
Data Science · Python What is the output of print(len({'a': 1, 'b': 2, 'c': 3})) in Python? print(len({'a': 1, 'b': 2, 'c': 3})) A 2 B 1 C Error D 3 Correct answer MCQSEXAM Show answer Read explanation