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

MTE Question Paper (DSA)

The document is an examination paper for the Odd Semester Mid Term Examination, Oct. 2024, for B.Tech. CCE students at the Faculty of Engineering, School of Computing and Intelligent System. It includes questions on data structures, algorithms, pointer arithmetic, linked lists, time complexity, memory addressing, and infix to postfix expression conversion. The exam consists of multiple sections with compulsory questions, and a maximum score of 30 marks is allocated.

Uploaded by

aditya.23ohlayan
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)
6 views2 pages

MTE Question Paper (DSA)

The document is an examination paper for the Odd Semester Mid Term Examination, Oct. 2024, for B.Tech. CCE students at the Faculty of Engineering, School of Computing and Intelligent System. It includes questions on data structures, algorithms, pointer arithmetic, linked lists, time complexity, memory addressing, and infix to postfix expression conversion. The exam consists of multiple sections with compulsory questions, and a maximum score of 30 marks is allocated.

Uploaded by

aditya.23ohlayan
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

Name:

Enrolment No:

Odd Semester Mid Term Examination, Oct. 2024


Faculty of Engineering, School of Computing and Intelligent System
Department of Computer and Communication Engineering
B.Tech. CCE
Course Code: CCE2103 Course: Data Structures and Algorithms Semester: III
Time: 1.30 hrs. Max. Marks: 30
Instructions: All questions are compulsory.
Missing data, if any, may be assumed suitably.
Calculator is not allowed.
SECTION A
S. No. Marks CO
Given two integer pointers p1 and p2, if p1 points to an address 2040 and p2 points to
2060 in a program where each integer occupies 4 bytes, what is the difference between
Q1 CO-2
the two pointers?

Calculate the result of the following pointer expression:


int arr[] = {10, 20, 30, 40, 50};
Q2 int *p = arr + 3; 2x3=6 CO-2
printf("%d", *(p - 1));

Consider a binary search algorithm on a sorted array of size 16. Determine the number
of comparisons required in the worst-case scenario to locate an element using binary
Q3 CO-3
search.

SECTION B
Design an algorithm or C program to create a linked list using the following node data:
5 → 10 → 15 → 20 → 25 and then insert a new node with the value 30 at the third
Q4 4 CO-2
position of the list.

Compute the time complexity (Big O) of the functions given below.

A) void function (int n){


int i, count=0;
for(i=1; i*i<=n;i++){
count++;
Q5 2*2=4 CO-1
}}
B) function (int n){
for (int i=1, i<=n/3;i++ ){
for (int j=1; j<=n; j+=4){
printf(“*”)}}}

1|Page
Consider a 2D array A[4][5] stored in memory. The base address of the array is 1000,
and each element occupies 4 bytes. Apply the concepts of row-major and column-
Q6 2*2=4 CO-1
major order to calculate the memory address of A[2][3].

Given a sorted array of integer values, analyze the problem of finding two distinct
values in the array whose sum is 90. Write a C program (not the algorithm) to solve
Q7 4 CO-2
this problem. The function should be named findsum(int arr[], int n).

SECTION-C
Imagine you are developing a software module for a basic calculator application that
processes mathematical expressions entered by users. The users will input complex
expressions in infix notation, such as arithmetic operations with parentheses and
operators.

A) In order to compute these expressions accurately, your task is to write an


algorithm that converts infix expressions to postfix expression (Reverse Polish
Notation) using stack.

In this scenario, a user inputs the following mathematical expression to your calculator:
(Price_A + Price_B) * (Discount_C - Discount_D) / Tax_E
CO-2,
Q8 • Here, Price_A, Price_B represent the prices of two products, Discount_C and 3+5=8
CO-3
Discount_D represent percentage discounts on two items, and Tax_E represents the
applicable tax rate.
• You are given values for each variable:
o Price_A = 3
o Price_B = 4
o Discount_C = 8
o Discount_D = 6
o Tax_E = 2
B) Your task is to convert the infix expression (Price_A + Price_B) * (Discount_C
- Discount_D) / Tax_E into postfix and then evaluate the resulting postfix
expression using a stack. Show each step of conversion and evaluation.

2|Page

You might also like