ATA Tructures: Atch Uesday Anuary Ssignments ODE Nstructions
ATA Tructures: Atch Uesday Anuary Ssignments ODE Nstructions
BATCH A
[TUESDAY JANUARY 17, 2017: 2:00 PM 5:00 PM]
INSTRUCTIONS:
i) Please carefully read all assignments and there is no choice.
ii) Each problem in this assignment has to be answered in the same c file.
iii) Create a .c file following the file name convention:
If your roll number is abc and assignment code is: assign02
Then use the following file name convention as follows: abc-assign02.c
For example, if the roll number is 67 and assignment code is assign02
then the file name should be 067-assign02.c
iv) Strictly follow the file name convention.
v) Do not use scanf() or do not use unnecessary print statement.
Just print only those you are asked to do in each assignment.
----------------------
5 3 2 7 3 1 9 1 5
8 7 4 5 1 9 2 3 6
7 5 6 1 6 1 2 1 3
2 2 1 3 2 5 1 5 0
3 1 4 3 8 3 6 1 9
1 3 4 8 6 9 4 1 1
1) [Marks: 2 marks]
Read the matrix and print the same (preserving the rank of the matrix!!)
2) [Marks: 6 marks]
Identify the only one row of integers with which you could create a magic
square of size 3. Print the following:
a) Print the magic square of size 3
b) Find the transpose of that row and sum of that row.
3) [Marks: 5]
Write a program to count the number of paths in the 2-d matrix between the
origin (0, 0) and point (m-1, n-1), where m and n are nonnegative integers,
such that each path is made up of a series of steps, where each step is a move
one unit to the right or a move one unit downward. (No moves to the left or
upward are allowed.)
4) [Marks: 4]
Identify the PASCAL TRIANGLE in the given matrix and print the following:
element and its coordinate (x, y)
For example, the element in the 2nd row 4th column from left can be printed as:
5 (1, 3)
5) [Marks: 5]
Find two columns in such a way that the sum of first column would be
reflexive to the sum of the second column.
6) [Marks: 3]
Construct a square matrix of prime numbers from the above matrix in such a
way that the given matrix is reduced by removing non-prime numbers in each
row and then by adding zero to the tail of each smallest row of prime numbers
so as to make it as a square matrix.
----------------------
DATA STRUCTURES
BATCH B [THURSDAY JANUARY 19, 2017: 2:00 PM 5:00 PM]
NOTES:
1) Please carefully read all assignments and there is no choice.
2) Each problem in this assignment has to be answered in the same c file.
3) Create a .c file following the file name convention:
If your roll number is abc and assignment code is: assign02
Then use the following file name convention as follows: abc-assign02.c
For example, if the roll number is 92 and assignment code is assign02, then
the file name should be 092-assign02.c
4) Strictly follow the file name convention.
5) Do not use scanf() or do not use unnecessary print statement. Just print only
those you are asked to do in each assignment.
----------------------
PROBLEMS [Total Marks: 20]:
1) [Marks: 3]
Compute the sum of first 20 even numbers that are divisible by 3 in [1... 500]
Print the sum as the output.
2) [Marks: 3]
Identify all integers that are divisible by 7 but not 2 in [1, 100].
Print all integers.
3) [Marks: 4]
Identify all nonzero odd factors of any positive integer in [60, 200]
Print all nonzero odd factors in a row with a space
4) [Marks: 5]
Write a program to count the number of even digits in a given number.
Assume a large integer as your input. Print the count as the output.
5) [Marks: 5]
An arithmetic progression (AP) is given by a, (a + d), (a + 2d), (a + 3d), ...
where a = the first term, d = the common difference.
For example, 1, 3, 5, 7, ... is an arithmetic progression with a = 1 and d = 2
Write a program to generate an arithmetic progression up to n where n=100
Compute the sum of the terms in this arithmetic progression.
Print the arithmetic progression and the sum, each in a separate line.
----------------------