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

Cse - 1071 - Problem Solving Using Computers

The document is a question paper for the Manipal Academy of Higher Education's B.Tech. first semester exam in Problem Solving Using Computers (CSE_1071) scheduled for February 6, 2025. It includes various programming tasks and theoretical questions related to C programming, covering topics such as loops, sorting algorithms, recursion, user-defined functions, structures, and pointers. The exam consists of multiple sections with specific marks allocated to each question, totaling 50 marks.

Uploaded by

Vaisakh
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

Cse - 1071 - Problem Solving Using Computers

The document is a question paper for the Manipal Academy of Higher Education's B.Tech. first semester exam in Problem Solving Using Computers (CSE_1071) scheduled for February 6, 2025. It includes various programming tasks and theoretical questions related to C programming, covering topics such as loops, sorting algorithms, recursion, user-defined functions, structures, and pointers. The exam consists of multiple sections with specific marks allocated to each question, totaling 50 marks.

Uploaded by

Vaisakh
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

Question Paper

Exam Date & Time: 06-Feb-2025 (01:00 PM - 04:00 PM)

MANIPAL ACADEMY OF HIGHER EDUCATION


FIRST SEMESTER [Link]. (CORE STREAM) DEGREE EXAMINATIONS - FEBRUARY 2025
SUBJECT: CSE_1071- PROBLEM SOLVING USING COMPUTERS
(MAKEUP)
Problem Solving Using Computers [CSE-1071]
Marks: 50 Duration: 180 mins.

A
Answer all the questions.

1A) Describe the typical C program development environment with a clear diagram, and explain the (3)
purpose of each stage.
1B) Assuming a=12, b=4, c=3, x=7, y=5, and z=9, evaluate these expressions step-by-step: (3)
i) (x * z - y) % a < = b + c
ii) x / c == y - z % b
iii) !(a / b == c) || (x > y + z)

1C) Develop a C program using a switch statement to convert a given month number (1-12) into its (3)
corresponding season.

Months 12, 1, and 2 correspond to "Winter."


Months 3, 4, and 5 correspond to "Spring."
Months 6, 7, and 8 correspond to "Summer."

Months 9, 10, and 11 correspond to "Fall."


If the month number is outside the range 1-12, print "Invalid month."
2A) i) Compare and Contrast while and do-while loop. (3)
ii) Write a C program that uses a do-while loop to accept a series of numbers from the user and
count how many are even. The program should end if the user enters zero.

2B) i) Demonstrate the working of the bubble sort algorithm on the array B = {5, 3, 8, 4, 2}. Show the (4)
array after each complete pass.
ii) Write a C program to sort the above array using the bubble sort algorithm and display the sorted
array.
2C) Write a C program that takes a 4x4 matrix as input and calculates the sum of its diagonal elements (4)
(both the main diagonal and the secondary diagonal). Print the original matrix and the sums of both
diagonals separately. Also replace the even elements and odd elements in the main diagonal with
0's with 1's respectively. Display the modified matrix.
3A) Consider the function prototype void printSum(int, int); Write a main function that calls printSum (2)
with actual parameters and a correct function definition of printSum that prints the sum of its two
parameters.
3B) i) Compare between global and local variables. (4)
ii) Evaluate the following program with respect to the scope of variables and the usage of function
return values. Predict the output of the program.

Page #1
3C) Describe how recursion can be used to calculate the sum of the first n natural numbers in C. Write (4)
the recursive formula that would be used in the function and explain how the base case prevents
infinite recursion.
4A) With the help of example C programs, explain and demonstrate the calling of a user defined (3)
function by value and by reference (address).
4B) Write a C program that demonstrates passing a 2D array to a function. The function should (4)
calculate and return the sum of all elements in the 2D array. In main, create a 2D array, pass it to
the function, and display the sum.
4C) Define a structure Student that contains the following information about a student: (3)

Name (a string of maximum 50 characters)


Roll number (an integer)
Marks in three subjects (three integers)

Write a C program that:


1) Declares a variable of type Student.
2) Inputs values from the user for all fields of the Student structure.
3) Calculates the average of the marks and prints the details of the student, including the average
marks.

5A) Define a structure Car with fields model, year, and price. Write a program to sort an array of cars by (3)
price in ascending order. Display the sorted array of cars.
5B) i) Explain how pointers can be used to access array elements in C. (4)
ii) Write a program that takes an array of integers as input and prints the elements using both array
notation and pointer notation.
5C) List the classification of Cyber Crimes where computers become target of crime and explain any two (3)
in brief.

-----End-----
Page #2

You might also like