NEW
Font size
WorksheetsPython Refresher
Total questions: 50
Worksheet time: 26mins
France
Wales
Wales
France
Ireland
What output will this code produce?
['blue', 'green', 'red', 'yellow']
['blue', 'red', 'yellow']
['yellow', 'red', 'green']
['yellow', 'red', 'blue']
'London', 'Exeter', 'Bristol']
'Bristol', 'Exeter', 'London', ]
Why do we learn Python?
It's a really big snake
It's the name of a very funny comedy show
It's simple and easy to learn
It's so rare that no one else knows it
print("Hello world!")
print(3+4)
What would this print?
print("3+4")
Print("Hello world!")
print("Hello" + "world" + "today")
print(Hello world!)
print("Hello world!\nHello world!")
Hello world!
print("Hello world!" * 2)
print(9/3)
In a stack, if a user tries to remove an element from empty stack it is called _________
Underflow
Empty collection
Overflow
Garbage Collection
Process of inserting an element in stack is called ____________
Create
Push
Evaluation
Pop
Consider the usual algorithm for determining whether a sequence of parentheses is balanced.
Suppose that you run the algorithm on a sequence that contains 2 left parentheses and 3 right parentheses (in some order).
The maximum number of parentheses that appear on the stack AT ANY ONE TIME during the computation?
1
2
3
4 or more
User perform following operations on stack of size 5 then -
push(1);
pop();
push(2);
push(3);
pop();
push(2);
pop();
pop();
push(4);
pop();
pop();
push(5);
Overflow Occurs
Stack Operations will be performed Smoothly
Underflow Occurs
None of these
What is the value of the postfix expression 6 3 2 4 + – *
1
40
74
-18
The following postfix expression with single digit operands is evaluated using a stack:
8 2 3 ^ / 2 3 * + 5 1 * -
6,1
5,7
3,2
1,5
To evaluate an expression without any embedded function calls:
One stack is enough
Two stacks are needed
As many stacks as the height of the expression tree are needed
A Turing machine is needed in the general case
What will be the postfix form of the above expression -
(A+B)∗(C∗D-E)∗F/G
None of these
A B + C D ∗ E − F G ∗ / ∗
A B + C D E ∗ − F G / ∗ ∗
A B + C D ∗ E − F G / ∗ ∗
Which one of the following is an application of Stack Data Structure?
Managing function calls
The stock span problem
Arithmetic expression evaluation
All of the above
List of data in which element can be inserted and removed at the same end is called as __________.
array
stack
linked list
queue
What would be the best way of describing "lives"?
Which DATA TYPE would be most suitable for a variable called "temperature"?
