You are on page 1of 8

Code No:PPS192001 R18

CMR INSTITUTE OF TECHNOLOGY


(UGC AUTONOMOUS)
Kandlakoya (V), Medchal Road, Hyderabad – 501401
I B.Tech. I Sem Pre-Final Examinations, December 2019

Programming for Problem Solving


(COMMON TO CSE, ECE, ME)
Time: 3 hours Max. Marks: 70

Note: This question paper contains two parts A and B.


Part A is compulsory Which Carries 20 marks. Answer all questions in Part A.
Part B consists of 5 questions with internal choice. Each question carries 10 marks
and may have a,b,c as sub questions

PART-A

1. a) What is the difference between pre-increment and post-increment? (2M)


b) Write the equivalent while loop for the following for loop:
(i) for( ch = ‘a’; ch<= ‘z’; ++ch)
putchar(ch); (2M)
c) How to declare and initialize a multi dimensional array? (2M)
d) Which is generally more efficient, recursion or iteration? Justify. (2M)
e) Compare the following two strings using strcmp() function and display its
return value?
char x[5] = ”ABCD”;
char y[5] = “abcd”; (2M)
f) List any four string manipulation functions? (2M)
g) Define self referential structure. (2M)
h) Demonstrate the usage of ‘typedef’? (2M)
i) Find the return value of fopen() if there is any error while opening file? (2M)
j) State the functions for direct file I/O. (2M)

PART- B

2. a) Write a C program to display prime numbers between the range. (5+5)


b) List and explain different kind’s operators in C.
(OR)
3. a) Write a C program to generate roots of quadratic equation (5+5)
b) Describe the structure of a C program

4 a) Write a C program for Bubble sort? (3+7)


b) What are storage classes? Explain with examples.
(OR)
5 a) How to declare, initialize, access one dimensional and two dimensional arrays
b) Write a C program for addition of two matrices. (5+5)
Code No:PPS192001 R18

6 a) Write a C program to Check whether the given string is palindrome or not. (5+5)
b) Explain about pointer arithmetic and arrays with example.

(OR)

7. a) Write a C program to sort the 10 strings (entered by the user) in lexicographical order
(dictionary order). (5+5)
b) Describe the concept of dynamic memory allocation.

8. a) Write a C program that takes two complex numbers as structures and adds them
b) Explain about array of structures with example.

(OR)

9. a) How to declare a union in ‘C’ explain with an example. (5+5)


b) What are bit-fields? Where are they used? How are they different from other
variables?

10 a) Write a C program to copy the content from one file to another file. (5+5)
b) What is a file pointer? Explain the steps for sequential file operations

(OR)

11. a) Write a C program to count number of times a character occur in a file.


b) What is meant by Binary file? Discuss about file positioning functions? (5+5)

***
Code No:PPS192002 R18

CMR INSTITUTE OF TECHNOLOGY


(UGC AUTONOMOUS)
Kandlakoya (V), Medchal Road, Hyderabad – 501401
I B.Tech. I Sem Pre-Final Examinations, December 2019

Programming for Problem Solving


(COMMON TO CSE, ECE, ME)
Time : 3 hours Max. Marks: 70

Note: This question paper contains two parts A and B.


Part A is compulsory Which Carries 20 marks. Answer all questions in Part A.
Part B consists of 5 questions with internal choice. Each question carries 10 marks
and may have a,b,c as sub questions

PART-A

1. a) What is an Expression? Evaluate the expression:


1 && (30 % 10>= 0) && (30 % 10<=3) (2M)
b) What data types would you use to represent the following items: number of (2M)
children at school, a letter grade on an exam, the average number of school
days a child absent each year?
c) Define Linear search. How it different from binary search? (2M)
d) Write the difference between formal and actual arguments? (2M)
e) Describe the use of NULL pointer to avoid dangling state? (2M)
f) Explain about the *, ** ,& symbols. (2M)
g) Find the value of tulip from the following enumerated flowers? (2M)
enum flowers{rose, lily = 5, lotus, tulip, sunflower);
h) What is a structure? How does it differ from an array? (2M)
i) How is a file pointer declared? Give an example. (2M)
j) Differentiate between scanf and fscanf functions with examples. (2M)

PART- B

2. a) Explain the different types of data types used in ‘C’ language. (5+5)
b) Write a C program to calculate the sum of individual digits of a given number.
(OR)
3. a) How while loop is different from do while loop? Explain. (5+5)
b) Write a program to find GCD between two given numbers.
4 a) Apply binary search to search key 15 in the list 7 9 10 12 14 15 25? (5+5)
b) Write a C Program to implement linear search technique.

(OR)
5 a) Discuss about different kinds of arrays in C. (5+5)
b) Write a C program to find smallest and largest numbers in a given array.
Code No:PPS192002 R18

6 a) List and explain string manipulation functions with examples. (5+5)


b) Write a program to concatenate two strings without using strcat() function
(OR)
7. a) A C program contains the following declaration. (5+5)
int x[8] = {10, 20, 30, 40, 50, 60, 70, 80};
i) What is the meaning of x
ii) What is the meaning of (x + 2)
iii) What is the value of *x
iv) What is the value of (*x + 2)
v) What is the value of *(x + 2)
b) Describe the concept of pointers in C.

8. a) Compare and contrast structures and unions. (5+5)


b) Write a C program that takes two complex numbers as structures and multiply them
(OR)
9. What are the ways to pass structures as argument to a function? Explain with (10)
examples.

10 a) Write a ‘C’ program to count the number of characters in a file. (5+5)


b) What is a file? How to open and close different types of files in ‘C’? Explain the
possible modes of opening files? In all these modes what happens when the file
doesn’t exist and the file already exists?
(OR)
11. a) Briefly discuss about the following (5+5)
i)feof() ii) ftell() iii)clearer() iv) fseek() v)rewind().
b) Describe the procedure for copying of two files in C.

***
Code No:PPS192003 R18

CMR INSTITUTE OF TECHNOLOGY


(UGC AUTONOMOUS)
Kandlakoya (V), Medchal Road, Hyderabad – 501401
I B.Tech. I Sem Pre-Final Examinations, December 2019

Programming for Problem Solving


(COMMON TO CSE, ECE, ME)
Time : 3 hours Max. Marks: 70

Note: This question paper contains two parts A and B.


Part A is compulsory Which Carries 20 marks. Answer all questions in Part A.
Part B consists of 5 questions with internal choice. Each question carries 10 marks
and may have a,b,c as sub questions

PART-A

1. a) How break is different from continue statement? (2M)


b) Compare compiler and interpreter. (2M)
c) Write short notes on standard library functions (2M)
d) Mention applications of an array? (2M)
e) What is the output of the following?
char s1[ ]=”hello”,s2[ ]=”cmrit”; (2M)
strcpy(s1,s2); printf(“%d”,strcmp(s1,s2)); ? (2M)
f) Define NULL pointer and Dangling pointer. (2M)
g) How to pass entire structure to a function? (2M)
h) Bit fields are used to save memory? Justify. (2M)
i) Find the return value of fopen() if there is any error while opening file? (2M)
j) Compare and contrast text file with binary file. (2M)

PART- B

2. a) Describe Repetitive statements with examples. (5+5)


b) Write a program to perform arithmetic operators using switch case.
(OR)
3. a) Write a C Program to Fibonacci series of n terms.
b) Explain how to create and run the C program. (5+5)

4 a) What is recursion? Write a C program to find factorial of n using recursion. (5+5)


b) Write a C program to multiply two matrices.
(OR)
5 Explain different types of functions depending upon the categories of arguments and
return statements with an examples. (10 M)
Code No:PPS192003 R18
6 a) Elaborate the concept of dynamic memory allocation. (5+5)
b) What is the use of strcmp() and strncmp() function? Explain with an example.
(OR)
7 a) How to declare and initialize a string? Explain with examples and Write a c program
to verify given string palindrome or not using built-in functions? (5+5)
b) Write short note on the following
i) void pointer ii) * operator iii) & operator iv) pointer v) pointer to pointer

8. a) How are the members of a ‘Union’ are initialized and accessed? (5+5)
b) Explain the following i) Array of structures ii) Structure containing array
(OR)
9 a) Define and declare a structure to store date, which including day, month, year (5+5)
and explain nested structure concept using date structure
b) Discuss about enumerated type.

10 a) Write a C program to merge two files into third file. (5+5)


b) Write about the following:
i)getc() ii)getchar() iii)putc() iv)putchar() v)gets()
(OR)
11. a) Write a C program to copy one file to another by replacing all lowercase letters (5+5)
in source file to uppercase in destination file.
b) Explain how to access the files randomly.

***
Code No:PPS192004 R18

CMR INSTITUTE OF TECHNOLOGY


(UGC AUTONOMOUS)
Kandlakoya (V), Medchal Road, Hyderabad – 501401
I B.Tech. I Sem Pre-Final Examinations, December 2019

Programming for Problem Solving


(COMMON TO CSE, ECE, ME)
Time : 3 hours Max. Marks: 70

Note: This question paper contains two parts A and B.


Part A is compulsory Which Carries 20 marks. Answer all questions in Part A.
Part B consists of 5 questions with internal choice. Each question carries 10 marks
and may have a,b,c as sub questions

PART-A
1. a) Define algorithm and flowchart . (2M)
b) Write a for loop statement to print numbers from 10 to 1. (2M)
c) What is the use of Ternary operator? (2M)
d) List advantages of functions. (2M)
e) What is an array? How it is different from ordinary variable? (2M)
f) Find the value of *y, *(y + 1) for the following program fragment:
char x [ ] = “Life is beautiful”;
char *y = &x [ 3 ]; (2M)
g) Compare and contrast calloc() and malloc() (2M)
h) What is nested structure? Give an example. (2M)
i) Differentiate arrays and structures? (2M)
j) Write short note on fseek() . (2M)

PART- B

2. a) Explain about decision making and branching statements. (5+5)


b) Write a C program to calculate the grade of a student using else-if ladder.
(OR)
3. a) Define a variable and write the different rules for naming variables with examples.
b) Write a C Program to check equivalence of two numbers using ternary operator.(5+5)

4. a) Write a program to print transpose of a given matrix. (5+5)


b) Distinguish Call by value and Call by reference with examples
(OR)
5. a) Compare and contrast iteration vs recursion. (5+5)
b) Perform the bubble sort method for the following list of elements
52,3,88,56,100,6,48,5.

6. a) Discuss various valid arithmetic operations that can be performed on pointers in C.

b) int a[5]={10,20,30,40,50}; Explain the following expressions based on above


array of elements
Code No:PPS192004 R18
i) *(a+2) ii) *(4+a) iii) a[1] iv) *a v) 2[a] (5+5)

(OR)
7. a) Discuss on string Input and Output functions?
b) Write the procedure for swapping two strings using pointers?

8. a) How to save the memory while using structures? Explain. (Assume that all (5+5)
Members of a structure are of type unsigned integers.)
b) Write a program to calculate average marks and total marks in a class of 5
students by using structure concept.
(OR)
9. a) Demonstrate how one structure can be copied to another of the same type. (5+5)
b) Write a C Program to add and multiply two complex numbers using structures.

10. a) Write a program to display contents of the file on screen. (5+5)


b) Explain any five standard library functions for handling files?
(OR)
11. a) What operations can be performed on files? Explain. (5+5)
b) Elucidate the Error handling functions with examples?

***

You might also like