Вы находитесь на странице: 1из 11

Unit I

Syllabus
Algorithm / pseudo code, flowchart, program development steps, structure of C pr
ogram, A Simple C program, identifiers, basic data types and sizes, Constants, v
ariables, arithmetic, relational and logical operators, increment and decrement
operators, conditional operator, bit-wise operators, assignment operators, expre
ssions, type conversions, conditional expressions, precedence and order of evalu
ation. Input-output statements, statements and blocks, if and switch statements,
loops- while, do-while and for statements, break, continue, goto and labels, pr
ogramming examples
Algorithms,Flowcharts
1.
1. Draw a Flowchart for the following
The average score for 3 tests has to be greater than 80 for a candidate to quali
fy for the interview. Representing the conditional logic for generating reject l
etters for all candidates who do not get the required average & interview call l
etters for the others. [Answer Tip]
2. Explain the basic structure of C program. [Answer Tip] [10+6]
Basics (I/O)
2.
1. Distinguish between getchar and scanf functions for reading strings. [Answer
Tip]
2. What is the difference between signed integer and unsigned integer in terms o
f memory and range [Answer Tip]
3.
1. What are the general characteristics of C? [Answer Tip]
2. Give and Explain the structure of a C program? [Answer Tip]
3. Write a C program to print the Pascal s triangle. [Answer Tip]
[4+4+8]
Constants, Data types and Variables
4. Write about space requirements for variables of different data types.[Answer
Tip]. [16]
5.
1. What is the difference between signed integer and unsigned integer in terms o
f memory and range [Answer Tip].
2. List the entire data types in C. What is the size of each of these data types
[Answer Tip]. [8+8]
6.
1. What is a string constant? How do string constants differ from character cons
tants? Do string constants represent numerical Values? [Answer Tip]
2. Summarize the standard escape sequences in C. Describe them. [Answer Tip]
3. What is a variable? How can variables be characterized? Give the rules for va
riable declaration. [Answer Tip]
4. What is the purpose of type declarations? What are the components of type dec
laration? [Answer Tip][4+4+4+4]
7.
1. What are different types of integer constants? What are long integer con- sta
nts? How do these constants differ from ordinary integer constants? How can they
be written and identified? [Answer Tip]
2. Describe two different ways that floating-point constants can be written in C
. What special rules apply in each case?[Answer Tip]
3. What is a character constant? How do character constants differ from numeric
type constants? Do character constants represent numerical values? [Answer Tip][
6+4+6]
Operators
8.
1. What is meant by operator precedence? What are the relative precedence of the
arithmetic operators? [Answer Tip]
2. What is the associatively of the arithmetic operators?[Answer Tip]
3. How can the value of an expression be converted to a different data types? Wh
at is this called?[Answer Tip]
4. What are unary operators? Explain example for each. [Answer Tip][4+4+4+4]
9.
1. Explain the following & illustrate it with an example each.
1. Increment & Decrement operator.[Answer Tip]
2. Conditional operator. [Answer Tip]
3. Bitwise operator. [Answer Tip]
4. Assignment operator. [Answer Tip]
2. State the rules that applied while evaluating expression in automatic type co
nversion. [Answer Tip][12+4]
Loops
10.
1. What is the purpose of break statement? [Answer Tip]
2. Suppose a break statement is included within the innermost of several nested
control statements. What happens when break statement is executed? [Answer Tip]
3. Write a program to print the multiplication table up to 20 with proper format
. [Answer Tip][4+6+6]
Programs
11.
1. Write a program to determine and print the sum of the following harmonic seri
es for a given value of n: 1+1/2+1/3+.....+1/n. [Answer Tip]
2. What are the logical operators used in C and illustrate with examples. [Answe
r Tip][8+8]
12. Write a C program to print the lower triangular of a given square matrix. [A
nswer Tip][16]

Unit II

Syllabus
Designing structured programs, Functions, basics, parameter passing, storage cla
sses- extern, auto, register, static, scope rules, block structure, user defined
functions, standard library functions, recursive functions, header files, C pre
processor, example c programs.
Functions basics
1.
1. What do you mean by functions? Give the structure of the functions and explai
n about the arguments and their return values.[Answer Tip]
2. Write a C program that uses a function to sort an array of integers.[Answer T
ip] [8+8]
2.
1. Distinguish between the following:[Answer Tip]
1. Actual and formal arguments.
2. Global and local variables.
3. Automatic and static variables.
2. Explain in detail about pass by values and pass by reference. Explain with a
sample program [Answer Tip][8+8]
3.
1. Distinguish between formal variable and actual variable.
2. Distinguish between local and global variable.
3. Distinguish between call by value and call by reference. [Answer Tip][4+4+8]
4.
1. What is a preprocessor directive. [Answer Tip]
2. Distinguish between function and preprocessor directive. [Answer Tip]
3. What is the significance of conditional compilation. [Answer Tip]
4. How does the undefining of a pre-defined macro done. [Answer Tip][4+4+4+4]
Recursion
5.
1. What are the advantages and disadvantages of recursion.[Answer Tip]
2. Write a C program to find the factorial of a given integer using a function.
[Answer Tip].
3. Write a recursive algorithm to compute the product of two non negative intege
rs
[3+7+6]
6.
1. Define recursion. What are the properties of recursive definition [Answer Tip
].
2. Write a recursive definition of a + b , where a and b are nonnegative integer
s, in terms of the successor function succ , defined as
succ(x)
int x;
{
return (x++);
}
7. Let a be an array of integers. Present recursive algorithms to compute
1. Maximum element of the array
2. The sum of elements of the array. [8+8]
Programming
8.
1. Write a program to demonstrate passing an array argument to a function. Consi
der the problem of finding largest of N numbers defined in an array.
2. Write a recursive function power (base, exponent) that when invoked returns b
ase exponent. [8+8]
9. Write a C program to find mean, standard deviation and variance of a set of e
lements [16]
10. The roots of a quadratic equation of the form ax2+bx+c = 0 are given by the
following equations:
x1=-b+v(b2-4ac)/2a
x2=-b-v(b2-4ac)/2a
Write a function to calculate the roots. The function must use two pointer Param
eters, one to receive the coefficients a,b and c and the other to send the roots
to the calling function. [16]
11. Write a program that calculates the value of money at the end of each year o
f investment assuming an interest rate of 12 percent and prints the year & corre
- sponding amount in two columns for a period of 10 years with an intial investm
ent of 5 years. Formula: Value at end of year = value at start of year (1+intere
st rate) [16]
12. Write a non-recursive simulation of Towers of Hanoi problem. [16]

Unit III

Syllabus
Arrays- concepts, declaration, definition, accessing elements, storing elements,
arrays and functions, two-dimensional and multi-dimensional arrays, application
s of arrays. pointers- concepts, initialization of pointer variables, pointers a
nd function arguments, address arithmetic, Character pointers and functions, poi
nters to pointers, pointers and multidimensional arrays, dynamic memory manageme
nts functions, command line arguments, c program examples
Arrays
1.
1. In what way array is different from an ordinary variable?
2. What conditions must be satisfied by the entire elements of any given array?
3. What are subscripts? How are they written? What restrictions apply to the val
ues that can be assigned to subscripts?
4. What advantage is there in defining an array size in terms of a symbolic cons
tant rather than a fixed integer quantity?
5. Write a program to find the largest element in an array.[Answer Tip] [3+2+3+3
+5]
2.
1. How are initial values written in a one-dimensional array definition? Is the
entire array be initialized? What value is automatically assigned to those array
elements not explicitly initialized?
2. Write a program to calculate mean, variance and standard deviation of n numbe
rs.[Answer Tip]
S=v variance, where Variance = 1/n S (xi-m)2 M= mean of n numbers. [8+8]
3.
1. Write a C program to do Matrix Multiplications. [Answer Tip]
2. Write in detail about one dimensional and multidimensional arrays. Also write
about how initial values can be specified for each type of array
4. The annual examination is conducted for 50 students for three subjects. Write
a program to read the data and determine the following:
1. Total marks obtained by each student.
2. The highest marks in each subject and the Roll No. of the student who secured
it.
3. The student who obtained the highest total marks. [5+6+5] [Answer Tip]
Pointers
5.
1. What is a pointer? How is a pointer initiated? Give an example.
2. State whether each of the following statements is true or false. Give reasons
.
1. An integer can be added to a pointer.
2. A pointer can never be subtracted from another pointer.
3. When an array is passed as an argument to a function, a pointer is passed.
4. Pointers can not be used as formal parameters in headers to function definiti
ons.
3. If m and n have been declared as integers and p1 and p2 as pointers to intege
rs, then find out the errors, if any, in the following statements.
1. p1 = &m;
2. p2 = n;
3. m=p2-p1;
4. *p1 = &n; [4+6+6]
6.
1. Explain the process of accessing a variable through its pointer. Give an Exam
ple.
2. Write a C program using pointers to read in an array of integers and print it
s elements in reverse order. [Answer Tip][8+8]
7. Write a C Program to compute the sum of all elements stored in an array using p
ointers[Answer Tip].
8.
1. Write a C program using pointer for string comparison.[Answer Tip]
2. Write a C program to arrange the given numbers in ascending order using point
ers. [Answer Tip][8+8]
9.
1. What is a pointer? List out the reasons for using pointers.
2. Write a C Program to illustrate the use of indirection operator * to access t
he value pointed by a pointer.[Answer Tip] [8+8]
10.
1. How to use pointer variables in expressions? Explain through examples.
2. Write a C Program to illustrate the use of pointers in arithmetic operations [A
nswer Tip]. [8+8]
11.
1. Explain the process of declaring and initializing pointers. Give an example.
2. Write a C program that uses a pointer as a function argument.[8+8]
Strings
12. Write a C program using pointers to determine the length of a character string
. [Answer Tip][8+8]
13. Write a program to count the number of words, lines and characters in a text
.[8]
14.
1. Distinguish between getchar and scanf functions for reading strings.
2. Write a program to count the number of words, lines and characters in a text.
[8+8]
15. Write a C program to replace a particular word by another word in a given li
ne of text. [16]

Unit IV

Syllabus
Derived types- structures- declaration, definition and initialization of structu
res, accessing structures, nested structures, arrays of structures, structures a
nd functions, pointers to structures, self referential structures, unions, typed
ef, bitfields, C program examples.
Theory (6 Marks)
1.
1. How to compare structure variables? Give an example.[6]
2. How does a structure differ from an array? [6]
3. Distinguish between an array of structures and an array within a structure. G
ive an example each.[6]
4. Differentiate between a structure and union with respective allocation of mem
ory by the compiler. Given an example of each.[6]
5. Describe nested structures. Draw diagrams to explain nested structure.[6]
6. Distinguish between an array of structures and an array within a structure. G
ive an example each.[6]
7. How are structure elements stored in memory. [6]
Theory (8 Marks)
2.
1. What is structure within structure? Give an example for it.[8]
2. Write a C program to illustrate the comparison of structure variables.[8]
3. Explain the different ways of passing structure as arguments in functions.
4. What is the use of a structure? Given an example for a structure with initial
- ized values. [8]
5. Explain with an example how a structure can be organized in the C language? [8]
6. What are Bit fields. What are its advantages. What is its syntax. [8]
Programming Examples (8 Marks)
3.
1. Write a C program to illustrate the concept of structure within structure. [8
]
2. Write a C program to print maximum marks in each subject along with the name
of the student by using structures. Take 3 subjects and 3 students records. [8]
3. Write a C program to illustrate the method of sending an entire structure as
a parameter to a function. [8]
4. Write a C program to illustrate the comparison of structure variables.
5. What is the use of a structure? Given an example for a structure with initial
ized values. [8]
6. Write a C program to store the information of vehicles. Use bit fields to sto
re the status information. Assume the vehicle object consists of type, fuel and
model member fields. Assume appropriate number of bits for each field.[8]
Programming Examples (10 Marks)
4.
1. Write a program to declare pointer as members of structure and display the co
ntents of the structure. Define a structure object, boy with three fields: name,
age and height. [Answer Tip] [10]
2. Write a C program using structure to create a library catalogue with the foll
owing fields; Access number, author s name. Title of the book, year of publication
, publisher s name, price. [Answer Tip][10]
3. Write a program to create an array of student structure objects and to find t
he highest marks scorer. The fields in the student structure are: name, age and
marks.[Answer Tip][10]
4. Write a C program using structure to read and print the student s records of a
class with the following members.
Field Name Data Type
name string
reg no integer
major string
result string [Answer Tip][10]
5. Define a structure type struct ABS, that contains name, age, designation, and
salary. Using this structure, write a C program to read this information for on
e person from the keyboard and print the same on the screen.[Answer Tip] [10]
6. Write a program to read n records of students and find out how many of them h
ave passed. The fields are student s roll no, name, mark and result. Evaluate the
result as follows
if markes > 35 then
Result = Pass
else
Fail [Answer Tip][10]
Programming Examples (16 Marks)
5. Write a C program to compute the monthly pay of 100 employees using each empl
oyee s name, basic-pay. The DA is computed as 52% of the basic pay. Gross-salary
(Basic pay +DA). Print the employees name and gross salary. [Answer Tip][16]
6. Write a C program to read the information from the keyboard in which the Emplo
yee structure consists of employee name, code, designation and salary. Construct
an array of structures that stores n employees information and write a program t
o carry out operations like inserting a new entry, deleting entry. [16]
7. The annual examination is conducted for 50 students for three subjects. Write
a program to read the data and determine the following:
1. Total marks obtained by each student.
2. The highest marks in each subject and the Roll No. of the student who secured
it.
3. The student who obtained the highest total marks. [Answer Tip][5+6+5]

Unit V

Syllabus
Input and output concept of a file, text files and binary files, streams, standa
rd I/o, Formatted I/o, file I/o operations, error handling, C program examples.
Theory Questions
1.
1. What are the file I/O functions in C. Give a brief note about the task perfor
med by each function.[8]
2. Distinguish between text mode and binary mode operation of a file.[4]
3. What is the task performed by fseek( ) function. What is its syntax. Explain
each parameter in it.[8]
4. Explain the command line arguments. What are the syntactic constructs followe
d in C.[8]
5. Explain the way of defining, opening and closing a file. Also explain the dif
ferent modes of operation.
6. How does an append mode differs from a write mode.[4]
7. Compare between printf and fprint f functions.[4]
Programming Questions
2.
1. Write a program to read an input file and count the number of characters in t
he input file.[Answer Tip][ 8]
2. Write a program to open a pre-existing file and add information at the end of
file. Display the contents of the file before and after appending. [Answer Tip]
[12]
3. Write a C program to read the text file containing some paragraph. Use fseek(
) and read the text after skipping n characters form beginning of the file. [Ans
wer Tip][8]
4. Write a C program to read the input file from command prompt, using command l
ine arguments. [Answer Tip][8]
5. Write a program to copy upto 100 characters from a file to an output array. [
Answer Tip][8]
Programming Examples (16 Marks)
3. Write a C program to read a text file and to count
1. number of characters,
2. number of words and
3. number of sentences and write in an output file. [Answer Tip] [16]
4. Write a C program to replace every 5th character of the data file, using fsee
k( ) command. [16]
5. Write a C program to read information about the student record containing stu
- dent s name, student s age and student s total marks. Write the marks of each studen
t in an output file. [Answer Tip][16]
6. Write a C program to read data from the keyboard, write it to a file called I
NPUT, again read the same data from the INPUT file, and display it on the screen
. [Answer Tip][8+8]
7. Write a program to read a C program file and count the following in the compl
ete C program
1. Total number of statements
2. Total number of opening brackets. [8+8] [Answer Tip]

Unit VI

Syllabus
Searching Linear and binary search methods, sorting Bubble sort, selection sort,
Insertion sort, Quick sort, merge sort.
Searchings
1.
1. Write a C program to search for a given element in the integer array using bi
nary search.[Answer Tip]
2. Derive the time complexity of binary search. [Answer Tip] [8+8]
2.
1. Using linear search delete the number 17 from the list of numbers and give th
e steps. 42,12,10,91,17,59.
2. Write a C program to implement the same. [Answer Tip][8+8]
3.
1. Using linear search delete the number 26 from the list of numbers and give th
e steps. 10,7,17,26,32,92
2. Write a C program to implement the same.[Answer Tip] [8+8]
4. Write a C program to search for a given element in the integer array using bi
nary search. [Answer Tip]
5. Write a C program that searches a value in a stored array using binary search
. What is the time complexity of binary search? [Answer Tip][16]
6.
1. Distinguish between linear and binary search methods.
2. Write an algorithm for non-recursive binary search method. [Answer Tip][8+8]
Sortings
7.
1. Write a C program to sort the elements of an array using Quick sort with suit
able example [Answer Tip]
2. What is the worst case and best case time complexity of the above program?
8.
1. Explain Quick sort with algorithm.
2. Analyse the worst case performance of Quick sort and compare with Selection s
ort. [8+8]
9. Write a C program to sort the elements of an array using Quick sort method wi
th suitable example. [Answer Tip][8+8]
10. Write an algorithm for two-way merge sort. Analyse its time complexity . [8+
8]
11.
1. Write a C program to merge two sorted arrays of integers.[Answer Tip]
2. Derive the time complexity of merge sort. [8+8]
12.
1. compare quick sort and heap sort methods.
2. Explain quick sort method for the elements. 11,51,71,21,61,41,91,31, [8+8]
13. Write an algorithm for performing selection sort when the input elements are
represented as a linked list. [16]
14. Write an algorithm for two way merge sort. Analyse its time complexity. [8+8
]
15. Write an algorithm for quick sort. What is its time complexity. [16]
Others
16. Write a function in C to form a list containing the intersection of the elemen
ts of two lists. [16]
Out of Scope
17.
1. Write a C program to sort given integers using partition exchange sort.
2. Derive the time complexity of partition exchange sort. [8+8]
18.
1. Explain the algorithm for exchange sort with a suitable example.
2. Compare sort and exchange sort [8+8]

Unit VII

Syllabus
Introduction to data structures, singly linked lists, doubly linked lists, circu
lar list, representing stacks and queues in C using arrays and linked lists, inf
ix to post fix conversion, postfix expression evaluation.
Basics
1. Define a data structure. What are the different types of data structures? Exp
lain each of them with suitable example. [4+6+6]
Linked Lists
2. How can a polynomial in three variables (x,y and z) be represented by a singl
y linked list? Each node should represent a term and should contain the powers o
f x, y, and z as well as coefficient of that term. Write a routine evaluate this
polynomial for given values of x,y, and z. [4+6+6]
3. Write a routine to reverse elements of a doubly linked list by traversing the
list only once. [16]
4. Write a C program to insert and delete the elements from circular doubly link
ed list. [16]
5. Write a routine SPLIT() to split a singly linked list into two lists so that
all elements in odd position are in one list and those in even position are in a
nother list. [16]
6. Define linked list. Explain various operations performed on linked lists with
suitable algorithms. [16]
7. Write a C Program to exchange two nodes of a singly linked list. [16]
8.
1. Compare and contrast singly linked list with an array.
2. Write a C program to count the number of nodes in a linked
9. Define input-restricted deque as deque in which insertion is restricted to on
e end and deletion can be made at either end. Write routines to implement operat
ions on this deque. [16
10. Write a C program to create a singly linked list and split it at the middle
and make the second half as the first and vice-versa. Display the final list. [1
6]
11.
1. What are the advantages and disadvantages of linear linked lists.
2. Write the applications of singly linked list, double linked list and circular
linked lists. [5+11]
12.
1. Define a doubly linked list. Write an algorithm to insert and delete a node i
n a doubly linked list.
2. List the applications of doubly linked lists. [12+4]
Stacks
13. Write a C program using pointers to implement a stack with all the operation
s.[16]
14. Declare two stacks of varying length in a single array. Write C routines pus
h1, push2, pop1 and pop2 to manipulate the two stacks. [4x4=16]
15.
1. Given a sequence of push and pop operations and an integer representing the s
ize of an array in which a stack is to be implemented. Design an algorithm to de
termine whether or not overflow occurs. The algorithm should not use a stack.
2. Explain what test is required for exceptional conditions in pop operations. [
8+8]
Queues
16. Declare a circular queue of integers such that F points to the front and R p
oints to the rear. Write functions
1. To insert an element into queue
2. To delete an element from queue. [8+8]
17. Write a C program for implementation of various operations on circular queue
. [16]
18. Circular linked lists are usually set up with so-called list header. What is
the reason for introducing such a header? Write fucntions to insert and delete
elements for this implementation. [4+12]
19. Write a C program using pointers to implement Queue with all operation. [16]
20. Write a C program for implementation of various operations on circular queue
. [16]
1. Write an algorithm for performing insertion of an element into an input- rest
ricted Dequeue.
2. Write an algorithm for performing deletion of an element from an output- rest
ricted Dequeue. [8+8]
21.
1. Mention and explain various types of queues and give an example for each
2. Compare various types of queues. [8+8]
Others
22. Write a program to convert a given prefix expression to postfix expression u
sing stacks. [16]
23. Write in detail about the following:
1. Recursion
2. Applications of Stacks and Queues [8+8]
24. Write a program to convert a postfix expression to a fully parenthesized inf
ix expression. For example, AB+ would be transformed in to (A+B) and AB+C- would
be transformed into ((A+B)-C). [16]
25.
1. Derive a method to convert a postfix expression into its prefix form
2. Consider the following arithmetic expression in postfix notation: 7 5 2 + * 4
1 5 - / -
1. Find the equivalent prefix form of the above .
2. Obtain the computed value of the expression from its postfix notation

Unit VIII

Syllabus
Trees- Binary tress, terminology, representation, traversals, graphs- terminolog
y, representation, graph traversals (dfs & bfs)
Trees
1.
1. Write a C program to implement binary tree traversals. [Answer Tip]
2. Write an algorithm to count the number of leaf nodes in a binary tree. What i
s its computing time? [8+8]
2. Write a C program to copy one binary tree to another binary tree.
3.
1. What is preorder traversal method?
2. Explain a procedure for preorder traversal of a binary tree with an example i
n detail. Analyze the time complexity of your procedure. [8+8]
4. Write a C program to sort a given list of elements using tree sort and discus
s its time complexity. [16]
5.
1. Construct a binary tree for the following preorder and inorder traversals.
1. Pre order : ABCDEFGHIJKLMNOPQ
2. In order : DECFBHGAKMLJIORNQP
2. Prove that a binary tree with n leaves contains 2n-1 nodes. [8+8]
6. Write an algorithm, given the address of an input binary tree, prints the equ
ivalent infix expression with minimum number of paranthesis
7. Write an algorithm for determining whether two binary trees A and B are simil
ar based on the traversal method. [16]
8.
1. Describe different types of trees
2. Write a C program to implement Binary tree. [6+10]
9. Write a C program for creating, inserting and deletion in a Binary tree. [Ans
wer Tip][16]
10. Write a C program to create a tree and traversing the same in preorder and p
ost order [Answer Tip][16]
Graphs
11.
1. List and explain about the basic operations on a graph.
2. Write a C program for depth first search of a graph. [7+9]
12. A digraph is strongly connected if it contains a directed path from i to j a
nd from j to i for every pair of distinct vertices i and j.
1. Show that for every n, n<2 , there exists a strongly connected digraph that c
ontains exactly n edges.
2. Show that every n vertex strongly connected digraph contains at least n edges
where n>2 [8+8]
13.
1. What are the advantages of adjacency matrix representation of graphs
2. Define spanning tree of an undirected graph. [8+8]

Вам также может понравиться