written 7.6 years ago by |
Programming in C and Data Structures - Dec 2014
First Year Engineering (C Cycle) (Semester 1)
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 pseudocode? Explain with an example.(4 marks)
1 (b) Explain the structure of C program with an example.(6 marks)
1 (c) Explain any five operators used in C language.(10 marks)
10 (a) What are primitive and non primitive datatypes? Explain.(6 marks)
10 (b) Define queue. Explain it along with its application.(8 marks)
10 (c) Explain:
i) Abstract data type
ii) Stack
iii) Linked list.(6 marks)
2 (a) What is type conversion? Explain two types of type conversions with examples.(6 marks)
2 (b) Write a program in C to find the area and perimeter of a rectangle.(6 marks)
2 (c) Define: i) Variable ii) Constant iii) Associativity iv) Precedence.(8 marks)
3 (a) What is two way selection statement? Explain if, if-else, nested if-else casaded if-else with example and syntax.(10 marks)
3 (b) Write a program that takes three coefficients (a, b and c) of a quadratic equation: (ax2+bx+c)1 as input and compute all possible roots and print them with appropriate messages.(10 marks)
4 (a) Explain switch statement with an example.(6 marks)
4 (b) What is a loop? Explain the different loops in C language.(10 marks)
4 (c) Show how break and continue statements are used in a C program, with example.(4 marks)
5 (a) What is an array? How is a single dimension array is declared and initialized?(6 marks)
5 (b) Write a C program to evaluate the polynomial $$ f(x)-a_4x^4 + a_3x^3 + a_2x^2 + a_1x+a_0, $$ for given value of x and its coefficients using Horner's merhod.(6 marks)
5 (c) Explain string manipulation functions, with examples.(8 marks)
6 (a) What is a functions? Write a function to find the sum of two numbers.(6 marks)
6 (b) Explain the two categories of argument passing techniques., with examples.(6 marks)
6 (c) Write a C function isprime(num) that acepts an integer argument and return 1 if the argument is a prime or a 0 otherwise. Write a program that invokes this function to generate prime numbers between the given ranges.(8 marks)
7 (a) What is structure data types? Explain.(4 marks)
7 (b) Show how a structure variable is passed as a parameter to a function, with an example.(6 marks)
7 (c) Explain the concept of array of structures with a suitable C program.(10 marks)
8 (a) What is a file? Explain fopen(), fclose() functions.(4 marks)
8 (b) Explain how the input is accepted from a file and displayed.(6 marks)
8 (c) Give two text documentary files "Ramayana" and "Mahabharatha-in". Write a C program to create a new file "Karnataka -in" that appends the content of the file "Ramayana-in" to the file "Mahabharatha-in". Also calculate the number of words and new lines in the output file.(10 marks)
9 (a) What is a pointer? Write a program in C to find the sum and mean of all elements in an array. Use pointer technology.(8 marks)
9 (b) What is preprocessor directive? Explain #define and #include preprocessor directives.(8 marks)
9 (c) Explain:
i) Dynamic memory allocation
ii) Malloc function(4 marks)