END TERM EXAMINATION | |
First Semester[B.TECH] | December 2024 |
Paper Code: ES-101 | Subject : Programming In C |
Time:3 Hours | Maximum Marks:60 |
Note: Attempt 5 questions in all including Q.No.1 which is compulsory. Select one question from each unit. | |
Q1 Answer the following in brief. (Any five) (5×4=20) | |
(a) What is a token? What are different types of tokens available in C language? Explain. | |
(b) Evaluate the following expressions: i) 22 + 3 < 6 && 15 || 22 == 7 && 22 – 2 > +5 ii) a + 2 > b || c && a == – d * a – 2 < e Where a=11, b=6, c=0, d=7 and e=5 |
|
(c) Explain formatted input and output statements with examples. | |
(d) Show how break and continue statements are used in a C-program, with examples. | |
(e) What is an array? How are single dimension and two-dimension arrays are declared and initialized? | |
(f) Explain local variable, global variable, static variable, auto variable and register variable and clearly differentiate among them | |
(g) Differentiate between static memory allocation and dynamic memory allocation. What is the difference between the function malloc() and calloc()? | |
Q2. a) An electricity board charges the following rates for the use of electricity: for the first 200 units 80 paise per unit; for the next 100 units 90 paise per unit; beyond 300 units Rs 1 per unit. All users are charged a minimum of Rs. 100 as meter charge. If the total amount is more than Rs 400, then an additional surcharge of 15% of total amount is charged. Write a program to read the name of the user, number of units consumed and print out the charges. (5) | |
b. Write an algorithm and develop a C program that reads N integer numbers and arrange them in ascending order using any Sorting algorithm of your choice. (5) | |
Q3. a). Explain string manipulation library functions with their syntaxes. Write a program to check whether a string is palindrome or not. (5) | |
b) Write an algorithm and develop a C program to search an integer from N numbers in ascending order using binary searching technique. (5) | |
Q4. a). What is a function? Explain different classification of user defined functions based on parameter passing and return type with example. (5) | |
b). Write a C-program using functions to generate the Fibonacci series. (5) |
|
Q5. a) What is recursion? Explain. Write a C-program using recursive function for Binary to Decimal Conversion. (5) | |
b). Write a program in C using functions to swap two numbers using global variables concept and call by reference concept. (5) | |
Q6. a). What is structure? Explain C syntax of structure declaration with example. (5) | |
b). Differentiate between Array, Structure and Union with example. (5) | |
Q7. a) Write a C-program using structures to read, write, compute average marks and display the students scoring above and below the average marks for a class of N students. (5) | |
b). What is a pointer? Explain how the pointer variable declared and initialized. If one pointer points to character and another pointer points to integer, will they take same space or different? Justify your answer and explain the concept of pointer arithmetic. (5) | |
Q8. a) Write a program in C to find the sum and mean of all elements in an array using pointers. (5) | |
b) What are pre-processor directives? Explain different categories of pre-processor directives used in C. (5) | |
Q9.a) Why we use “File in C Language”? Explain the Operating modes of files. (5). | |
b) Explain the following file functions with example: (5) i) fopen( ) ii) fclose( ) iii) feof( ) iv) fseek( ) |