APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY FIRST SEMESTER B.TECH DEGREE EXAMINATION, MONTH & YEAR
Course Code: EST 102
Course Name: Programming in C (Common to all programs)
Max.Marks:100 Duration: 3 Hours
PART A
Answer all Questions. Each question carries 3 Marks (10x3=30)
1. Write short note on processor and memory in a computer.
2. What are the differences between compiled and interpreted languages? Give example for each.
3. Write a C program to read a Natural Number through keyboard and to display the reverse of the given number. For example, if “3214567” is given as input, the output to be shown is “7654123”.
4. Is it advisable to use goto statements in a C program? Justify your answer.
5. Explain the different ways in which you can declare & initialize a single dimensional array.
6. Write a C program to read a sentence through keyboard and to display the count of white spaces in the given sentence.
7. What are the advantages of using functions in a program?
8. With a simple example program, explain scope and life time of variables in C.
9. Write a function in C which takes the address of a single dimensional array (containing a finite sequence of numbers) and the number of numbers stored in the array as arguments and stores the numbers in the same array in reverse order. Use pointers to access the elements of the array.
10. With an example, explain the different modes of opening a file.
Part B
Answer any one Question from each module. Each question carries 14 Marks (14X5=70)
11.
(a) Draw a flow chart to find the position of an element in a given sequence, using linear searching technique. With an example explain how the flowchart finds the position of a given element. (10)
(b) Write a pseudo code representing the flowchart for linear searching. (4)
OR
OR
12.
(a) With the help of a flow chart, explain the bubble sort operation. Illustrate with an example. (10)
13.
(a) With the help of a flow chart, explain the bubble sort operation. Illustrate with an example. (10)
(b) Write an algorithm representing the flowchart for bubble sort. (4)
(a) Write a C program to read an English Alphabet through keyboard and display whether the given Alphabet is in upper case or lower case. (6)
(b) Explain how one can use the builtin function in C, scanf to read values of different data types. Also explain using examples how one can use the builtin function in C, printf for text formatting. (8)
OR
19. (a) With a suitable example, explain the concept of pass by reference. (6)
OR
(b) Explain how one can use the builtin function in C, scanf to read values of different data types. Also explain using examples how one can use the builtin function in C, printf for text formatting. (8)
OR
14. (a) With suitable examples, explain various operators in C. (10)
(b) Explain how characters are stored and processed in C. (4)
15. (a) Write a function in C which takes a 2-Dimensional array storing a matrix of numbers and the order of the matrix (number of rows and columns) as arguments and displays the sum of the elements stored in each row. (6 )
(b) Write a C program to check whether a given matrix is a diagonal matrix. (8)
OR
16. (a) Without using any builtin string processing function like strlen, strcat etc., write a program to concatenate two strings. (8)
(b) Write a C program to perform bubble sort. (6)
17. (a) Write a function namely myFact in C to find the factorial of a given number. Also, write another function in C namelynCr which accepts two positive integer parameters n and r and returns the value of the mathematical functionC(n,r)( n! / ( r! x (n - r)!) ). The function nCr is expected to make use of the factorial function myFact. (10)
(b) What is recursion? Give an example. (4)OR
18. (a) With a suitable example, explain the differences between a structure and a union in C. (6)
(b) Declare a structure namely Student to store the details (roll number, name, mark_for_C) of a student. Then, write a program in C to find the average mark obtained by the students in a class for the subject Programming in C (using the field mark_for_C). Use array of structures to store the required data (8)
19. (a) With a suitable example, explain the concept of pass by reference. (6)
(b) With a suitable example, explain how pointers can help in changing the content of a single dimensionally array passed as an argument to a function in C. (8)
OR
20. (a) Differentiate between sequential files and random access files? (4)
(b) Using the prototypes explain the functionality provided by the following functions. (10)
i. fseek()
ii. ftell()
iii. fread()
iv. fwrite()
v.rewind
Comments
Post a Comment