What is the main difference between a compiler and an interpreter?
A) A compiler executes code line by line
B) An interpreter translates the entire program at once
C) A compiler translates the code into machine language before execution
D) Both do exactly the same thing
In Python, what will the following code do: sorted([3, 1, 2])?
A) Return [1, 2, 3]
B) Return [3, 2, 1]
C) Return [3, 1, 2]
D) Raise an error
Which of the following is a linear data structure?
A) Tree
B) Graph
C) Stack
D) Heap. What is Big O notation used for?
A) Measuring the actual runtime of a program
B) Describing the worst-case growth of an algorithm
C) Counting the number of lines of code
D) Measuring memory usage in bytes
Which of these is a loop control structure in Python?
A) if-else
B) for
C) switch
D) goto
In an array, what is the time complexity to access an element by index?
A) O(1)
B) O(n)
C) O(log n)
D) O(n^2)
Which of these is an example of a conditional statement in Python?
A) while x < 5
B) if x > 10
C) for i in range
Requirements:

Leave a Reply
You must be logged in to post a comment.