AMIETE
– ET/CS/IT (NEW SCHEME) - Code: AE52/AC52/AT52
NOTE: There are 9 Questions in all.
· Question 1 is compulsory and
carries 20 marks. Answer to Q. 1. must be written in the space provided for it
in the answer book supplied and nowhere else.
· Out of the remaining EIGHT
Questions answer FIVE Questions, selecting at least TWO questions from each
part. Each question carries 16 marks.
· Any required data not
explicitly given, may be suitably assumed and stated.
Q.1 Choose
the correct or the best alternative in the following: (210)
a. Evaluate the following prefix expression
+*2+/14 2 5 1
(A) 23 (B) 24
(C) 25 (D) None of these
b. Convert the following infix expression to postfix
notation ((A+2)*(B+4))-1
(A) A2+B4+*1- (B) -1*+4B+2A
(C) A2B4++X1- (D) A2B41++*-
c. What is the
maximum total number of nodes in a tree that has N levels? Note that the root is level (zero)
(A) (B)
(C) (D)
d. A list is
ordered from smaller to largest when a sort is called. Which sort would take the longest time
executed?
(A) HeapSort
(B) ShortBubble
(C) QuickSort (with the first element
as the split value)
(D) SelectionSort
e. What data
structure would you mostly likely see in a nonrecursive implementation of a
recursive algorithm?
(A) link list (B) queue
(C) stack (D) trees
f. A C program
contains the declarations and initial assignments:
int
i = 8, j = 5;
float
x = 0.005, y = -0.01;
char
c = ‘c’, d = ‘d’;
The
value of arithmetic expression 2*((i/5)+(4*(j-3)) % (i+j-2)) is
(A) 10 (B) 15
(C) 1 (D) None of these
g.
The single character input/output
functions are
(A) scanf() and printf() (B) getchar() and printf()
(C) scanf() and putchar() (D) getchar() and putchar()
h. Main () is an
example of
(A) library function (B) user-defined function
(C) header (D) statement
i. In a circular linked list
(A) components are all linked together
in some sequential manner.
(B) there is no beginning and no end.
(C) components are arranged
hierarchically.
(D) forward and backward
transversal within the list is permitted.
j. The average number of comparisons in
sequential search is
(A) n (B)
(C) (D) None of these
PART (A)
Answer at least any TWO Questions. Each question carries 16 marks.
Q.2 a. Write a ‘C’ program that evaluates 2.5 log x
+ cos 32 + . (5)
b. Convert to decimal equivalent? (4)
c. Convert the
binary real number 1011.1011 to its equivalent octal number? (4)
d. Write a ‘C’ program to find the highest of
two numbers using if-else loop? (3)
Q.3 a. Write
a program to find the sum: sum = (5)
b. What is the difference between a while loop and a do-while
loop? (5)
c. Write a
program in ‘C’ to generate a series of Armstrong numbers. A number is an Armstrong number if sum of the
cube of its digit is equal to the number. (6)
Q.4 a. What
is an array? How does it differ from the
ordinary variable? (4)
b. Explain the
purpose of return statement? Give a
suitable example. (4)
c. Differentiate between malloc() and calloc()
functions. Write C code to allocate
memory of a two dimensional array dynamically. (8)
Q.5 a. Differentiate between an array and a
structure. (5)
b. Point out the
errors in the following program: (5)
#include<stdio.h>
void main()
{
struct stud:
int roll;
int age;
};
struct stud s1, s2;
s1={101, 15};
s2=s1;
if(s1==s2)
printf(“\n The structures are equal”);
else
printf(“\n The structures are not equal”);
}
c. What will be
the output of the following program segment: (6)
main()
{
statc char str[]=”The C standard library…….”;
chars *s;
s = str;
while(*s);
{
putch(*s);
s++;
}
printf(“\n”);
s = str;
while(*s)
{
putchar(*s);
s++;
}
}
PART (B)
Answer at least any TWO Questions. Each question carries 16 marks.
Q.6 a. A
two-dimensional array defined as A[4…7,-1…3]
requires 2 bytes of storage space for each element. If the array is stored in row-major form,
then calculate the address of element at location A[6, 2]. Given that the base
address is 100. (5)
b. Write an algorithm to merge two sorted list
L1 and L2. List L1 is sorted in
increasing order and list L2 in sorted in decreasing order. (5)
c. Write
a ‘C’ program to search an element in an array using binary search technique? (6)
Q.7 a. Give postfix form for . (5)
b. What is a
doubly linked list? List the advantages
and disadvantages of using such lists? (6)
c. Consider
the following queue of characters, where queue Q is a circular array which is
allocated 5 memory cells:
Front = 2, Rear = 4, Q: _, P, Q, _, _
Describe the following operations on queue.
(i) R is
added to the queue
(ii) Two
letters are deleted. (5)
Q.8 a. A
binary tree T has 9 nodes. The inorder
and preorder traversals of the tree yield the following sequence of nodes:
Inorder: E
A C K F H D B G
Preorder: F
A E K C D H G B
Draw the tree T. (8)
b. Write an
algorithm to delete a node N in a binary search tree. It is assumed that N has exactly one
child? (8)
Q.9 a. Consider the graph G in
Fig. shown below.
(i) Find
the adjacency matrix A of the graph G.
(ii) Find
the path matrix P of G using powers of the adjacency matrix A.
(8)
b. Explain Breadth First
Traversal in a graph with the help of an example. (8)