Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Programming and Problem Solving Quiz: A Comprehensive Assessment of Fundamental Concepts -, Quizzes of Programming Languages

This quiz delves into fundamental concepts in programming and problem-solving, covering topics such as time complexity, algorithm analysis, data structures, and dynamic programming. It presents a series of multiple-choice questions that assess understanding of key principles and their practical applications. The quiz is designed to challenge students' knowledge and encourage deeper exploration of these essential areas.

Typology: Quizzes

2024/2025

Available from 04/09/2025

ishatva_gupta4
ishatva_gupta4 🇮🇳

2 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Programing and Problem Solving Quiz
1. What is the time complexity of the following code snippet?
python
Copy
for i in range ( n ):
for j in range ( i , n ):
k = 1
while k < n :
k *= 2
Options:
A) O(n)
B) O(n²)
C) O(n² log n)
D) O(n³)
2. Which of the following is NOT a valid heuristic for the A search algorithm?*
Options:
A) Manhattan Distance
B) Euclidean Distance
C) Hamming Distance
D) Breadth-First Distance
3. What does the following dynamic programming recurrence relation solve?
pf3
pf4

Partial preview of the text

Download Programming and Problem Solving Quiz: A Comprehensive Assessment of Fundamental Concepts - and more Quizzes Programming Languages in PDF only on Docsity!

Programing and Problem Solving Quiz

  1. What is the time complexity of the following code snippet? python Copy for i in range( n ): for j in range( i , n ): k = 1 while k < n : k _= 2_* Options: A) O(n) B) O(n²) C) O(n² log n) D) O(n³)
  2. Which of the following is NOT a valid heuristic for the A search algorithm?* Options: A) Manhattan Distance B) Euclidean Distance C) Hamming Distance D) Breadth-First Distance
  3. What does the following dynamic programming recurrence relation solve?

dp[i][j] = dp[i-1][j] + dp[i][j-1] Options: A) Longest Common Subsequence B) Number of ways to reach bottom-right in a grid C) Knapsack problem D) Fibonacci sequence

  1. Which data structure is most efficient for implementing a priority queue with O(1) insertion and O(log n) extract-min? Options: A) Binary Search Tree B) Hash Table C) Binary Heap D) Linked List
  2. What is the output of the following Python code? python Copy def func( x ): if x == 0 : return 0 return x + func ( x - 1 ) print( func ( 5 )) Options: A) 10 B) 15
  1. What is the output of the following C++ code? cpp Copy #include using namespace std ; int main() { int x = 5 ; int ** p = & x ; cout _<< (_ p )++ << " " << x ; return 0 ; } Options: A) 5 5 B) 5 6 C) 6 6 D) Undefined Behavior