WorksheetsPythonDS
Total questions: 21
Worksheet time: 7mins
If the insertion and deletion happens from both the ends then the queue is called a______Queue
a) Deque
b) Header
c) Queue
d) Circular Queue
Which of the following applications may use a stack?
a) A parentheses balancing program
b) Tracking of local variables at run time
c) Compiler Syntax Analyzer
d) Data Transfer between two asynchronous process
What is the value of the postfix expression 6 3 2 4 + – *:
1
14
74
-18
What does the following function do for a given Linked List with first node as head?
void fun1(struct node* head)
{
if(head == NULL)
return;
fun1(head->next);
printf("%d ", head->data);
}
a) Prints all nodes of linked lists
b) Prints all nodes of linked list in reverse order
c) Prints alternate nodes of Linked List
d) Prints alternate nodes in reverse order
If for an algorithm time complexity is given by O(1) then complexityof it is:
A. constant
B. polynomial
C. exponential
D. none of the mentioned
What advantage does a linked list have over an array?
A linked list can give you the data faster
It is easier to use
A linked list is not of a fixed size
It's better
What is the best and worst-case time complexity for searching for a value in a Linked List?
O(1) and O(log n)
O(1) and O(1)
O(1) and O(n^2)
O(1) and O(n)
What is a correct syntax to output "Hello World" in Python?
print("Hello World")
p("Hello World")
print(Hello World)
Output(Hello world)
How do you insert comment into a python code
#comment
/* Comment */
// Comment
What is the correct syntax to output the type of a variable or object in Python?
print(typeof x)
print(typeOf(x))
print(typeof(x))
print(type(x))
What is the correct way to create a function in Python?
def myFunction():
function myfunction():
create myFunction():
In Python, 'Hello', is the same as "Hello"
False
True
Which method can be used to remove any whitespace from both the beginning and the end of a string?
ptrim()
len()
strip()
trim()
Which method can be used to return a string in upper case letters?
uppercase()
toUpperCase()
upperCase()
upper()
Which method can be used to replace parts of a string?
replaceString()
replace()
switch()
repl()
salary = input("enter your salary")
salary = int(salary)
if salary > 1000 and salary <10000:
print(" under demand")
elif salary >10000 and salary <30000:
print("on demand")
else :
print("above demand")
what is the output , if the user enters(25000)
under demand
on demand
above demand
Sumit has made a program to print Even numbers up to limit N but the code below is not producing correct output. Help him to correct this code??
Add N=int(input("Enter limit")) before code and change ( i<=10) to i<=N
Write N=input("Enter limit") before code and change the condition from i<=10 to i<=N
Write while(i<=limit)
What changes we have to do in the following code to get output 1,4,7,10,13,16,19
increase value of i by 3 (i=i+3)
initialize i=1 and increase value of i by 3 (i=i+3)
initialize i=3 and increase value of i by 3 (i=i+3)
What would be the output of the following code
a
b
c
d
What will this code do?
Print Numbers 1-11
Print Numbers 1-10
Print Numbers 2-10
Print Error
What will this code print?
Print the word 'letter'.
Print a user input on one line.
Print a user input one letter at a time.
Print an Error.
