0% found this document useful (0 votes)
17 views

JULY 2021 Programming For Problem Solving

-

Uploaded by

Venkata satish
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

JULY 2021 Programming For Problem Solving

-

Uploaded by

Venkata satish
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

H.T.No.

Code No: CT3502 SRGEC-R20


I B.Tech I Semester Regular Examinations, July 2021
PROGRAMMING FOR PROBLEM SOLVING
(Computer Science and Engineering, Artificial Intelligence and Data Science & Information
Technology)
Time: 3 Hours Max. Marks: 70
Note: Answer one question from each unit.
All questions carry equal marks.
5 × 14 = 70M
UNIT-I
1. a) Identify different syntax and semantic errors present in the below C program. (6M)
#include <stdio.h>
void main( )
{
double x, y = 0 z;
char c=”GEC”
x = 1 / y;
printf("x = %f and y=%f\n", x);
return 0;
}
b) What is an Expression and evaluate the following expressions. (8M)
(i) x = 4 > 8 ? 5 != 1 < 5 == 0 ? 1: 2: 3;
(ii) j = 2 * 3 / 4 + 2.0 / 5 + 8 / 5;
(iii) x = 9 – 12 / (3 + 3) * (2 – 1)*(int)3.5 / sizeof(6);
(OR)
2. a) Perform Requirement Analysis (identify input, output, and data elements) and write an
Algorithm for the following problem:
“You are provided two or more strings, where each string is associated with the number
(seperated by :). If sum of square of digits is even, then rotate the string right by one
position, and if sum of square of digits is odd, then rotate the string left by two positions”.
(8M)
b) Perform Requirement Analysis for the following problem.
“Pronic Number: Given a string of random numbers, your job is to find the pronic
number"; A Pronic Number is a number which is the product of two consecutive integers,
that is, a number of the form n(n + 1). (6M)
UNIT-II
3. a) Write a C program to print all even numbers in Fibonacci series. (8M)
b) Write a C program that prompts the user to input number of calls and calculate the
monthly telephone bills as per the following rule: (6M)
Minimum Rs. 200 for up to 100 calls.
Plus Rs. 0.60 per call for next 50 calls.
Plus Rs. 0.50 per call for next 50 calls.
Plus Rs. 0.40 per call for any call beyond 200 calls.
Page 1 of 2
(OR)
4. a) Write a C program using while loop to read the numbers until -1 is encountered. Also
count the number of prime numbers and composite numbers entered by the user. (8M)
b) Write a C program to print the following Pattern. (6M)
1
24
369
4 8 12 16
5 10 15 20 25
6 12 18 24 30 36
7 14 21 28 35 42 49
8 16 24 32 40 48 56 64
9 18 27 36 45 54 63 72 81
10 20 30 40 50 60 70 80 90 100
UNIT-III
5. a) Write a program to concatenate two given strings without using string library functions.
(7M)
b) Write a program to insert a substring into main string from a given position. (7M)
(OR)
6. a) Show that any two dimensional array is collection of one dimensional arrays with an
example. (7M)
b) Write a C program to read 6 subject marks of a student and calculate Total marks and
Percentage(Assume Total Maximum marks:600) (7M)
UNIT-IV
7. a) Develop a C program to illustrate call-by-value and call-by-reference mechanisms with
examples for each. (8M)
b) Differentiate between user-defined and pre-defined functions. (6M)
(OR)
8. a) Can we pass two-dimensional array as pointer to function? if yes, justify with suitable
example. (7M)
b) Write a C Program to print the nth largest element of an array using functions. (7M)
UNIT-V
9. a) What is nested structure? Write a C program to illustrate the use of nested structure. (7M)
b) How a structure can be used as member of a union? Explain with an example. (7M)
(OR)
10. a) Explain structure containing arrays with suitable example program. (6M)
b) Develop a C program to display the Name, Marks in five subjects and total marks of given
number of students. (Using array of structures). (8M)

*****
Page 2 of 2

You might also like