Questions

2 Marks Each

🎯

Test yourself on this topic

10 questions · timed · auto-graded

Question 12 Marks
Write a program using recursive function to accept the number from the user and print sum of first even n natural numbers.
View full question & answer
Question 22 Marks
Write the time complexity of the above program code if it is written differently

Answer
Calculation of processing time:

Total: 21 operations => 21 units of processing time Therefore, the time Complexity is of the order O(1).

View full question & answer
Question 32 Marks
What will be the time complexity of the following program code?

Answer
Let's calculate the processing time of the programming code.

Therefore, the time complexity is of the order O(1) Total: 71 operations => 71 units of processing time Therefore, the time complexity is of the order O(1).

View full question & answer
Question 42 Marks
Write a python program using recursive function to search an element in a list using Binary search technique. 
View full question & answer
Question 62 Marks
Write a program using recursive function to accept the list from the user and print sum of all the elements in the list.   
View full question & answer
Question 72 Marks
Write a program using function to accept a number from the user and print sum of its first n natural numbers.  
View full question & answer
Question 82 Marks
Write a program using a recursive function to return the Xy. The function will take numbers as the parameter.
View full question & answer
Question 92 Marks
What are the best case and worst case in sorting techniques?
Answer
When the array or list is in ascending order and we are arranging the data in the same order then that is the best case. When the array or list is in ascending order, and we are arranging the data in reverse order, i.e. descending order or vice-versa then it is the worst case.
View full question & answer
Question 102 Marks
Write the difference between Recursion and Iterations.
Answer

RecursionIteration

• Due to function calling overhead execution of

recursion is slower.

• Whereas execution of iteration is faster.

• In recusion, a stack is used to store the set of new local

variables and parameters, each time the function is called.

• Iteration does not use the stack.

View full question & answer
2 Marks Each - Computer Science STD 12 Humanities Questions - Vidyadip