0% found this document useful (0 votes)
19 views3 pages

End Online

This document outlines the end-term examination for the Computer Programming and Problem Solving course at Maulana Azad National Institute of Technology, Bhopal, held in March 2022. It includes details about the exam structure, instructions for submission, and a series of programming questions that students must answer, covering topics such as data structures, recursion, binary operations, and character frequency analysis. The exam is designed to assess students' understanding and application of programming concepts in C.

Uploaded by

abc747388
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)
19 views3 pages

End Online

This document outlines the end-term examination for the Computer Programming and Problem Solving course at Maulana Azad National Institute of Technology, Bhopal, held in March 2022. It includes details about the exam structure, instructions for submission, and a series of programming questions that students must answer, covering topics such as data structures, recursion, binary operations, and character frequency analysis. The exam is designed to assess students' understanding and application of programming concepts in C.

Uploaded by

abc747388
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/ 3

Maulana Azad National Institute of Technology, Bhopal-462003

Department of Computer Science and Engineering


End Term Examination, March 2022
st
Course: B.Tech, 1 Semester Section - A/B/C/D/E
Subject Name-Computer Programming and Problem Solving Subject Code- CSE-104
Date: 15-03-2022 Max. Marks: 50
Time: 9:30 AM to 12:30 PM Submission/uploading time: 12:30 to 01:00 PM (30 Minutes)
Note:
1. All questions are compulsory.
2. Take suitable assumptions wherever necessary and clearly state the same.
3. Don’t wait till the deadline to upload, do it as soon as you finish your paper.
4. Submit/upload the answer sheet in single pdf file with filename as your roll number, for example
(21A001.pdf)
Q.
Question M
No.
Q1 a) Create a structure called library to hold accession number, title of the book, author name, price of the book,
and flag indicating whether book is issued or not. Write a menu-driven program that implements the
7+3
working of a library. The menu options should be:
=10
i. Add book information
ii. Display book information
iii. List all books of a given author
iv. List the title of specified book
v. List the count of books in the library
vi. List the books in the order of accession number
vii. Exit

b) Write a C program for the following pattern using any loop


$000$000$
0$00$00$0
00$0$0$00
000$$$000
Q2 a) How many time f (a, 6) will be the called for the following C program and return the final output value?
Construct the tree of each step clearly.
5+5
#include<stdio.h> =10

int f(int* a, int n)


{
if (n <= 0) return 0;
else if (*a % 2 == 0) return *a + f(a + 1, n - 1);
else return *a - f(a + 1, n - 1);
}

int main()
{
int a[] = { 12, 7, 13, 4, 11, 6 };
printf("%d", f(a, 6));
return 0;
}

b) You are supposed to enter the inputs as “your first name” and “your last name”. Now after receiving the
inputs, transform your entered first name and your entered last name into the binary strings, in such a way

Page 1 of 3
that the vowels are represented with 1’s and consonants are represented with 0’s. Example: User entered
first name: “abc”, last name: “mno” -write “100”, “001” respectively. Write a program to perform bitwise
AND, OR and XOR on these two binaries.

NOTE: Represent binary strings in 16 bits. You may prefix the strings with 0’s to make your operations
compatible.
Q3 a) Write a C program to enter your Scholar No. in an array starting from 0th index. Firstly, separate
the numbers in even and odd indices. Then, add the digits in these indices. Lastly, multiply the 6+4
separate sum computed. For example, if your scholar no. is S[i]: =10

2 0 3 1 1 2 5 0 1

Find out the elements for even and odd indices say E[i] and O[i]. Calculate the summation of all the
elements in E[i] and O[i] separately. Then, find the product of these two summations.
b) Write the if-else-if equivalent code for the following code snippet. Also show output of your program by
taking input as (last_3digit_roll_no %10).

Q4 a) Write a C program for the square matrix pattern, where each Nth row contains the same N value. 5+5
Add corner elements and check whether the sum is equal to 10 or not. =10
b) Write a program to find the frequency of characters in a string without using
== operator.
Sample output: Enter a string - awesome
Enter a character to find its frequency - e
Frequency of e - 2
Q5 a) Consider the below snippet of code. Enter your FirstNameXLastNameX as input to the program character
by character in sequence. For example, if your name is AMIT ROY then enter as below
A 6+4
M =10
I
T
X
R
O
Y
X

Answer the following with respect to your own first and last name (ignore middle name if any).
(i) How many times is the function myFunc1() called before termination of the program?
(ii) What is your final output?
Zero (0) marks will be awarded in case you enter someone else’s firstname and lastname as input and show
final output.

Page 2 of 3
b) Write a program to replace all EVEN elements by 0 and Odd by 1 in One Dimensional Array without using
% and == operators. You can use any other operators. You can assume an initialised array of size 10.

-----------------------------------------------------------End---------------------------------------------------------------

Page 3 of 3

You might also like