0% found this document useful (0 votes)
14 views2 pages

APT - Question Paper Series Test 2024 Scheme - 2

This document outlines the structure and content of the Second Internal Exam for the B. Tech Degree in Algorithmic Thinking with Python at the College of Engineering Trivandrum. It includes various questions on recursive algorithms, brute-force strategies, modular programming, and problem-solving approaches. The exam is divided into two parts, with Part A consisting of short answer questions and Part B requiring detailed responses to selected questions from specified modules.

Uploaded by

hazilkoloth597
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

APT - Question Paper Series Test 2024 Scheme - 2

This document outlines the structure and content of the Second Internal Exam for the B. Tech Degree in Algorithmic Thinking with Python at the College of Engineering Trivandrum. It includes various questions on recursive algorithms, brute-force strategies, modular programming, and problem-solving approaches. The exam is divided into two parts, with Part A consisting of short answer questions and Part B requiring detailed responses to selected questions from specified modules.

Uploaded by

hazilkoloth597
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

COLLEGE OF ENGINEERING TRIVANDRUM

FIRST SEMESTER B. TECH DEGREE


Second Internal Exam – December 2024
UCEST105 - ALGORITHMIC THINKING WITH PYTHON

Max. Marks: 40 Duration: 2 Hours

Part A (Answer All Questions) Ma CO K


level
rks
1 Consider the following recursive algorithm: [3]
3 K3
A(m, n)
if m == 0
return n + 1
else if n == 0
return A(m - 1, 1)
else
return A(m - 1, A(m, n - 1))
Find the value returned on the call A(1, 2).
2 Identify the issue in the following recursive function and rewrite it to avoid [3] 3 K3
the identified issue:
def list_sum(lst):
return lst[0] + list_sum(lst[0:])
3 A four-digit numerical padlock has digits from 0 to 9. Using a brute-force [3] 4 K3
strategy, how many attempts might be required to guarantee opening the
lock?
4 Suggest a real-world scenario where brute-force is preferred over divide- [3] 4 K3
and-conquer and explain why.
Part B (Answer any one full question from each module. Each question carries 14 marks)
Module 3
5a Create a modular algorithm to check if a given number is prime. [7] 3 K3
(a) Define modules for input validation, prime checking, and result
display.
(b) Explain how modularization improves code clarity.
5b Design a recursive algorithm to reverse the digits of a positive integer. Trace [7] 3 K3
the algorithm for input 123 and explain how the call stack changes during
execution.
1. OR
6a Develop a modular algorithm to manage an inventory system with the [8] 3 K3
following functionalities:
 Adding a new item.
 Removing an item.
 Searching for an item.
Write pseudocode for each module and describe their interconnections.
6b Given the recursive function: [6] 3 K3
def sum_upto(n):
if n == 0:
return 0
return n + sum_upto(n - 1)
Trace the function calls for n=4 and explain how the call stack changes
during execution.
Module 4

7a Given an array arr of integers, an inversion is defined as a pair of indices (i, [8] 4 K3
j) such that:
 i<j
 arr[i] > arr[j]
Example: For arr = [3, 1, 2], the inversion pairs are (3, 1) and (3, 2). The
goal is to count the total number of inversions in the array. For the example
array, the number of inversions is 2.
Design a brute force algorithm to count inversions in a given array of size n.
Count the steps your algorithm takes on the given array in terms of n.
7b For the following problems, specify whether a brute-force or divide-and- [6] 4 K3
conquer approach would be more appropriate and justify your choice:
 Cracking a password.
 Sorting a large dataset.
OR
8a Draw a diagram showing how the array [8, 4, 3, 7, 6, 5, 2, 1] is sorted using [8] 4 K3
the merge sort algorithm. Write a pseudocode for merge sort and explain
each step briefly.
8b Explain how a divide-and-conquer approach can be used to calculate the [6] 4 K3
power of a positive integer x, i.e, xn, n > 0. Provide pseudocode.

CO3: Utilize effective algorithms to solve the formulated models and translate
algorithms into executable programs.
CO4: Interpret the problem-solving strategies, a systematic approach to solving
computational problems, and essential Python programming skills

You might also like