Tuesday, October 4, 2011

C PROGRAMMING AND DATA STRUCTURES JNTU PREVIOUS YEAR QUESTION PAPER FOR CE, EEE, ME, ECE, CSE, CHEM, EIE, BME, IT, MECT, E.COMP.E, MMT, MEP, AE, ICE, BT, AME DEPARTMENTS




JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
I B.TECH - REGULAR EXAMINATIONS, JUNE - 2010
C PROGRAMMING AND DATA STRUCTURES
(COMMON TO CE, EEE, ME, ECE, CSE, CHEM, EIE, BME, IT, MECT, E.COMP.E,
MMT, MEP, AE, ICE, BT, AME)
Time: 3hours Max.Marks:75
Answer any FIVE questions
All questions carry equal marks
- - -
1.a) Explain the functions of the following:
i) Preprocessor
ii) Compiler
iii) Linker.


b) Draw a flowchart to find maximum and minimum of the given three input numbers.
[6+9]
2.a) Write minimal C-expressions for the following:
i)
4 3 2
3x + − 5x x4 + 7x + 20
ii)
a b c
bc ca ab
− −
iii) Digit at 100’s place of the given integer x. (Ex. Digit at 100’s place in 2578 is
5).
iv) If a > b then the value of expression is a-b, otherwise b-a
v) True if 5 < x < 10 , otherwise false
vi) Divide the integer variable x by 16 using bit-wise operators
b) What is the difference between the following c-words?
i) amount and “amount”
ii) 200 and 200.0
c) A number is said to be prime, if it is not exactly divisible by any other numbers other
than 1 and the number it self. For example 7 and 11 are primes. Write C- language
program that reads a number from input and determine whether it is a prime or not.
[6+2+7]
3.a) Write a recursive function double power(double x, int n) that returns x
n.
Write an
equivalent iterative version. Compare them.
b) Using arrays and iteration, Write C-language program that outputs minimum
number of currency notes required for the given amount at input. For example, an
amount of Rs.4260 shall output 1000s – 4; 100s – 2; 50s -1; 10s-1. The currency
denominations are 1000,500,100,50,20,10,5,2 and 1. [8+7]
4 a) Consider the following C-program.
void testfun(int *a, int b)
b) {
int x=2;
static int y=5;
y=y+b;
x=x+y;
*a=x+y+b;
b=b+ *a;
}
int main()
{
int a=10,b=5,c=20,*x;
x=&a;
testfun(x,b);
printf(“%d %d %d %d\n”,a,b,c,*x);
testfun(x,c);
printf(“%d %d %d %d\n”,a,b,c,*x);
}
Trace the above program execution (changed variable values and bindings of each
statement during execution). What is the output of above program? [15]
5. Write C-structures for the College data. College contains the following fields:
College code (2characters), College Name (dynamically allocated string), year of
establishment, number of courses and courses( dynamically allocated structure). A
College can offer 1 to 50 courses. Each course is associated with course name
(String), duration, number of students. The number of students in the college is sum
of number of students in all the courses in the college. Write a function int
collegeeStrength (struct College *c) that returns the number of students in the
college pointed by c. [15]
6.a) List and explain Streams functions of text files along with their prototypes.
b) Write C-program for finding the number of words in the given text file. Assume that
the words are separated by one or more blanks. [7+8]
7.a) Write an algorithm or C-program for sorting integers in ascending order using
insertion sort.
b) Demonstrate the insertion sort results for each insertion for the following initial array of
elements.
25 6 15 12 8 34 9 18 2 [7+8]
8.a) What are the operations on Linear Lists? Differentiate between using Arrays and
Linked Lists for implementation of Linear Lists.
b) Write Structure for implementing Linked List of integers. Write C-function for
insertion operation in Linked List. [7+8]

No comments:

Post a Comment