Sie sind auf Seite 1von 6

Programs

1. Write a program that reads a list of names and sort the list in Alphabetical
order.
2. Write a program in 'C' language that accepts a string as input and checks
whether it is a Palindrome or not.
3. Write a program that finds the sum of the 1 st 'n' terms of SIN (X)
series.
4. Write a program that finds the sum of the 1 st 'n' terms of COS (X)
series.
5. Write a program to illustrate technique of recursion for evaluating the
Fibonacci series given by
f (0) =1;
f (1)=1;
f (n)= f (n 1) + f(n 2) ;
6. Write a 'C' programme using ternary if-then-else operator to evaluate the
following function.
f (x) = 1 if x > 0
= 0 if x = 0
= -1 if x <0
7. Write a 'C' program to evaluate the following function:
f(x) = x + 1, if x < 5
= x + 2, if 5 x 10
= 0, otherwise.
8. Write a function which takes three integers as input and returns the
smallest of them. The function uses if-else statements only.
9. Write a recursive function which takes a non-negative integer n as a
parameter and returns n!
10. Write a program to print the following output. For example, if n = 3 the
output is as follows:
1
121
1221
11. Write a program to print the following output 'n' rows. For example, if n=3
then output is as given below:

12. Write a function which takes a 5x5 square matrix of real entries and
returns its trace.
13. Write a program in C' language for the addition of two matrices.
14. Write a function which takes a square matrix as a parameter and returns
true if the matrix is skew - symmetric, and false otherwise.
15. Write a program to create a matrix A [2] [3] with elements 2, 4, 6, 8, 10,
12.
Write a program to change the size of above matrix A by adding one
column and making the elements of column as 5 times the value of
elements in column 2 of the original matrix.
16. Write a program that creates a file and store some text in the file.
17. Write a program in 'C' that accepts a filename as input and prints its
contents to standard output.
18. A commercial bank has introduced an incentive policy of giving a bonus to
all its deposit holders. The policy is as follows. If the depositor is a male
senior citizen, he is paid a bonus of 5% of the balance held on 31st
December. If the depositor is a female senior citizen, she is paid a bonus of
7% of the balance held on 31st December. If the depositor falls in neither
category, a bonus of 2% of the balance held on 31st December is paid.
Write an interactive C programme that reads the balance on 31st
December, sex and age of the depositor and prints the bonus amount.
19. The area of a triangle with sides a, b, and c is given by Area = (s(sa)(s
b)(sc))1/2 , where
s = (a + b + c)/ 2. Declare a data structure called "Triangle" having three
members a, b, c of type int. Write a program that prints the area of a
triangle, using the above formula.
20. Write a program which solves t2 -6t + 2= 0 iteratively. Your program should
terminate either after 10 iterations or the difference between the
successive approximations becomes less than 10 -4. The initial
approximation to the root may be taken as 0.

Descriptive Questions
Miscellaneous
1. Comparison:
1) Call by value/ Call by reference
2) Structure/ Union
3) Macro/ Function
4) Bitwise OR/ Exclusive OR
5) Global variable/ Local variable
6) Auto variable/ Static variable
7) Malloc()/ Calloc()
8) While loop/ Do while loop
2. Explain:
1) Escape sequence
2) Switch-case-default statement
3) Break statement
4) Continue statement
5) Operator
6) strcmp ( )
7) strcat ( )
8) fprintf ( )
9) fscanf ( )
10) Enumerator data type with example
11) L-value and R-value
12) Indexed sequential file organisation
3. (i). Evaluate: 2 4/ (5*(6<3) +1)
(ii). Evaluate: 2<3 && 5< = 5 1
(iii). Arrange in the ascending order of priority: ( ), <, &&, +, *
4. Write a macro in C language to find the smallest of three given numbers.
5. Write C printf statements for printing the number 573.423 using.
a. 8 place right justified.
b. 8 place left justified with only two decimal digits.
6. Declare a structure that stores a 3 - dimensional vector. Also write a function
that returns the norm of the vector stored in the structure you declared.
7. Declare a structure called comp that stores a complex number. Declare a
variable of type
"comp". Also, write a function that takes a comp variable as a parameter and
returns its modulus.

Binary Tree
8. Write a program in 'C' language for the creation of a Binary Tree.
9. Draw the 'binary tree by using the following In-order and Pre-order traversals
of a binary tree.
In-order: E A C K F H D B G
Pre-order: F A E K C D H G B
10. Draw the 'binary tree by using the following In-order and Post-order
traversals of a binary tree.

11. The in-order and pre-order tree traversals for a binary tree are given below :
6 7 8 9 10 11 12
10 7 6 9
8 12
11
construct the binary tree.
12. Define the term complete binary tree. Show that the number of nodes at k th
level in a complete binary tree is 2k.
13. Write the Step-by-step procedure to create a BST with the following nodes:
32, 48, 11, 22, 8, 62, 26, 14
Also, give the procedure for deleting the node "22" from BST.
14. Construct a Binary Search Tree with the following keys :
5, 7, 3, 10, 19, 4, 6.
15. Construct a Binary Search Tree with the following keys :
3, 6, 9, 2, 1, 5, 7, 8.
16. Write post-order and pre-order traversal of the below binary tree

17. Write the post-order traversal of the binary tree given below, giving all the
steps involved.

Stack, Queue, Linked List


18. Write any two advantages and any two disadvantages of using pointer in 'C'.
19. State any two advantages/disadvantages of a circular queue over the linear
queue.
20. What is a Priority Queue? Write anyone advantage of it.
21. Write one advantage and one disadvantage of Doubly Linked Lists over
Circular Linked Lists.
22. Explain the process of evaluating an expression in reverse polish notation
using a Stack.
23. Evaluate the following expression by using the stack: 5, 15, 5, , 2, 3, +, /, +.
Terms in the expression are separated by commas.
24. Write a program for implementation of a STACK. Use PUSH and POP functions
for insertion and deletion of an element respectively. PUSH is an operation for
inserting an element into the STACK and POP in an operation to remove an
element from STACK.
25. Define a mode for stack implementation using pointers. Write PUSH and POP
function for your implementation.
26. Write a program for implementation of a linear queue. The program should
include the following operations:
insertion
deletion
display
27. Write a program in 'C' language for the implementation of a singly linked list.
The program should include the following operations:
Creation of Singly linked list
insertion of nodes into the Singly linked list
Deletion of nodes from Singly linked list
Display function
The elements in the singly linked list should be sorted. Use pointers.
28. Assume that a singly linked list stores state names, their capitals and the no.
of districts arranged in the ascending order of state names. For example,

Declare a node
for this list. Also write a function called initialize( ) which initializes the list
with the data "Chhattisgarh", "Raipur" and 27.
29. Assume that a doubly linked list stores the country names and their capitals,
arranged in ascending order of country names for example,

Declare a node for the list. Also, write a function that inserts a new node at
the proper place.

30. The login names and passwords of some users are stored in a linked list of
which a node is defined below :
Struct User
{ char login_name[20];
char password[151 - ;
struct user *Next;
);
typedef struct user USER ;
Write a function that takes as input two strings S1 and S2 and a pointer of
type USER and returns
a. The string "USER NOT FOUND" if the string S1 doesn't exist in the list.
b. The string "PASSWORD INCORRI CT" if the string S1 exists in the list but S2
doesn't exist in the list.
c. The string "SUCCESS" if both the strings S1 and S2 exist in the list.

Das könnte Ihnen auch gefallen