Programming in C and Data Structures - Dec 2014
First Year Engineering (C Cycle) (Semester 2)
TOTAL MARKS: 100
TOTAL TIME: 3 HOURS (1) Question 1 is compulsory.
(2) Attempt any four from the remaining questions.
(3) Assume data wherever required.
(4) Figures to the right indicate full marks. 1(a) What is pseudo code? How it is used as a prob lem-solving tool. (6 marks) 1(b) What is an operator? Explain the arithmetic, relational, logical, and assignment operators in C language. (10 marks) 1(c) Write a program in C to print the numbers from 4 to 9 and their squares. (4 marks) 10(a) Explain the array of pointers with example. (4 marks) 10(b) Write and explain any two preprocessor directives in C.(4 marks) 10(c) What is a stack? Explain it with its applications. (4 marks) 10(d) Write a C program to read n unsorted numbers to a n array of size n and pass the address of this array to a function to sort the numbers in ascending order using bubble sort technique. (8 marks) 2(a) Write and explain the basic concepts of a C program. (8 marks) 2(b) Write the guidelines to use printf() function in C language. (8 marks) 2(c) Write a program in C to find the area and perimeter of a circle. (4 marks) 3(a) Explain the two way selection (if, if-else, nested if- lse, cascaded if-else) in C language with syntax . (8 marks) 3(b) Explain the switch statement with syntax and example. (8 marks) 3(c) Design and develop a C program to read a year as an input and find whether it is leap year or not. Also consider end of the centuries. (4 marks) 4(a) Explain the different types of loops in C with syntax a nd example. (8 marks) 4(b) Explain the use of break and continue statement in loops with example. (6 marks) 4(c) Design and develop a C program to reverse of an integer number NUM and check whether it is PALINDROME or NOT. (6 marks) 5(a) What is an array? Explain the declaration and initialization of one and two dimensional arrays with example. (6 marks) 5(b) Explain void and parameter less functions in C with examples. (6 marks) 5(c) Write a C program that:
i. Implements string copy operation STRCOPY (str1,str2) that copies a string str1 to another string str2 without using library function.
ii. Reads a sentence and prints frequency of each of the vowels and total count of consonants. (8 marks) 6(a) Explain any five string manipulation library functions with examples. (10 marks) 6(b) What is function parameter? Explain different types of parameters in C functions. (4 marks) 6(c) Write a C function isprime (num) that accepts an integer argument and returns 1 if the argument is prime, a 0 otherwise. Write a C program that invokes this function to generate prime numbers between the given ranges. (6 marks) 7(a) What is a structure? Explain the syntax of structure declaration with example. (4 marks) 7(b) What is a file? Explain how the file open and file close functions handled in C. (6 marks) 7(c) Write a C program to maintain a record of n"student details using an array of structures with four fields (Roll number(10 marks) 8(a) Explain array of structures and structure within a structure with examples. (8 marks) 8(b) Explain how the structure variable passed as a param eter to a function with example. (6 marks) 8(c) Write a C program to read and display a text from the file.(6 marks) 9(a) What is a pointer? Explain how the pointer variable de clared and initialized. (4 marks) 9(b) What is dynamic memory allocation? Write and explain the different dynamic memory allocation functions in C. (6 marks) 9(c) What are primitive and non-primitive data types? (4 marks) 9(d) Write a C program to swap two numbers using call by pointers method. (6 marks)