113
SEMESTER I CS1302 FUNDAMENTALS OF UNIX & C PROGRAMMING LAB ASSIGNMENT DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Problems in BOLD are optional] 1. Write an interactive program that will read in a +ve integer value and determine the following i) If the integer is a prime number ii) If the integer is a Fibonacci number 2. WAP in C to compute sinx = x – x 3 /3! + x 5 /3! – x 7 /7! ….. Continue adding successive terms in the series until the value of the next term becomes smaller (in magnitude) than 10 -5 . Test the program for x = 1, x = 2, and x = 3. In each case display the number of terms used to obtain the final answer. 3. WAP to generate every 3 rd integer beginning with I = 2 and continue for all integers that are less than 150. Calculate the sum of those integers that are evenly divisible by 5. 4. WAP to find whether a given year is a leap year or not. Modify it to generate a list of leap years between two year limits given by user. 5. WAP to display the following pattern : 11 11 10 11 11 10 9 10 11 11 10 9 8 9 10 11 6. Using Ternary / Conditional operator find the greatest among 3 numbers. 7. WAP to convert a decimal number into an equivalent number of the input base. Test your program for base 2,8,10 & 16. 8. WAP to read a number n, and print it out digit-by-digit, as a series of words. For e.g. 123 would be printed as “one two three”. 9. WAP to check whether any input +ve integer is palindrome or not. 10. WAP to simulate a simple calculator (+ - / * %) that takes two operands and an operator as input and displays the result. 11. WAP to find the GCD of two input +ve integer numbers. 12. WAP to swap the values of two variables without using a third variable. 13. Read a line of mixed text, and then write it out with all lower case and uppercase letters reversed, all digits replaced by 0s and all other characters (non-letters and non-digits) replaced by ‘*’. 14. WAP to find the product of two matrices A and B. Display the source matrices and product matrix C in matrix format. 15. WAP to find whether a given matrix is a triangular matrix or not.

d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER I

CS1302 FUNDAMENTALS OF UNIX & C PROGRAMMING LAB ASSIGNMENTDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

[Problems in BOLD are optional]1. Write an interactive program that will read in a +ve integer value and determine the followingi) If the integer is a prime number ii) If the integer is a Fibonacci number2. WAP in C to compute sinx = x – x3/3! + x5/3! – x7/7! ….. Continue adding successive terms in the

series until the value of the next term becomes smaller (in magnitude) than 10 -5. Test the program for x = 1, x = 2, and x = 3. In each case display the number of terms used to obtain the final answer.

3. WAP to generate every 3rd integer beginning with I = 2 and continue for all integers that are less than 150. Calculate the sum of those integers that are evenly divisible by 5.

4. WAP to find whether a given year is a leap year or not. Modify it to generate a list of leap years between two year limits given by user.

5. WAP to display the following pattern :11

11 10 1111 10 9 10 11

11 10 9 8 9 10 116. Using Ternary / Conditional operator find the greatest among 3 numbers.7. WAP to convert a decimal number into an equivalent number of the input base. Test your program

for base 2,8,10 & 16.8. WAP to read a number n, and print it out digit-by-digit, as a series of words. For e.g. 123 would be

printed as “one two three”.9. WAP to check whether any input +ve integer is palindrome or not.10. WAP to simulate a simple calculator (+ - / * %) that takes two operands and an operator as input

and displays the result.11. WAP to find the GCD of two input +ve integer numbers.12. WAP to swap the values of two variables without using a third variable.13. Read a line of mixed text, and then write it out with all lower case and uppercase letters reversed,

all digits replaced by 0s and all other characters (non-letters and non-digits) replaced by ‘*’.14. WAP to find the product of two matrices A and B. Display the source matrices and product matrix

C in matrix format.15. WAP to find whether a given matrix is a triangular matrix or not.16. WAP to find the transpose of a matrix. Display the source and the transposed matrix in matrix

format.17. Implement Prob. No. – 14 to 16 using functions for reading, manipulating and displaying the

corresponding matrices in matrix form.18. WAP to sort a list of strings alphabetically using a 2-dim. Character array.

19. WAP to display the row sum and the column – sum of an input 2- dim. Matrix. Display the source matrix with row and column sum.

20. Write a recursive function to calculate S = 2 + 4 + 6 + 8 + …… +2N. Implement the function in a complete C program.

21. Write a function that accepts two arguments an array and its size n. It performs Bubble up sort on the array elements. Using indirection operator ‘*’ implement this in a complete C program. Display the source and the sorted array.

22. Using pointer, write a function that receives a character string and a character as argument. Delete all occurrences of this character in the string. The function should return corrected string with no holes.

23. Write a function for reading character string using pointer. Calculate the length of the string (without using strlen ()). Finally print the string in reverse order, using pointer.

24. Implement prob. No. 14 using pointers representation of 2 – dim. array.25. Implement prob. No. 15 using pointer representation of 2 dim. array.

Page 2: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

26. Implement prob. No. 16 using pointer representation of 2 dim. array.27. WAP to sort a list of strings into alphabetical order using array of pointers.28. Create records of 60 students, where each record has fields-name, roll, gpa and fees. Write a

function update () to reduce the fees of those students who have obtained gpa greater than 8.5 by 25% of the original fees. Write a complete program to exercise this function in the main program and display all the records before and after updation.

29. Define a structure that describes a hotel. It should have members that include the name, address, grade, average room charge and number of rooms. Write a function to perform the following operations:

a) To print out hotels of a given grade in order of charges.b) To print out hotels with room charges less than a given value.

30. WAP to concatenate the contents of two files into a third file.31. WAP to copy the content of one file into another file. Names of both the files are to be input

as command line arguments.32. The call sort +r to the program sort.c should sort an input list of element in ascending order and

display the list before sorting & after sorting.33. Perfrom operations with the following unix commands. (a) mkdir (b) cd .. (c) pwd (d) ls (e) who (f)tty (g) vi (h) cp (i) mv (j) rm (k) rmdir34. Perform operations with the following vi editior commands in unix.

J, k, l, :wq!, :q!, nx , ndw, ndd , nyy & p, :se nu, i, a, Esc.

***************

Page 3: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER IICS2201 DATA STRUCTURES TUTORIAL SHEET

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRAModule – I1. How can you define algorithms? Discuss structure and properties of algorithms.2. Define and Classify data structures.3. How does one measure the efficiency of algorithms?4. Distinguish between best, worst and average case complexities of an algorithm.5. Define O, Ω and Θ notations of time complexity.6. Compare and contrast exponential time complexity with polynomial time complexity.7. How are recursive programs analyzed?8. Analyze the time complexity of the following program:

for send = 1 to n dofor receive = 1 to send do

for ack = 2 to receive doMessage = send – (receive + ack);

endend

end9. Solve the recurrence relation:

S(n) = 2 • S(n – 1) + b • n, if n > 1 = a, if n = 1

Module – II10. Distinguish between row major and column major ordering of an array.11. For an n-dimensional array [1 : u1, 1: u2, … 1 : un] obtain the address of the element A[i1, i2, i3, … in]

given β to be the home address.12. Declare a one, two and a three-dimensional array in a programming language ( C/C++) which has the

capability to display the addresses of array elements. Verify the various address calculation formulae for any arbitrary element of these arrays.

13. Open an ordered list L[d1, d2, … dn] where each di is the name of a peripheral device, which is maintained in the alphabetical order. Write a program to

a. Insert a device dk onto the list L.b. Delete an existing device di from L. In this case the new ordered list should be Lnew = (d1,

d2, … di-1, di+1, … dn) with (n – 1) elements.c. Find the length of L.d. Update the device dj to dk and print the new list.

14. How are insert operations carried out in a stack?15. What are demerits of a linear stack?16. If a stack S[1 : N] were to be implemented with the bottom of the stack at S[N], write a procedure to

undertake push and pop operations on S.17. For the following logical expression

( a and b and c) or d or e or (not h)(i) Obtain the equivalent postfix expression.(ii) Evaluate the postfix expression for a = true, b = false, c = true, d = true, e = true, h = false.

18. Implement a stack S of n elements using arrays. Write functions to perform PUSH and POP operations. Implement queries using push and pop functions to

a. Retrieve the mth element of the stack S from the top (m < n), leaving the stack without its top m – 1 elements.

Page 4: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

b. Retain only the elements in the odd position of the stack and pop out all even positioned elements.

19. Write a recursive program to obtain the nth order Fibonacci sequence number. Include appropriate input/output statements to track the variables participating in recursion.

20. Implement a program to evaluate any given postfix expression. Test your program for the evaluation of the equivalent postfix form of the expression ( - (A*B)/D) ↑ C + E – F * H * I for A = 1, B = 2, D = 3, C = 14, E = 110, F = 220, H = 16.78, I = 364.621.

21. What are the disadvantages of the linear queues? How do circular queues help overcome the disadvantages of linear queues?

22. If FRONT and REAR were pointers to the physical front and rear of a linear queue, comment on the condition, FRONT = REAR.

23. How priority queues are implemented using a single queue?24. Write a program to maintain a list of items as a circular queue which is implemented using an array.

Simulate insertions and deletions to the queue and display the content of the queue after every operation.

25. Let PQUE be a priority queue data structure and a1( p1) , a2

( p2), an( pn) be n elements with priorities pi ( 0

≤ pi ≤ m – 1). Implement PQUE as a two dimensional array ARR_PQUE[1:m, 1:d] where m is the number of priority values and d is the maximum number of data items with a given priority. Execute insertions and deletions presented in a random sequence.

26. Implement a deque DQUE in a one dimensional array.

Module – III27. What is the need for linked representation of lists?28. What are the advantages of circular lists over singly linked lists?29. What are the advantages and disadvantages of doubly linked lists over singly linked lists?30. What is the use of a head node in a linked list?31. What are the conditions for testing a linked list T is empty, if T is a (i) Simple singly linked list (ii)

headed singly linked list (iii) Simple circularly linked list and (iv) headed circularly linked list?32. Sketch a multiply linked list representation for the following sparse matrix:

-9 0 0 00 0 0 00 5 0 20 7 0 5

33. Demonstrate the application of singly linked lists for the addition of the polynomials P 1 and P2 given below:

P1: 19x6 + 78x4 + 6x3 – 23x2 – 34P2: 67x6 + 89x5 – 23x3 – 75x2 – 89x -21

33. Let X = (x1, x2, … xn), Y = (y1, y2, …yn) be two lists with a sorted sequence of elements. Write a program to merge the two lists together as a single list Z with m + n elements. Implement the lists using singly linked list representations.

34. Write a program which will split a circularly linked list P with n nodes into two circularly linked lists P1, P2 with the first ⌊n/2 ⌋ and the last n - ⌊n/2 ⌋ nodes of the list P in them, respectively.

35. What are the merits of linked stacks and queues over their sequential counterparts?36. How is the memory storage pool associated with a linked stack data structure for its operations?37. How are push and pop operations implemented on a linked stack?38. What are traversable queues?39. Outline the node structure and a linked queue to represent the polynomial: 17x5 + 18x2 + 9x + 89.40. Write a program to evaluate a postfix expression using a linked stack implementation.

Page 5: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

8

4 9

1

75

Module – IV41. Distinguish between digraphs and undirected graphs.42. For a graph of your choice, trace its (i) adjacency matrix and (ii) adjacency list representations.43. Draw graphs that contain (i) an Eulerian walk and (ii) a Hamiltonian circuit.44. How can graph traversal procedures help in detecting graph connectivity?45. Discuss an algorithm for finding minimum cost spanning tree.46. Implement Dijkstra’s algorithm to obtain shortest path from a given source vertex (of your choice) to

every other vertex of a graph of your choice which must at least 10 nodes with 5 cycles.

Module - V47. Sketch (i) an array representation and (ii) a linked representation for the binary tree shown in figure 1.

48. Sketch a linked representation for a threaded binary tree equivalent of the binary tree shown in fig. 1.49. Obtain inorder and post order traversals for the binary tree shown in fig. 1.50. Draw an expression tree for the following logical expression: p and (q or not k) and (s or b or h)51. Given the following inorder and preorder traversals, trace the binary tree.

Inorder traversal: B F G H P R S T W Y Z Preorder traversal: P F B H G S R Y T W Z.52. Write a program to implement a binary tree using linked representation. Use functions to traverse it in

inorder, preorder and post order.53. Write a recursive function to count the number of nodes in a binary tree.54. Write non-recursive functions to perform inorder, preorder and post order traversals of a binary tree.55. How is binary search tree representation of lists advantageous over their sequential list

representations?56. How is the deletion of a node that has both left and right subtrees, undertaken in a binary search tree?57. What is the need for an AVL Tree?58. How is the rotation free deletion of a node having both the subtrees, done in an AVL search tree?59. For the data list { AND, BEGIN, CASE, DO , END , FOR, GOTO, IF, IN, LET, NOT, OR, QUIT,

READ, REPEAT, RESET, THEN, UNTIL, WHILE, XOR}a. Construct a binary search tree. What are your observations?b. Construct an AVL search tree.

60. What are the merits of m-way search trees over AVL search trees?61. What are the demerits of m-way search trees?62. What is the need for B trees?63. What is the height of a B tree of order m?64. Insert the following elements in the order given into an empty B tree of order (i) 3 (ii) 4 and (iii) 7: Z R

T A D F H Q W C V B S E O P L J K M N U T X.Undertake the following operations on the B trees: (i) delete Q (ii) delete A (iii) delete M

65. For the data list given in Question 63, construct a 3-way search tree. Insert G and delete J K and Z from the search tree.

Fig. 1

Page 6: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

Module – VI66. Distinguish between internal sorting and external sorting.67. When is a sorting process said to be stable? Why is bubble sort stable?68. What is the principle behind Shell sort?69. Distinguish between a heap and a binary search tree. Give an example.70. Can bubble sort ever perform better than quick sort? If so, list a case.71. Trace Quick sort on the following list L = { 123, 678, 345, 225, 890, 345, 111, 654, 789, 144, 324,

209}.

Module – VII72. What are the advantages of binary search over sequential search?73. When is a transpose sequential search said to be most successful?74. What is the principle behind interpolation search?75. For the following search list undertake (i) linear ordered search (ii) binary search in the data list given.

Tabulate the number of comparisons made for each key in the search list.Search list: {766, 009, 999, 238}Data list: {111, 453, 231, 112, 679, 238, 876, 655, 766, 877, 988, 009, 122, 233, 344, 566}

76. For the given data list and search list, tabulate the number of comparisons made when (i) a transpose sequential search and (ii) interpolation search is undertaken on the keys belonging to the search list.Data list: {pin, ink, pen, clip, ribbon, eraser, duster, chalk, pencil, paper, stapler, pot, scale, calculator}Search list: {pen, clip, paper, pin, calculator}

Page 7: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER IICS2302 DATA STRUCTURES LAB ASSIGNMENTS

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRAThe questions appearing in BOLD are optional and carry more credit.

1. Write a program to create a one dimensional array at run time using a user defined function with user given number of elements into it. Also write separate functions that would allow you to insert and delete elements into/from this array at any arbitrary location.

2. WAP to add and subtract following polynomials 5x2 – 3xy + y, 2x2 – y2 + 5xy – x + y using array.3. Write a program to create one dimensional, two dimensional and three dimensional arrays in memory

and then verify the various address calculation formulae for any arbitrary element of these arrays.4. Write a program to obtain a sparse matrix representation B for the matrix A given below

0 1 0 0 0 00 0 0 0 0 0-2 0 0 1 0 00 0 0 0 0 00 0 0 0 0 00 -3 0 0 0 00 0 0 0 0 1

5. Write a program to create an ordered list L[d1, d2, … dn] where each di is the name of a peripheral device, which is maintained in the alphabetical order. Write functions to

a. Insert a device dk onto the list L.b. Delete an existing device di from L. In this case the new ordered list should be Lnew =

(d1, d2, … di-1, di+1, … dn) with (n – 1) elements.c. Find the length of L.d. Update the device dj to dk and print the new list.

6. Write a program to implement a stack in an array and perform PUSH, POP, PEEP and CHANGE operations on it using functions.

7. WAP to convert the following expression to its postfix equivalent using stack

a. ((A + B )* D) ^ (E – F)b. A + (B * C – (D / E ^ F) * G) * H Where ^: raise to the power

8. Implement a stack S of n elements using arrays. Write functions to perform PUSH and POP operations. Implement queries using push and pop functions to

a. Retrieve the mth element of the stack S from the top (m < n), leaving the stack without its top m – 1 elements.

b. Retain only the elements in the odd position of the stack and pop out all even positioned elements.

9. Implement a program to evaluate any given postfix expression. Test your program for the evaluation of the equivalent postfix form of the expression ( - (A*B)/D) ↑ C + E – F * H * I for A = 1, B = 2, D = 3, C = 14, E = 110, F = 220, H = 16.78, I = 364.621.

10. WAP to implement linear queue using array and linked list.11. WAP to implement circular queue using array and linked list.12. WAP to declare a priority queue using two-dimensional array, store elements and priority. Display the

elements according to priority from higher to lower.13. A deque DQUE is to be implemented using a one dimensional array of size N. Write functions

to:a. Insert and delete elements from DQUE at either ends.b. Implement DQUE as input restricted deque.

Page 8: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

c. Implement DQUE as output restricted deque.

14. Write a menu driven program to perform the following operations on a singly linked list.a. Createb. Insertc. Deleted. Displaye. Exit.

15. WAP to create a sorted one way linked list with n nodes. Extend the program to insert a new node at appropriate location so that order does not get disturbed.

16. WAP to create a circular list and then count the number of nodes into it.17. WAP to implement doubly linked list having facilities to insert a node at any position and to delete a

node with particular information.18. Let X = (x1, x2, … xn), Y = (y1, y2, …yn) be two lists with a sorted sequence of elements. Write a

program to merge the two lists together as a single list Z with m + n elements. Implement the lists using singly linked list representations.

19. Write a program which will split a circularly linked list P with n nodes into two circularly linked lists P1, P2 with the first ⌊n/2 ⌋ and the last n - ⌊n/2 ⌋ nodes of the list P in them, respectively.

20. Write a menu driven program which will maintain a list of car models, their price, name of the manufacturer, engine capacity etc., as a doubly linked list. The menu should make provisions for inserting information pertaining to new car models, delete obsolete models, and update data such as price besides answering queries such as listing all car models within a price range specified by the user and listing all details given a car model.

21. WAP to evaluate a postfix expression using a linked stack implementation.22. WAP for creation of binary tree and traverse it in Pre, Post and Inorder. Show the traversal output.23. WAP to construct an expression tree for a given arithmetic expression, check its correctness by

traversing it in inorder.24. WAP to count the no. of leaf nodes in a binary tree.25. Write non-recursive functions to perform the inorder, preorder and postorder traversals of a

binary tree.26. Implement a menu driven program to perform the following operations on a binary search tree:

a. Construct a BST (Construction begins from an empty tree)b. Insert element(s) into a non empty BSTc. Delete element(s) from a non empty BSTd. Search for an element in a BSTe. Retrieve elements of the BST in the sorted order.

27. WAP to input a graph G = (V, E) as an adjacency matrix. Include functions to a. Test if G is complete.b. Obtain the degree of a node u, if G is undirected, and indegree and outdegree of node u if

G is directed.28. WAP to input a graph G = (V, E) as an adjacency list. Include two functions BFT and DFT to

undertake breadth first traversal and depth first traversal of the graph.29. WAP to implement Shell sort, Quick sort and heap sort for any arbitrary set of elements with the help

of user defined functions.30. Implement a binary search on an ordered list. For the list L = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,

15, 16, 17, 18, 19, 20} undertake search for the elements in the list {3, 18, 1, 25}. Compare the number of key comparisons made during the searches.

Page 9: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER - III

CS 3102 JAVA PROGRAMMING LAB ASSIGNMENTSDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

CS & IT

Day-1, 2, and 3: Use of Constants, Variables, and Data types; Use of Operators and Expressions; Decision Making and branching; Decision Making and Looping; Strings; Arrays.

Note: The questions marked * are for home work. You are expected to solve 4 questions in each regular laboratory session and solutions for 3 home work problems to be shown in the next class. Failing which, the sessional marks for that class will not be considered.Cheating in any form is strictly intolerable.

Q-1 The parameter weekday is true if it is a weekday, and the parameter vacation is true if we are on vacation. We sleep in if it is not a weekday or we're on vacation. Return true if we sleep in.

Q-2 Given two int values, return their sum. Unless the two values are the same, then return double their sum.

Q-3 Given an int n, return the absolute difference between n and 21, except return double the absolute difference if n is over 21.

*Q-4 Given 2 ints, a and b, return true if one if them is 10 or if their sum is 10.

*Q-5 Given 2 int values, return true if one is negative and one is positive. Unless negative is true, then they both must be negative.

Q-6 Given a string, return a new string where the first and last chars have been exchanged. frontBack("code") → "eodc" frontBack("a") → "a" frontBack("ab") → "ba"

Q-7 Given a string, take the last char and return a new string with the last char added at the front and back, so "cat" yields "tcatt". The original string will be length 1 or more. backAround("cat") → "tcatt" backAround("Hello") → "oHelloo" backAround("a") → "aaa"

*Q-8 Given a string, return true if the string starts with "hi" and false otherwise.

Q-9 Given three int values, A B C, return the largest.

Q-10 Given 2 positive int values, return the larger value that is in the range 10..20 inclusive, or return 0 if neither is in that range.

*Q-11 Given a string, return a new string where the last 3 chars are now in upper case. If the string has less than 3 chars, uppercase whatever is there. Note that str.toUpperCase() returns the uppercase version of a string.

Q-12 Given n of 1 or more, return the factorial of n, which is n * (n-1) * (n-2) ... 1. Compute the result recursively (without loops).

Page 10: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

Q-13 The fibonacci sequence is a famous bit of mathematics, and it happens to have a recursive definition. The first two values in the sequence are 0 and 1 (essentially 2 base cases). Each subsequent value is the sum of the previous two values, so the whole sequence is: 0, 1, 1, 2, 3, 5, 8, 13, 21 and so on. Define a recursive fibonacci(n) method that returns the nth fibonacci number, with n=0 representing the start of the sequence.

Q-14 Given a non-negative int n, return the sum of its digits recursively (no loops). Note that mod (%) by 10 yields the rightmost digit (126 % 10 is 6), while divide (/) by 10 removes the rightmost digit (126 / 10 is 12).

*Q-15 Given a non-negative int n, return the count of the occurrences of 7 as a digit, so for example 717 yields 2. (no loops). Note that mod (%) by 10 yields the rightmost digit (126 % 10 is 6), while divide (/) by 10 removes the rightmost digit (126 / 10 is 12).

Q-16 Write a program to find the number of and sum of all integers greater than 200 that are divisible by 7.

*Q-17 Given any number, write a program using while loop to reverse the digits of the number.

Q-18 Write a program to determine the sum of the following harmonic series for a given value of n: 1+1/2+1/3+ ----- +1/n The value of n should be given interactively through the keyboard.

*Q-19 Write a program that computes the area of a triangle. The sides of triangle should be given interactively through the keyboard.

*Q-20 Write a program to sort any list of given numbers.

*Q-21 Write a program to add two 3 by 3 matrices.

Day 4, 5, 6: Inheritance programming techniques

Q-22 Write a java code to find the distance from Ranchi to major cities of India. Hint: Create an String array of major cities and integer array of distances. User gives the city name and the same is searched (use binary search) in the respective array and displays result.

Q-23 Write a Patient class which inherits from the Person class. You may also need to use the Money class. The Patient class requires the following:

a variable to store the patient number for the patient a variable to store the hospital a variable to store the patient 's year of joining the hospital a variable to store the patient 's address a variable to store the medical fees that the patient pays constructor methods, which initialise the variables methods to set the hospital , year of joining and address methods to get the hospital, year of joining and address a method to calculate the medical fees : It should take a Money object (the basic fee per year)

as a parameter and use it to return the basic fee for the patient. A patient should pay the basic fee for the year of R 1200, 50.

a toString method

Q-24: a. Explain the difference between early and late/dynamic binding. b. Which keyword can be used to indicate that a method cannot be overridden with

a new definition in a derived class? c. Give the code for an abstract method called getArea() that calculates and returns

Page 11: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

the area of a shape as a double.

Q-25: A small company dealing with transportation has just purchased a computer for its new automated reservations system. You have been asked to program the new system. You are to write a program called ReservationSystem to assign seats on a vehicle. Your class also requires the following:a constructor method, which initialise the variablesa method to assign the capacity of seating.a method for assigning seats. Use a 1-d array to represent the seating chart of the plane. Initialize all the elements of the array to 0 to indicate that all the seats are empty. As each seat is assigned, set the corresponding elements of the array to 1 to indicate that the seat is no longer available. Your program should, of course never assign a seat that has already been assigned.appropriate mutator and accessor methods

The company also needs a program dealing especially with its only plane with each flight having a capacity of 10 seats. Name this class AirlineReservationSystem. This class is a type of ReservationSystem but the way it reserves seats are different.

Your program should display the following menu of alternatives for reserving a seat on the flight:

Please type 1 for “smoking”

Please type 2 for “non-smoking”

If the person types 1,then your program should assign a seat in the smoking section(seats 1-5) If the person types 2,then your program should assign a seat in the non-smoking section(seats 6-10). Your program should then print a boarding pass indicating the person’s seat number and whether it is in the smoking or non-smoking section of the plane.

When the smoking section is full, your program should ask the person if it is acceptable to be placed in the non-smoking section (and vice versa). If yes, then make the appropriate seat assignment. If no, then print the message “Next flight leaves in 3 hours.”

Create a main() method to test the next scheduled flight.

Q-26: Create a superclass, Student, and two subclasses, Undergrad and Grad. The superclass Student should have the following data members: name, ID, grade, age, and

address. The superclass, Student should have at least one method: boolean isPassed (double grade)The purpose of the isPassed method is to take one parameter, grade (value between 0 and 100) and check whether the grade has passed the requirement for passing a course. In the Student class this method should be empty as an abstract method. The two subclasses, Grad and Undergrad, will inherit all data members of the Student class

and override the method isPassed. For the UnderGrad class, if the grade is above 70.0, then isPassed returns true, otherwise it returns false. For the Grad class, if the grade is above 80.0, then isPassed returns true, otherwise returns false.

Create a test class for your three classes. In the test class, create one Grad object and one Undergrad object. For each object, provide a grade and display the results of the isPassed method.

Q-27: a. How do you use the scope of class members and methods to hide information

Page 12: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

from other classes?b. When should you use inheritance programming techniques to solve problems? c. What are the benefits of using inheritance? To save time? Shorter programs?d. Java can deal with single inheritance (one superclass with multiple subclasses). How can a

class inherit from more than one superclass (multiple inheritances)?

Q-28: Create an applet program for Banner; banner text (Your Roll No.) should be passed as parameter. This applet creates a thread that scrolls the message contained in message right to left across the applet's window & also uses status window.

Q-29: Create an applet program for Menu demonstration. Menu bar should contain File, Edit, View and its submenus.

Q-30: Create Labels (One, Two & Three), add Buttons (Yes, No, Undecided) when user click any button show message regarding user click, add Checkboxes(Windows 98/XP, Windows NT/2000) when user chose any checkbox show message regarding user choice & add text boxes (name, password) and text on these textboxes should be displayed on Panel.

Q-31: Draw colour lines, Rectangle, Filled Rectangle, Rounded Rectangle, Filled Rounded Rectangle, Oval, Filled oval, arc, fill arc, & polygon every drawing shape should be in different colour, Write a text “hello everyone” at the center.

Q-32: Create an applet program for key events it should recognize normal as well as special keys & should be displayed on the panel.

Q-33: Create an applet program for mouse events it should recognize mouse entry, exit, and its coordinates.

Tip: When a web page is to be developed, the following are to be planned:1. Content of the page2. Appearance of the page

Appearance of the page is coded in HTML using HTML tags.

Q-34: Design a HTML page (web page) describing your profile in one paragraph. Design in such a way that it has a heading, a horizontal rule, three links and a photo of your institution. Also, write three HTML documents for the links.

Q-35: Prepare a HTML page listing popular car companies. For each company prepare a sub-list showing various brands of cars it offers.

Q-36: Write a HTML document to draw the following table.

Prices of flats in Chennai 2006Area Type of house Rate in rupees/sq. ft.

Annanagar Ordinary 1800 Delux 1950

Adyar Ordinary 2450 Delux 2775

Egmore Ordinary 2000 Delux 2125

Q-37: Write a HTML document/page that has 3 frames. The window must be row

Page 13: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

Application for Admission

Name DOB O Male O Female

SUBMIT

wise divided into two frames first and the bottom frame is divided into two frames column wise.

Q-38: Write a HTML document showing a password field. When password is entered, the asterisk symbols must be displayed in place of password in the input field.

Q-39: Design the following form using HTML.

Q-40: Write HTML/Javascript code for the page showing check boxes, text box and submit button. The user selects the check box(es) and once the user clicks submit button the selected check box items appear in the text box.

Q-41: Write HTML/Javascript code for the page showing currency conversion. The user enters the amount in rupees in the text box and selects a patrticular radio button for the currency conversion. On checking it must display the amount in the corresponding currency.

Q-42: Write HTML/Javascript code for the page showing a select box and a text box. The select box contains a list of names. When the user selects a name from the select box the corresponding phone number appears in the phone number input box.

Q-43: Write HTML/Javascript code for the page having three text boxes and a submit button. The three text boxes are email id, age and name. The email id text box has to contain @ symbol, age should be greater than 1 and less than or equal to 100 and name should not exceed 10 characters. If the email id doesnot contain @ symbol an alert message is fired. Similarly for age and name the corresponfing alert message is fired.

Page 14: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER III

CS 3104 DIGITAL ELECTRONICS LABORATORY LAB ASSIGNMENTSDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

COMPULSORY EXPERIMENTS:

1. Design and realization of Parity bit checker using IC 7486

2. Design and realization of 4:2 line encoder using IC 7432

3. Design and realization of 4-bit magnitude comparator using IC 7485

4. Assembling of a seven segment display using IC 7447 and IC 7404

5. Design and testing of SR and JK Flip-flop using IC 7400 & IC 7402

6. Design of a 2-bit binary parallel adder using IC CD4030 and IC CD4081

7. Design of an Astable Multivibrator (using IC 555 Timer) and observe the output waveforms

8. Design of an Monostable Multivibrator (using IC 555 Timer) and observe the output waveforms

9. Design and testing of 2:1 multiplexer and CMOS switch using IC CD4066

10. Design of a 4-bit serial in serial out shift register using IC CD4027 and 555 timer

11. Design of a Modulo-9 ripple counter using IC CD4029 and IC CD4091

12. Design of a Schmitt Trigger Circuit (using IC 741 OPAMP) and observation of the output waveforms

OPTIONAL EXPERIMENTS:

13. i. Design and realization of Binary to Gray code converter using IC 7486ii. Design and realization of Gray to Binary code converter using IC 7486

14. Design of an EX-OR gate using minimum number of 2 input NAND gates IC7400

15. Design and realization of an odd parity generator using IC7486

16. Design of a 1-bit half substractor using IC CD4066

17. Design and realization of 4:16 Decoder using 1:4 De-multiplexer

18. Design of a modulo 256 ripple counter using IC7493

19. Design of a 4 :16 line decoder using IC CD4514

20. Reading 8 specified address location of a programmed IC Intel 2716

Page 15: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

21. Storing a nibble in an IC 2114 RAM and read it

SEMESTER-IV

CS 4103 SCIENTIFIC COMPUTING LAB ASSIGNMENTDEPARTMENT OF APPLIED MATHEMATICS, B. I. T. MESRA

1. Write a program to find the n-th root of a number by Newton Raphson method.2. Write a program to find the real root of the equation Cosx –xex = 0.3. Write a program to find the real root by bisection method for the equation x3 – 5x +1 = 0.4. Write a program for solving n equations in n unknowns using Gaussian elimination.5. Write a program for solving n equations in n unknowns using Gauss Jordan method.6. Write a program for solving n equations in n unknowns using Gauss Siedel method.7. Write a program on Newton’s forward difference interpolation formula8. Write a program on Lagrange’s interpolation formula.9. Write a program to find the approximate value of ∫0 dx/(1+x) by Trapezoidal rule and find the

error.10. Write a program to find the approximate value of ∫0 dx/(1+x) by Simpson’s 1/3rd rule and find the

error.11. Write a program to prepare a frequency table.12. Write a program to compute A. M., G. M. , H. M. , Median, Mode, Variance, Range, Standard

Deviation, Coefficient of Variation of n observations.13. Write a program to generate n Binomial variates with parameters m and p and sort them in

ascending order of magnitude.14. Write a program to generate n Poisson variates with parameter λ and sort them in ascending order

of magnitude.15. Write a program to generate n Normal variates with parameters μ and σ2 and sort them in

ascending order of magnitude.16. Write a menu driven program to accomplish test of mean for one sample (large or small as per

user’s choice).17. Write a menu driven program on the test of single and two proportions.18. Write a menu driven program for testing the equality of means for two Normal Populations

assuming equal variances (large or small sample as per user’s choice).19. Write a program for testing the equality of variances of two Normal populations.20. Write menu driven a program for Chi-Square tests of goodness of fit and pxq contingeny tables.

Page 16: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER-IV

CS 4107 OPERATING SYSTEM TUTORIAL SHEETDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

Introduction

1. What are the main purposes of an operating system?2. In a multiprogramming and time-sharing environment several users share the system simultaneously.

This situation can result in various security problems.a. Explain any two such problems?b. Can we ensure the same degree of security in a time shared machine as we have in dedicated

machine? Explain your answer.3. Define the essential properties of the following types of operating systems:

a. Batch b. Time sharing c. Real time d. Parallel e. Distributed4. Distinguish between multiprogramming and multi processing. What are the key motivations of

development of each?5. What is the primary advantage of distributed operating system?6. How does the distinction between monitor mode and user mode function as a rudimentary form of

protection system?7. What are the differences between a trap and an interrupt? What is the use of each function?8. Which of the following instruction should be privileged and why?

a. Set value of timer f. Load bound registersb. Read the clock g. Forcibly terminate an I/O operationc. Clear memory h. Mask off some interruptsd. Turn off interrupts i. Load a value in a CPU registere. Switch from user to monitor mode

9. The CPU should be in the privileged mode while executing the kernel code and in the user mode (i.e. non-privileged mode) while executing a user program. Explain how this is achieved during operation of an OS.

10. Give two reasons why caches are useful, what problems do they solve? What problems do they cause? If a cache can be made as large as the device for which it is caching (for instance, a cache as large as a disk), why not make it that large and eliminate the device?

11. What is the purpose of system calls? Explain with an example.12. There are no instructions smaller than microcode instruction. (True/false)

File Systems

13. Some systems automatically delete all user files when a user logs off or a job terminates, unless the user explicitly requests that they be kept; other systems keep all files unless the user explicitly deletes them. Discuss the relative merits of each approach.

14. Why do some systems keep track of the file, while others leave it to the users or simply do not implement multiple file types? Which system is “better”?

15. Some systems provide file sharing by maintaining a single copy of a file; other systems maintain several copies, one for each of the users sharing the file. Discuss the relative merits of each approach.

16. In some systems, a subdirectory can be read and written by an authorized user, just as ordinary files can be.a. Describe the protection problem that could arise.

Page 17: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

b. Suggest a scheme for dealing with each of the protection problems you named in part a.17. Explain the advantages and disadvantages of contiguous file allocation scheme.18. Compare index file allocation to noncontiguous file allocation.19. Define physical record. Which is better of the following (i) fixed length record (ii) variable length

record?20. What convention should a file system support to minimize the need of lengthy pathnames in a

hierarchical file system?21. Differentiate between soft link and hard link.22. Compare logical backups and physical backups.23. How does file system keep track of free spaces? Elaborate how free space management is done?24. What are the various responsibilities of a file system?

CPU Scheduling

25. Describe the actions taken by the operating system to switch context between processes.26. Define the difference between preemptive and non-preemptive scheduling. State why strict non-

preemptive scheduling is unlikely to be used in a computer center.27. Consider the following set of processes, with the length of the CPU-burst time given in

milliseconds:Process Burst time Priority

P1 10 3P2 1 1P3 2 3P4 1 4P5 5 2

The processes are assumed to have arrived in the order P1, P2 …. P5 all at time 0. a. Draw four Gantt charts illustrating the execution of these process using FCFS, SJF, a non-

preemptive priority, and RR(quantum = 1) scheduling.b. What is the turnaround time of each process for each of the scheduling algorithms in part a.c. What is the waiting time of each process for each of the scheduling algorithms in part a.d. Which of the schedules in part a results in the minimal average waiting time.

28. What advantage is there in having different time quantum sizes on different levels of a multilevel queuing system?

29. Suppose that a scheduling algorithm, (at the level of short-term CPU scheduling) favours those processes that have used the least processor time in the recent past. Why will this algorithm favour I/O bound programs and yet not permanently starve CPU-bound programs.

30. A job running in a system, with variable time quantum per queue, needs 30 milliseconds to run to completion. If the first queue has a time quantum of 5 milliseconds and each queue thereafter has a time quantum that is twice as large as the previous one, how many times will the job be interrupted and on which queue will it finish its execution?

31. Consider a variation of round robin in which a process that has used its full time quantum is returned to the end of the READY queue, while one that has used half of its time quantum is returned to the middle of the queue and one that has used one-forth of its time quantum goes to a place one-forth of the distance away from the beginning of the queue.a. What is the objective of this scheduling policy?b. Discuss the advantage and disadvantage of its implementation?

32. Distinguish among the following three levels of scheduler.(i) High level scheduler(ii) Intermediate level scheduler(iii) Dispatcher

33. Distinguish between scheduling policy and scheduling mechanism.34. Which level of scheduling make a decision on each of the following questions?

(i) Which ready process should be assigned a processor when one is available?(ii) Which of the series of waiting batch processes that have been spooled to disk should next

be initiated?

Page 18: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

(iii) Which process should be temporarily suspended to relieve a short term burden on the processor?

35. Why should process be prohibited from setting the interrupting clock?36. Give example why FIFO is not appropriate processor scheduling scheme for interactive user?

Memory Management

37. Given memory partitions of 100KB, 500KB, 200KB, 300KB and 600KB (in order), how would each of the first-fit, best-fit and worst-fit algorithms place processes of 212KB, 417KB, 112KB and 426KB (in order)? Which algorithm makes the most efficient use of memory?

38. One way to compact memory is to copy all existing jobs to a secondary storage device and then reload them contiguously into man memory, thus creating one free block after all jobs have been recopied and relocated into memory. Is this viable? Could you devise a better way to compact memory? Write your algorithm and explain why it is better.

39. Given the memory configuration in figure, answer the following questions. At this point job 4 arrives requesting a block of 100K.

Operating System 20KJob 1 (10K) 30K

Job 2 (15K)50K65K

Job 3 (45K)75K

120K

200K Figure

a. Can job 4 be accommodated? Why or why not?b. If relocation is used, what are the contents of the bound registers for Job 1, Job 2 and Job 3?c. What are contents of the bound registers for Job 4 after it has been loaded into memory?d. The instruction ADDI 4, 10 is a part of Job 1 and originally loaded into memory location 22K.

What is the new location after compaction?e. The instruction MUL 4, NUMBER is a part of Job 2 and originally loaded into memory location

55K. What is the new location after compaction?f. The instruction MOVE 3, SUM is a part of Job 3 and originally loaded into memory location 80K.

What is the new location after compaction?40. Explain the difference between the following :a. Logical and physical addressb. Internal and external fragmentation41. Why are segmentation and paging sometimes combined into one scheme? 42. Describe a mechanism by which one segment could belong to the address space of two different

processes.43. Why page sizes are always powers of 2?44. Consider a logical address space of eight pages of 1,024 words each, mapped onto a physical

memory of 32 frames.a. How many bits are in the logical address?b. How many bits are in the physical address?45. Discuss how fragmentation manifests itself in each of the following types of virtual memory

system?(i) Segmentation(ii) Paging(iii) Combined segmentation and paging

46. Discuss the benefits of multilevel paging system instead of directly mapped paging system.47. What is a TLB? How is it useful?

Page 19: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

48. As a chief designer of a new virtual memory system you have been given the choice of implementing either paging or segmentation, but not both. Which would you choose and why.

Memory Management

49. Under what circumstances do page fault occurs? Describe the actions taken by the operating system when a page fault occurs.

50. Consider the following page replacement algorithms. Rank these algorithms on a five point scale from “bad” to “perfect” according to their page-fault rate. Separate those algorithms that suffer from Belady’s anomaly from those that do not.

a. LRU replacement b. FIFO replacement c. OPT replacement51. What is the cause of thrashing? How does the system detect thrashing? Once it detects thrashing,

what can the system do to eliminate this problem?52. Suppose the bus between memory and secondary storage is experiencing heavy page traffic. Does

this imply thrashing? Explain.53. Consider the following page-reference string :1,2,3,4,1,5,6,2,1,2,3,7,6,3,2,1,2,3,6.How many page faults would occur for the following replacement algorithms, assuming one, two, three, four, five, six or seven frames? Remember that all these frames are initially empty, so your first unique pages will all cost one fault each.

LRU replacement FIFO replacement Optimal replacement

54. Justify which of the following is susceptible to thrashing:(i) Local page replacement(ii) Global page replacement.

55. Consider a process experiencing large number of page faults. Describe the effect, if any, of increasing this process’s scheduling priority?

56. Given that main memory is composed of three page frames for public use and that a program requests pages in the following order:

a b a c a b d b a c da. Using the FIFO page removal algorithm, do a page trace

analysis indicating page faults with asterisks (*). Then compute the failure and success ratios.

b. Using the LRU page removal algorithm do a page trace analysis and compute the failure and success ratios.

c. Which is better? Why do you think it’s better? Can you make a general statement from this example? Why or why not?

d. Let’s define “most-recently-used” (MRU) as a page removal algorithm that removes from memory the most recently used page. Do a page trace analysis using the same page requests as before and compute the failure and success ratios.

e. Which of the three page removal algorithm is best, and why do you think so?

57. Compare and contrast Compare and contrast the page fault frequency page replacement strategy and the working set page replacement strategy. Be sure to consider the following ;(i) Execution time overhead.(ii) Memory overhead to for holding the information necessary to support the strategy.

Disk Scheduling

58. Is disk scheduling, other than FCFS scheduling, useful in a single-user environment? Explain your answer.

59. Explain why SSTF scheduling tends to favor middle cylinders over the innermost and outermost cylinders.

Page 20: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

60. Suppose that a disk drive has 5000 cylinders, numbered 0 to 4999. The drive is currently serving a request at cylinder 143 and the previous request was at cylinder 125. The queue of pending requests, in FIFO order is, 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130.Starting from the current head position, what is the total distance (in cylinders) that the disk arm moves to satisfy all the pending requests for each of following disk-scheduling algorithm? a. FCFSb. SSTFc. SCANd. LOOKe. C-SCAN

Deadlocks61. Consider a system consisting of four resources of the same type that are shared by three processes,

each of which needs at most two resources. Show that the system is deadlock free.62. What are the major differences between deadlock, starvation and race? Give some “real life”

examples (not related to a computer system environment) of deadlock, starvation and race.63. Consider a system consisting of m resources of the same type, being shared by n processes.

Resources can be requested and released by processes only one at a time. Show that the system is deadlock-free if the following two condition hold :

a. The maximum need of each process is between 1 and m resources.b. The sum of all maximum needs is less than m + n.64. Consider the directed resources graph shown in figure and answer the following questions:a. Is this system deadlocked?b. Are there any blocked processes?c. What is the resulting graph after reduction by P1?d. What is the resulting graph after reduction by P2?e. Both P1 and P2 have requested R2 :

i. What is the status of the system if P2’s request is granted before P1s?ii. What is the status of the system if P1’s request is granted before P2s?

65. Discuss the consequent of infinite postponement in each of the following types of system:(i) Batch processing(ii) Timesharing(iii) Real time

66. In a system in which it is possible for a deadlock to occur, under what circumstances would you use a dead lock detection algorithm?

67. Explain various deadlock recovery scheme.

Process Synchronization68. What is critical-section problem? How semaphores are helpful in solving this problem?69. What is race condition?70. Does Peterson’s solution to mutual exclusion problem work when process scheduling is

preemptive. How about when it is non preemptive.71. Can counting semaphores be implemented using only binary semaphore?

P1

P2 R1 R2

Page 21: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

72. Explain the concept of transaction atomicity.73. Explain how the synchronization is achieved in Solaris 2 and in Windows 2000.

Security74. Explain the security problem. What are the levels on which the security measures are to be taken?75. What are the various methods of authenticating users? Explain.76. What is Cryptography? What are its uses in OS perspective?

SEMESTER-IV

CS 4108 OPERATING SYSTEM LAB ASSIGNMENTDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

1. Write a program that will simulate FCFS, SJF, SRT (shortest remaining tine first), and round robin scheduling algorithm. For each algorithm, the program should compute waiting time, turnaround time of every job as well as the average waiting time and the average turn around time. The average values should be consolidated in a table for easy comparison. You may use the following data to test your program. The time quantum for round robin is 4 ms and the context switching time is zero.

Arrival time CPU cycle(in ms)0 63 25 19 710 512 314 416 517 719 2

Table 12. Using your program1, change the context switching time to 0.4 ms. Compare outputs from both

runs and print which is a better policy.3. Using the information give in table 2 and table 3 to complete the following program

Job listJob stream number Time Job Size1 5 57602 4 41903 8 32904 2 20305 2 25506 6 69907 8 89408 10 7409 7 393010 6 689011 5 658012 8 382013 9 914014 10 42015 10 220

Page 22: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

16 7 754017 3 321018 1 138019 9 985020 3 361021 7 754022 2 271023 8 839024 5 595025 10 760

Table2

Memory listMemory Block Size1 95002 70003 45004 85005 30006 90007 10008 55009 150010 500

Table 3At one large batch- processing computer installation the management wants to decide what storage placement strategy will yield the best possible performance. The installation runs a large real storage computer under fixed partition multiprogramming. Each user program runs in a single group of contiguous storage locations. Users state their storage requirements and time units for CPU usage on their job control card. The operating system allocates to each user the appropriate partition and starts up the user’s jobs. The jobs remain in memory until completion. A total of 50,000 memory locations are available, divided into block as indicated in the table above.

a. Write a event driven simulation to help you decide which storage placement strategy should be used at this installation. Your program would use the job stream and memory partitioning as indicate previously. Rum the program until all jobs have been executed with the memory as is (in order by address). This will give you the first fit type performance results.

b. Sort the memory partitions by size and run the program a second time; this will give the best fit performance results. For both parts a. and b. you are investigating the performance of the system using a typical job stream by measuring:

(i) throughput ( how many jobs are processed per given time unit)(ii) storage utilization (percentage of partitions never used, percentage of partitions heavily used,

etc)(iii) waiting queue length(iv) waiting time in queue(v) internal fragmentation

4. Suppose your system (as explained in program 3) now has a “ spooler” (storage area in which to temporarily hold jobs) and the job scheduler can choose which will be served from among 25 resident jobs. Suppose also that the FCFS policy is replaced with SJF policy. This would require that a sort by time be performed on the job list before running the program. Dose this make a difference in the results. The program should be run twice to test this new policy with both best fit and first fit.

5. Suppose your “spooler” (as describe in program 4) replace the previous policy with one of “Smallest Job First Served”. This should require that a sort by job size be performed on the job list before running the program. The program should be run twice to test this new policy with both best fit and first fit. Print the result.

Page 23: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

6. The following sequence of requests for program words is taken from a 460 word program: 10,11,104,170,73,309,185,245,246,434,458,364. Main memory can hold a total of 200words for this program and the page frame size will match the size of the pages into which the program has been divided. Calculate the page number according to the page size; divide by the page size, and the quotient gives the page number. The number of page frames in memory is the total number, 200, divided by the page size.

a. Find the success frequency for the request list using FIFO replacement algorithm and a page size of 100 words. (There are two page frames).

b. Find the success frequency for the request list using a FIFO replacement algorithm and a page size of 20 words. (10 pages. 0 through 9)

c. Find the success frequency for the request list using FIFO replacement algorithm and a page size of 200 words.

d. Repeat a. through c. above, using a main memory of 400 words. The size of each page frame will again correspond to the size of the page.Optional Questions

7. Given the following information for an assembly language program:Job size = 3126 bytesPage size = 1042 bytesInstruction at memory location 532: LOAD 1, 2098Instruction at memory location 1156: ADD 1, 2087Instruction at memory location 2086: SUB 1, 1052Data at memory location 1052: 015672Data at memory location 2098: 114321Data at memory location 2087: 077435

a. Find the number of pages needed to store the entire job?b. Compute the page number and displacement for each of the byte addresses where the

data is stored.c. Determine whether the page number and displacements legal for this job.

8. writ a program that will simulate the FCFS, SSTF, LOOK, and C-LOOK seek optimization strategies. Assume that:

a. The disk’s outer track is the 0 track and the disk contains 200 tracks per surface.Each track holds 8 sectors numbered 0 through 7.b. A seek takes 10+0.1* T ms, where T is the number of tracks of motion from one request to the

next, and 10 is movement time constant.c. One full rotation takes 8 ms.d. Transfer time is 1ms.Use the data in table 4 to test your program.For comparison purposes, compute the average, variance, standard deviation of time required to accommodate all request under each of the strategies. Consolidate your result into a table.

Table 4

Arrival Time Track requested Sector requested0 45 023 132 625 20 229 23 135 198 745 170 557 180 383 78 488 73 595 150 7

Page 24: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER-IV

CS4109 COMPUTER SYSTEM ARCHITECTURE TUTORIAL SHEETDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

1. Differentiate between computer Architecture and computer organisation.

2. Define the term s/w compatibility and h/w compatibility. What role have they played in

the evaluation of computers?

3. Explain brief history of computers

4. Briefly explain the architecture of general purpose computer.

5. Write a note on stored program computer.

6. Explain the design process for a digital system.

7. What do you understand by design levels in the design of computer system?

8. Explain top-down design approach.

9. List various register level components.

10. Draw and explain the generic block representation of a register level component.

11. Write a short note on the following: Multiplexer, Decoder, Demultiplexer, Arithmetic

elements, Register, PLA.

12. Explain the design process at the register level.

13. List the processor level components.

14. Explain various design aspects in the processor level design.

15. Draw and explain simple queuing model of computer system.

16. Solve the following using 2’s complement arithmetic.

(a) Add 46 and 18 (b) Subtract 34 from 52

17. Explain the h/w for implementation of integer addition and subtraction.

18. Write short note on look ahead carry generator.

19. Explain the h/w for implementation of positive number multiplication.

20. Explain the Booth’s algorithm for multiplication.

21. Multiply following using Booth algorithm

(a) 8 X 15 (b) -13 X 14 (c) -4 X -9

Page 25: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

22. Explain the modified Booth’s algorithm.

23. Explain the h/w for implementation of integer division.

24. Explain restoring and non-restoring algorithm for integer division.

25. Describe the IEEE standards for single precision and double precision floating point

numbers.

26. Draw and explain the flow chart for floating point addition and subtraction.

27. Draw and explain the flow chart for floating point division.

28. Explain the various instruction types and format.

29. What do you mean by instruction format? Explain it with the help of example.

30. Explain different addressing modes with the help of one example each.

31. Explain the design of ALU using combinational circuits.

32. Explain the design of ALU using sequential circuits.

33. Draw and explain a generic data path unit with an ALU and a register file.

34. What do you mean by microoperation?

35. Give the microoperation for fetch cycle.

36. Give the microoperation for interrupt cycle.

37. Explain the sequence of operations needed to perform following CPU functions

(a) Fetching a word from memory

(b) Performing an arithmetic or logical operation.

38. What are the basic tasks of control unit?

39. Draw the internal structure of CPU with control signals.

40. Draw and explain typical hardwired control unit.

41. Explain different design approaches for hardwired control.

42. Draw and explain the hardware required for gcd processor.

43. Explain the control unit design for gcd processor using state table method.

44. Explain the control unit design for gcd processor using one hot design method.

45. Write short notes on CPU control unit.

46. What is microprogramming and microprogrammed control unit?

47. Draw and explain the working of control unit.

48. List the advantages and disadvantages of microprogrammed control.

49. What do you mean by instruction pipelining?

50. List the factors affecting the performance of instruction pipelining.

Page 26: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

51. Explain the various approaches used to deal with conditional branching

52. Draw and explain the implementation of two stage instruction pipelining.

53. Draw and explain the implementation of four stage instruction pipelining.

54. Write short notes on pipeline performance.

55. What do you mean by arithmetic pipeline? Discuss.

56. List the different characteristics of memory system.

57. Write a note on memory hierarchy.

58. What are the types of RAMs? Explain them in detail

59. Explain the organisation of DRAM memory.

60. Discuss various access methods used in memory.

61. Give the comparison between serial access and random access memories.

62. Write notes on magnetic disk.

63. Write notes on RAID.

64. Write a short note on magnetic tapes.

65. What is cache memory? Why is it implemented?

66. Define hit rate.

67. Describe the element of cache design.

68. Draw and explain fully associative cache organisation.

69. Draw and explain direct mapped cache organisation.

70. Draw and explain set associative cache organisation.

71. What is cache updating? Why is it necessary? Explain different updating systems.

72. What is cache coherency? Why is it necessary? Explain different approaches for cache

coherency.

73. Explain the replacement algorithms for cache memory.

74. What is virtual memory? Why is it necessary to implement virtual memory?

75. Comment on the performance of two level cache systems.

76. Draw and explain bus interconnection scheme.

77. Explain different mechanisms used for bus arbitration.

78. Draw and explain the block diagram of typical DMA controller.

79. Explain various DMA transfer modes.

80. Write short notes on I/O processor.

81. Explain the Flynn’s classification of parallel processing system.

Page 27: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

82. Compare and contrast SIMD and MIMD computers. Hence classify a typical IBM PC.

83. Explain the structural difference between shared memory and distributed memory

computer with the help of neat diagram.

84. Compare the processor level and instruction level parallelism.

85. Define speedup and efficiency related to performance of parallel computer.

86. Draw and explain tightly coupled and loosely coupled microprocessor system.

87. Draw and explain typical multiprocessor organisation.

88. Write short notes o on contention problem in multiprocessor system.

89. Draw and explain the various interconnection network structures used in multiprocessor

system.

90. Explain various processor characteristics for multiprocessor.

Page 28: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER-V

CS 5101 FORMAL LANGUAGES AND AUTOMATA THEORY TUTORIAL SHEET

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

Module-1

Q1. What is need for nondeterministic finite automata? What is the deference between NFA and DFA?

Q2. Proof the equivalence of NFA and DFA? Write an example, which proof the conversion from NFA to DFA?

Q3. Let M= (Q, ∑, δ, qo, F) be finite automation. Let R be the relation in Q. Defined by q1Rq2 if δ (q1,a) = δ(q2,a) for some a є ∑ and equivalence relation.

Q4. Construct the non-deterministic finite automata that accepts {ab, ba}, and use it finite a deterministic automata accepting the same set.

Q5. Construct it the DFA equivalent to the NDFA →

i)

1 1

0 ג

0

ii)

a

q0 q1q2

q4q3

00,1

1,0

1

q4

q0

a

q1

b

Page 29: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

a

b b b

iii)

0,1 0,1

Q6. Construct minimum state automata. Equivalent to given automata M whose transition table is given.

State Input a b

q0 q0 q3

q1 q2 q5 q6-final state

q2 q3 q4

q3 q0 q5

q4 q0 q6

q5 q1 q7

q6 q1 q3

Q7. Proof the theorem→ if L is accepted by NFA with є transition then L is accepted by an NFA without є transition. Proof it with example.

Q8. A language L is accepted by some DFA if and only if L is accepted by some NFA-proof the theorem.

Q9. Construct a Moor machine for mod 3 for binary language.

Q10. Equivalence between Moor and Mealy machine-proof with example?

Q11. Give DFA’s accepting the following language over the Alphabet {0,1}(a) A set of all string such that each block of five consecutive symbols contains at least

two 0’s. (b) The set of all string whose 3rd symbol from the right end is 1.

Q12. Given DFA’s accepting the following language over the alphabet {a, b} → A set of all string whose leftmost two and right most two symbols are identical.

Q13. DFA that accept the string, which is Divisible by 4.

Q14. Design a mealy machine accepting the language consisting a string from ∑={0,1} ending with 2 cosecutive 0’s and 1’s.

q2q2

q1 q1q2

1 0

Page 30: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

Q15.Convert NFA with є move in fig. given below to equivalent NFA without є move.

Є Є

Q16. Convert the following є NFA to DFA.

a Є

b

Q17. Design DFA which accept set of all string which are divisible by 5 for binary alphabet.

Q18. Design a DFA that accepting the following languages over alphabet {0,1}

The set of strings such that the number of 0’s is divisible by 5, and the number of 1’s divisible by 3. Q19. Give the NFA that accept the following languages-The set of strings of 0’s and 1’s such that there are two 0’s separated by a number of position that is a multiple of 4. Note that 0 is an allowable multiple of 4.

Q20. Design € NFA for the following language. Try to use € transition to simplify your design.The set of strings of 0’s and 1’s such that at least one of the last 4 positions is 1.

Module –2

Q21. Obtain a regular expression to accept a language consisting of strings of a’s and b’s of odd length.

Q22.Obtain a regular expression to accept for following language-the strings 0’s and 1’s with atmost one pair of consecutive 1’s.

Q23.Obtain NFA for regular expression a*+b*+c*.

Q24.Obtain an NFA for the regular expression (a+b)* aa (a+b)*.

Q25.Give the English description of the language of the following regular expression.

q0 q1 q2

0 1 2

q0 q1 q2

a

Page 31: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

(a) (1+є) (00* 1)* 0*

(b)(0+10)*1*

Q26. Consider the transition system of given fig. Prove that the string recognized are (a+a(b+aa)*b)*a(b+aa)*a.[Arden’s theorm].

a a

b a

Q27. Consider the F.A equivalent to the regular expression (0+1)*(00+11)(0+1)*.

Q28. Represent the following set by regular expression-{an/n is divisible by 2 or 3 or n = 5}

Q29.If L=L(A) for some DFA A, then there is regular expression R such that L=L(R).

Q30. Convert the regular expression r=(11+0)*(00+1)* to є move.

Q31. Derive the regular expression from this F.A.

1

0 1

0

Q32. Prove that any set L accepted by a finite automata M is represented by regular expression.

Q33.Give the DFA for the R.E i) aa*+aba*b* ii) ab(a+ab)*(a+aa)

Q34. Construct the right linear grammar for the following R.E (aab*ab)*.

Q35. Write a regular expression for the following languages:

The set of all strings with an equal number of 0’s and 1’s such that no prefix has two more 0’s than 1’s, nor two more 1’s than 0’s.

q1 q2 q3

b a

q1

0 q2

q3

1

Page 32: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

Module-3

Q36.Prove that following are regular or not (a) {0n1n / n≥1}(b) {0 n,12n / n≥1}(c) {0i 2 / i≥1}

Q37. Prove that following are not regular language-{0n/ n is a perfect cube}.

Q38. Prove that following are not regular language-The set of strings of the form 0i1j such that greatest common divisor of i and j is 1.

Q39. Show that the regular languages are closed under the following operation-max (L) = {w/ w is in L for no x other than € is wx is in L}.

Q40. What is Pumping lemma and what is the closure property of regular set. Prove that regular sets are closed under union, concatenation and Kleen closure.

Q41. Find out whether these two F.A’s are equivalent or not-

i)

0 1

1 0

1 1

ii)

0,1 1

Module-4:

Q42. What is the concept of parse tree in context free grammar? What is parser? How to remove the ambiguities from the grammar. What is inherent ambiguity explain.

Q43. Define deviation tree. Find deviation tree a * b+ a*b given that-a*b +a* b is in L(G), where G is given by S→S+S /SS /a /b.

Q44. Construed the context free grammar to generate the corresponding language-(a) { 0m 1m/ 1≤ m ≤n}(b) {al b m cn / l + m =n}.

Q45. Consider the following production: S-aB /bA.A-aS/bAA/aB-bS /aBB/b

q0 q1 q3

0,1

q2 q4 q5

0 0,1

0

q'0 q'1 0,1 0

q'2

Page 33: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

For the string aaabbabbba,find-1) leftmost derivation2) rightmost derivation3) parse tree.

Q46. Show that i) S-aB/ab, A-aAB/a, B-ABb/b ii)S-S+S/ S*S/ a/biii) S-aS/X, X-aX/a is ambiguous.

Q47.The following grammar generate regular expression with operand X and Y and binary operator. +, -, And *.

E→ +EE/ *EE / -EE /x /y.(a) Find leftmost and rightmost deviation, and deviation tree for the string +* - xyxy.(b) Prove that this grammar is unambiguous.

Q48. Set of all strings of balanced parenthesis i.e. each left parenthesis has a mattering right parenthesis and a pairs if matching parenthesis are properly nested.

Q49. Proof –it is an unambiguous grammar-S-0A/0BA-1A/€B-0B/1

Q50. RE (001+1)*(01)*obtain the contex free grammar.

Q51. Obtain the grammar to generate language –L={ w/ na(w)=nb(w)}

Q52. Obtain a grammar to generate the language-L={wwR /w є {a,b}*

Q53. Obtain a grammar to generate the language-L= {0i 1j /i ≠ j, i≥0 and j≥0}.

Q54. Construct grammar generating {xx/x є {a,b}*}

Q55. Construct grammar generating {0n 12n/ n≥ 1}.

Q56. Construct grammar generating {ai bj ck / i, j, k ≥1, i≠j=k}

Q57. Consider CFG G defines the productions:S-aSbS/ bSaS/€Prove that L(G) is the set of all strings with an equal number of a’s and b’s.

Module-6

Q58. Reduce the following grammar G to CNF. G is S-aAD

A→aB/bABB→b.

D→d.

Q59. Find whether the following language are context free or not.(i) L={a p/p is prime}.(ii) {a m bm c n /m ≤ n ≤ 2m}

Q60. Find whether the following languages are context free or not{0i1j/ j=i2}

Page 34: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

Q61. Convert the grammar S→AB, A- BS/bB→SA/a in to GNF.

Q62.Show that L= {an b n cn (n≥1) is not context free but context sensitive.

Q63. What do your mean by reduce grammar? Find reduce grammar equivalent to the following. Grammar→

S→aAa.A→Sb/bcc/DaA.C→abb/DDD→aDA.B→ac.

Q64.Find the reduce grammar equivalent to the grammar S-aAa, A-bBB, B-ab, C-aB.

Q65.Given the grammar S-AB, A-a, B-c/b, C-D,D-E,E-a, find the equivalent grammar which is reduced and has no unit production.

Q66.Reduce the grammar into GNF(a) E→E+T /T

T→T*F R

F (E) ID(b) S→SS

S→0S1S→01.

Q67.Find the Regular grammar of the following:i) S-SSS/a/abii) S-AAS /ab/aabiii) A-ab/ba/€

Q68. Eleminate useless symbol for grammar:i)S-aS/A/CA-aB-aaC-aCb

ii)S-aS/bAA-aA/€

iii)A-0B/1D/0B-1C/0DC-0B/1D/0D-0D/1D

Q69.Draw an NFA accepting the language generated by grammar:S-abA/bB/abaA-b/aB/bAB-aB/aA

Q70. Begin with the grammarS-ASB/€A-aAS/a

Page 35: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

B-SbS/ A/ bba) Are there any useless production? Eleminate them if so.b) Eliminate € production.c) Put the grammar into Chomsky normal form.

Module-5:

Q71.Convert the grammarS→0S1/A

A→1A0/S/ єto a PDA that accept the same language by empty stack.

Q72. (i) Design PDA that accepts.{wcwR /w is in (0+1)*} by empty stack(ii) Design PDA that accepts.{0n 12n/n≥ 1} by empty stackiii)Design PDA that accepts.{a n b n /n ≥0} by empty stack.

iv) Design PDA that accepts.{a n b m an+m }

Q73.Construt the PDA that accept the language generated by CF G→S→S+S/S* S/id.

Q74. Design PDA that accepts{an bm an / m,n ≥ 1}Q75. Design PDA that accept LM?={w/w є (a,b)* and na(w)=n b(w)}.Q76.Prove that the set accepted by are CFL’sS-aAS-aABC/bB/aB-bC-c

Q77. Costruct PDA from language: axbycz/ / x+z=y.

Module-7:

Q78. Design TM for the following language-(a) {a nbn cn/ n≥1}(b) {wwR /w is any string of O’s and 1’s}.

Q79. Design TM for following----------(a) T(x)= {xx, x є (a,b)*}(b) T(n)= n+1.

Q80. (a) Design TM to obtain the reverse string from the given input string over ∑= {a,b}.

(b) Design TM to add two integer number.

Q81. Design a TM to compute 1’s complement.Q82. If a language L is accepted by TM then L is accepted by two stack TM.

Page 36: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER-V

CS 5103 FUNDAMENTALS OF DATA COMMUNICATIONS TUTORIAL SHEET

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

Introduction

1. Describe a simple communication model, with the help of a suitable block diagram.2. What three fundamental characteristics determine the effectiveness of a data communication system?3. Define Distributed processing. Give its advantages.4. Define the term Computer Network. Differentiate between a switched Communication Network & Broadcast communication Network.5. Why are protocols needed?6. Differentiate between cell Relay & Frame Relay.7. What is meant by ISDN? Explain.8. Differentiate between

a) Half duplex transmission & full duplex transmissionb) Internet and internetc) LAN & WANd) Protocols and Standardse) Communication and Transmission

9. Draw a hybrid topology with a star backbone & four ring networks.10. What are two types of line configuration?11. What are the advantages of a multipoint connection over a point-to-point Connection?12. Why are standards needed?

Protocols & Architecture

1. Briefly explain the OSI layered approach in a Computer Communications Architecture.2. What are the main functions of different layers in an OSI approach?3. What is meant by a PDU? Explain briefly how PDUs are exchanged between peer layers?4. What is meant by a service Access Point?5. What is the involvement of a Network layer in the following types of data transfer?

(a) Point-to-Point Link(b) Packet switched network(c) LAN(d) Circuit Switched Network

6. What is meant by TCP/IP Protocol Suite?7. List out the main differences in approaches between OSI layered Structure and a TCP/IP protocol suit.

Page 37: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

8. Compare the differences between a hierarchical and a layered approach.9. Differentiate between a port address, a logical address & a physical address.10. Suppose a computer sends a packet at the network layer to another computer somewhere in the Internet. The logical destination address of the packet is corrupted. What happens to the packet? How can the source computer be informed of such situation?11. What is difference between network layer delivery and transport layer delivery and transport layer delivery?12. What is a peer-to-peer process?13. What is protocol architecture?

Data Transmission

1. Contrast an Analog signal with a digital signal.2. How is the Bandwidth of a signal related to its spectrum? 3. Differentiate between data rate & Baud rate.4. What are the common transmission impairments a signal encounters? Explain each of them.5. What is meant by channel capacity? Mention the factors affecting it?6. What is meant by Eb/No ratio? What is effect of signal strength & data rate on it?7. Distinguish between base band and broadband transmission.8. Differentiate between synchronous & Asynchronous transmission.9. A periodic composite signal contains frequencies from 20-30KHZ, each with amplitude of 8V. Draw the frequency spectrum.10. A line has a signal to noise Ratio of 2000 & a bandwidth of 5000KHZ. What is the maximum data rate supported by this line?11. We have a channel with 5KHZ bandwidth. If we want to send data at 150Kbps, what is the minimum SNRdb? What is SNR?12. What does the Nyquist theorem and Shannon capacity have to do with communication? 13. How can a composite signal be decomposed into its individual frequencies.14. Show the frequency domain of the following signal S (t) = 8+3 sin 1000πt +5sin 200πt15. The attenuation of a signal is –10db. What is the final signal power if it was originally 5W?16. A signal has passed through three cascaded amplifiers, each with a 4db gain? How much is the signal amplified?

Transmission Media

1. Write short notes on the following, & compare the total data rate capacity & BW criteria of them | Twisted Pair, Co-axial cable & Optical fiber.2. Differentiate between terrestrial microwave & satellite microwave.3. Co-axial cable is a two-wire transmission system. What is the advantage of connecting the quter conductor to ground?4. Why are communication satellites in geosynchronous orbit?5. Mention the factor for evaluating the suitability of a particular transmission media.6. What is the position of the transmission media in the OSI or the internet model?7. Name the advantages of optical fiber optics twisted pair and co-axial cable.8. Explain the significance of twisting in twisted pair.9. Explain the transmission characteristics of fiber optics and terrestrial microwave.10. Write the physical description and applications of satellite microwave.

Data Encoding

1. What are the popular digital data encoding schemes? Compare their properties with respect to their modulation rate, dc level component synchronizing capability, error detecting capability & immunity to Noise.2. What is meant by differential code? 3. What are advantages of Biphase coding?4. Differentiate among ASK, FSK & PSK. Where they are used?

Page 38: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

5. What do you understand by QPSK? How is it used to increase the data rate in a communication link?6. What do you understand by Bandwidth efficiency? Compare the same for ASK, FSK & QPSK.7. Briefly describe a PCM scheme, where is it used?8. What do you understand by Quantization? What is meant by quantization noise?9. What is meant by companding? Where is it employed? What are the advantages of this scheme?10. Write short notes on the following modulation techniques & compare their BW requirements AM, FM, PM.11. Are the modem & the codec functional inverses?12. Differentiate between serial & parallel transmission.13. Define scrambling & give its purpose.14. Distinguish between data rate & signal rate. Compare & contrast PCM & DM.15. What is the maximum data rate of a channel with a bandwidth of 300 KHZ if we use four levels of digital signaling?16. Draw the signal waveforms when 001110011 is transmitted using the following NRZ-L NRZ – I AMI Manchester Differential Manchester17. List and briefly define important factors that can be used in evaluating or comparing the various digital-to-digital encoding techniques.18. What is the sampling rate for PCM if the frequency rangers from 1000 to 4000Hz?19. A signal is sampled. Each signal represents one of four levels. How many bits are needed to represent each sample? If the sampling rate is 8000 samples per second, what is the bit rate?

The Data Communication Interface

1. Differentiate between synchronous & Asynchronous transmission technique.2. What is meant by Null Modem? Where is it used?3. What are the functions of a DTE? What are the functions of DCE? Give an example of each.4. What standard organizations are involved in DTE-DCE interface standards? Name some popular DTE-DCE standards.5. Compare the frames of transmission for synchronous & asynchronous techniques? What is meant by a preamble & a post-amble in the frame? Why are they required?6. Briefly describe RS232-C standard for interfacing?

Data Link Control

1. Why is flow control needed? Discuss the use of a buffer at the receiver in flow control.2. What is the mechanism of stop-and-wait flow control? What is the mechanism of sliding window flow control?3. What are the two types of sliding-window ARQ error control? How do they differ from one another?4. In stop and wait ARQ what happens if a NAK is lost in transit? Why is there no need for NAKs to be numbered?5. Which sliding-window ARQ is most popular? Why?6. How does a single bit error differ from a burst error?7. Differentiate between even parity & odd parity8. Discuss CRC method.9. What is the purpose of Hamming code?10. Given a 10 bit sequence 1010011110 & a divisor 1011, find the CRC check your answer.11. Construct a Hamming code for the bit sequence 1001110112. A sender sends 01110001, the receiver receives 01000001. If only VRC is used can receiver detect the error?13. Explain the reason for moving from the stop-and-wait ARQ protocol to the Go-Back-N ARQ protocol.14. Define piggybacking and its usefulness.15. A receiver receives the bit pattern 0111011011. If the system is using odd parity, is the pattern in error?16. A successive repeat ARQ is using 7 bits to represent the sequence numbers. What is the size of the window?

Multiplexing

Page 39: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

1. Distinguish between synchronous and statistical TDM. 2. Distinguish between multilevel TDM, multiple slots TDM, and pulse-staffed TDM.3. Define spread spectrum and its goal. List the two spread spectrum techniques.4. Describe the goal of multiplexing.5. Explain FDM.6. How is interference avoided by using FDM?7. Given the following information, find the maximum bandwidth for each signal source.

i) FDM Multiplexingii) Total available Bandwidth = 7900Hz.iii) Three signal sources.iv) A 200-Hz guard band between each signal source.

Circuit Switching & Packet Switching

1. What is TSI and its role in time-division switch.2. Compare space-division and time-division switches.3. What are two approaches to packet-switching?4. Compare and contrast a circuit-switched network and a packet switched n/w.5. List the three traditional switching methods.6. What is the role of address field in a packet traveling through a datagram n/w and virtual-circuit

network?7. Define blocking in a switched network.8. List four major components of a packet switch and their functions.9. Define the need for switching and define a switch.10. How does frame relay differ from x.2511. What is the significance of packet size in a packet-switching network?12. What is difference between in channel and common channel signaling?

Asynchronous Transfer Mode

1. How does ATM differ from frame relay?2. What are relative advantages and disadvantages of ATM compared to frame relay.3. What is difference between virtual channel and virtual path?4. What are characteristics of virtual channel connection and virtual path connection?5. List and briefly explain the fields in an ATM cell.6. Explain two methods for transmitting ATM cell.7. List and briefly define the ATM service categories.8. Compare an SVC with PVC.9. How is an ATM virtual connection identified?10. Discuss the frame relay physical layer.11. There are no sequence numbers in frame relay. Why?12. Differentiate between :13. Unicast Routing and Multicast Routing14. Exterior Routing and Interior Routing.15. Explain Dijkstra’s algorithm in unicast routing.

Page 40: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER-V

CS 5106 SOFT COMPUTING LAB ASSIGNMENTDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

PART- A (Fuzzy Logic)Note: The question in BOLD are optional and carry more credit

1) a) Write a Matlab program (m.file) to calculate union, intersection, complement and difference of two fuzzy sets. b) Write a Matlab program (m.file) to calculate the Demorgan’s Law.

2) Find whether the given matrix is (a) reflexive (b) tolerance and (c) transitivity matrix or not.R =1 1 0 0 01 1 0 0 10 0 1 0 00 0 0 1 00 1 0 0 1by writing an M-file.

3) Find whether the given matrix is symmetry or notR =1 0.5 0.3 0.6 00.5 1 0.7 0.5 0.90.3 0.7 1 0.6 00.6 0.5 0.6 1 0.50 0.9 0 0.5 1by aMatlab program.

4) Find the fuzzy relation between two vectors R and SR =0.7 0.50.8 0.4S =0.9 0.6 0.20.1 0.7 0.5Using max–product and max-min method by a Matlab program

Page 41: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

5) (a)Use Matlab command line commands to display the Gaussian membership function. Given x = 0–10 with increment of 0.1 and Gaussian function is defined between 0.5 and −5. (b) Use Matlab command line commands to display the triangular membership function. Given x = 0–10 with increment of 0.2 triangular membership function is defined between [3 4 5]

6) Illustrate different types of generalized bell membership functions using Matlab program

(7) Using Matlab program find the crisp lambda cut set relations for λ = 0.2, the fuzzy matrix is given byR=0.2 0.7 0.8 11 0.9 0.5 0.10 0.8 1 0.60. 0.4 1 0.3

(8) Temperature control of the reactor where the error and change in error is given to the controller. Here the temperature of the reactor is controlled by the temperature bath around the reactor thus the temperature is controlled by controlling the flow of the coolant into the reactor. Form the membership function and the rule base using FIS editor.

(9) Consider the water tank with following rules1. IF (level is okay) THEN (valve is no_change) (1)2. IF (level is low) THEN (valve is open_fast) (1)3. IF (level is high) THEN (valve is close_fast) (1)Using Mamdani method and max–min method for fuzzification and method of centroid for defuzzification method construct a FIS. Before editing that rules, membership functions must be defined with membership function editor.

(10) (a) Form a fuzzy system, which approximates function f, when x [−10, 10].Repeat the same by adding random, normally distributed noise with zero mean and unit variance. (b) Simulate the output when the input is sin(t). Observe what happens to the signal shape at the output.

(11) Use Matlab’s Fuzzy Logic Toolbox to model the tip given after a dinner for two, where the food can be disgusting, not good, bland, satisfying, good, or delightful, and the service can be poor, average, or good. To get started, you type fuzzy in a Matlab window. Then use the fuzzy inference system and membership function editors to define and tune your rules.

PART B (Neural Network)

12. Design networks of McCulloch-Pitts neurons that implement logical NOT, AND and OR gates. Draw each network and label all the weight and threshold values.

13. Derive expressions for the weights and thresholds of a McCulloch-Pitts neuron that can compute the following input-output mappings:

in1 in2 out0 0 10 1 01 0 01 1 0

Write Matlab code for the above ANN.

14 Investigation the use of back-propagation learning using a sigmoidal nonlinearity to achieve one-to-one mapping, as described here:

Page 42: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

1. f(x) = 1/x, 1 ≤ x ≤ 1002. f(x) = log10x, 1 ≤ x ≤ 103. f(x) = exp(-x), 1 ≤ x ≤ 104. f(x) = sinx, 0 ≤ x ≤ π/2

for each mapping, do the following:(a) Set up two sets of data, one for network training, and the other for testing.(b) Use the training data set compute the synaptic weights of the network, assumed to have a single

hidden layer.(c) Evaluate the computation accuracy of the network by using the test data. Use a single layer but

with a variable number of hidden neurons. Investigate how the network performance is affected by varying the size of the hidden layer.

15 The data presented in the Table P4.17 show the weights of eye lenses of wild Australian rabbits as a function of age. No simple analytical function can exactly interpolate these data, because we do not have a single valued function. Instead, we have a nonlinear least squares model of this data set, using a negative exponential, as described byY = 2.33.846(1 – exp(-0.006042x)) + Where is an error term.Using the back- propagation algorithm, design a multiplayer perceptron that provides a nonlinear least-squares approximation to this data set. Compare your result against the least-sequence model described.

Table P4.17 Weights of Eye Lenses of Wild Australian Rabbits

Ages(days)

Weights(mg)

Ages(days)

Weights(mg)

Ages(days)

Weights(mg)

Ages(days)

Weights(mg)

15 21.66 75 94.6 218 174.18 338 203.2315 22.75 82 92.5 218 173.03 347 188.3815 22.3 85 105 219 173.54 354 189.718 31.25 91 101.7 224 178.86 357 195.3128 44.79 91 102.9 225 177.68 375 202.6329 40.55 97 110 227 173.73 394 224.8237 50.25 98 104.3 232 159.98 513 203.337 46.88 25 134.9 232 161.29 535 209.744 52.03 142 130.68 237 187.07 554 233.950 63.47 142 140.58 26 176.13 591 234.750 61.13 147 155.3 258 183.4 648 244.360 81 147 152.2 276 186.26 660 23161 73.09 150 144.5 285 189.66 705 242.464 79.09 159 142.15 300 186.09 723 230.7765 79.51 165 139.81 301 186.7 756 242.5765 65.31 183 153.22 305 186.8 768 232.1272 71.9 192 145.72 312 195.1 860 246.775 86.1 195 161.1 317 216.41

PART C (Genetic Algorithm)

16. Write a program in Matlab to implement Roulette wheel and ranking selection method.

Write a program in Matlab to maximize a function f(x,y)=xsin(4 x) + ysin(20 x) subject to

Page 43: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

-3.0 x 12.1

4.1 y 5.8

SEMESTER-V

CS 5108 LINUX PROGRAMMING TUTORIAL SHEETDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

[Questions in bold are optional and carry higher credit]1. Perform the following operation:-

i. Create a file called “text” and store your name, age, sex and address in it.ii. Display the contents of the file “text” on the screen.

iii. Make a copy of the file text into another file ”newtext”iv. Create a file “subject” and type any two sentences in it.v. Combine the contents of the file “text” and “subject” into another file “textsub”, Delete the file

“text”.2. Write a program using bc to find factorial value of a number. Enter the number from user.3. Write a program using bc to print squares, cubes and square roots of all numbers from 1 to 50.4. Write a program using bc to print sine and cosine values of all angles from 0 to 360 degrees in steps of 5 degrees.5. Write a program to find the prime factors of a number 218.6. Perform the following operation:-

Convert are capital letters in a file in small case letter.Merge and sort the contents of files a,b and c and display the sorted output on the screen.Merge the contents of file”F1” with the input supplied from the keyboard and store the sorted output in a file f2.

7. Write pipelines to carry out the following jobs:-(i) List all files beginning with the character ‘p’ on the screen and also store item in a file called ”F1”.(ii) Output of who should be sorted and displayed on the screen along with the total number of users. The same output except the numbers of users should also be stored in a file “F1”.(iii) Merge the contents of the files a.txt, b.txt and c.txt, sort on the screen page by page.

8. Raj’s basic salary is input through the keyboard. His DA is 40% of basic salary and house rent allowance is 20% of basic salary. Write a program to calculate the gross salary.9. The distance between the two cities (in Kms.) is input through the keyboard. WAP to convert and print this distance in meters, feet, inches and centimeters.10. Enter a five digit no. and WAP to calculate the sum of its digits.11. Enter a shell script .which will receive either the file name or the filename with pts full path during execution. This script should obtain information about this file as given by ls –l and display it in proper format.12. In a company an employee is paid as below:-

Page 44: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

If his basic salary is less than Rs. 1500, then HRA is 10% of basic salary and DA is 90% of basic salary. If salary is either equal to or above Rs. 1500 then HRA is Rs. 500 and DA is 98% of basic salary. If the employees salary is input through the keyboard write a program to find his gross salary.

13. WAP to convert a string in the reverse order.14. The marks obtained by a student in five different subjects are input through the keyboard. The student gets a division a per the following rules:- (%) age above or equal to 60- first div. (%) age between 50 and 59-second div. (%) age between 40 and 49- third div. (%) age less than 40- fail.WAP to calculate the division obtained by the student.15. If cost price and selling price of an item is input through the keyboard, WAP to determine whether the seller has made profit or incurred loss. Also determine how much profit was made or loss incurred.16. WAP to find whether an integer is even or odd17. WAP to find the year is leap year or not. Year should be inputed through the keyboard.18. Write a shell script which receives two file names as arguments. It should check whether the two files contents are same or not. If they are same the second file should be deleted.19. Write a shell script which gets executed the moment the user log in. It should display message “Good Morning”/”Good Afternoon”/”Good Evening” depending upon the time at which the user log in.20. Write a menu driven program with followed options:-

Contents of /etc/passwdList of users who have currently logged inPresent working directoryExit

Make use of case statement. The menu should be placed approximately in the center of the screen and should be displayed in bold using the tput statement.21. Enter principal, number of years and rate of interest from the keyboard and WAP to find the simple interest.22. WAP to count and report the number of entries present in each sub-directory mentioned in the path which is supplied as a command line argument.23. WAP to calculate overtime pay of 10 employees. Overtime is paid at the rate of Rs.1200 per hour for every hour worked above 40 hrs. Assume that employees do not work for factorial part of an hour.24. Two nos. are entered through the keyboard. WAP a to find the value of one no. raise to the power of another.25. Write a program to generate all combinations of 1,2, and 3 using for loops.26. Write a shell script to identify all zero byte files in the current directory and delete them. Before proceeding with detection the shell script should get a confirmation form the user. Note that for delectation rm – i should not be used since it needs an enter key to be hit after supplying “y” or “n”. 27. WAP using nested loop which show 5 the following.

r =1, p =1, s =2 r =1, p =2, s = 3r =2, p =1, s = 3r =2, p =2, s = 4r =3, p =1, s = 4r =3, p =2, s = 5

28. Enter three digits from user and WAP to find the smallest and largest one.29. Write a shell script which check after every one minute whether an user has logged in or not. The log in name should be supplied to the shell script at command prompt.30. WAP which receives 5 integers and returns the sum, average standard deviation of these nos. 31. Write a shell script to enter five digit positive integer is entered through the keyboard and calculate the sum of digits of the 5 digit no.32. WAP to obtain the first 25 numbers of a fibonacci sequence:-1 1 2 3 5 8 13 21 34 55 89 ….33. Fifteen nos. are entered from the keyboard into an array. Write a shell script to find out how many of them are positive, how may be negative, how many are even and how many odd.

Page 45: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER-VI

CS 6101 DESIGN AND ANALYSIS OF COMPUTER ALGORITHMS TUTORIAL SHEETDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

Module 11. What do you mean an algorithm. Explain the different design for algorithm.2. What are the parameters for considering the time complexity of an algorithm.3. Analyze the problem and justify your answer. If we apply insertion sort on super

computer & Quick sort on PC the array of one million numbers in super computer which executes 100 million instrumentation/ second. While the PC executes only one million / second.

4. Give an optimal solution for the problem if (x and y) then a = b;Else if ( not x ) and y ) then a = c;Else if (x and not y ) then a = d;Else a = e;

5. Write the Trade off between Time complexity & Space complexity.6. What are the basic steps for writing a good algorithm / program.7. Define the asymptotic notation.8. Explain how a Binary search tree has a height of [lgn].9. Write the following algorithm in an improved way.

For (I = 1 to n)If (I < j) then Sum = Sum + nums[i];

10. What is Randomized Algorithm?11. Write the general method for Divide & Conguer. Explain through an example.12. Order the following functions in their growth rate; N, N, N1.5, N2, NlogN, N2

log, 2/N, 2N, 37, N3.

13. If T1(N) = O(f(N)), T2(N) = O(2f(n)) then which one is True.i) T1+ T2 = O(f(N)) ii) T1+ T2 = O(3f(N)) iii) T1+ T2 = O(f(3N)) iv) T2 = 2T1

14. What is the worst –case running time of Algorithm?15. How much time is required to compute f(x) = N z=0 xi

Page 46: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

16. How much time is required to compute a matrix multiplication?17. What are the factors for analyzing an algorithm?18. Compare & contrast between all the design of algorithm

Module II19. Write the algorithm for Quick Sort & Explain through an example.20. Analyze all cases of quick sort.21. Explain & analyze the Marge sort algorithm.22. Discuss the problem of selection & compare the time complexity of all type.23. Explain the idea of strassen’s matrix multiplication & write its’s complexity.24. Write the algorithm for binary search & analyze it.25. Derive mathematically the time complexity of binary search tree.26. Illustrate the divide and conquer strategy for finding maximum and minimum from a

set of element. 27. Analyze all cases of time complexity for finding maximum and minimum from a set

of element. 28. Two sets A and B each. Assume that each element is an integer in the range [0,n100].

These sets are not necessarily sorted. Show how to check whether these two sets are disjoint in O(n) time. Your algorithm should use O(n) space.

29. Sort the follwing list in decending order using quick sort technique and argue upon its running time.

L=<1,3,5,6,8,10,13,15>

Module III30. What do you mean Greedy Method. How it is useful to solve the algorithm.31. Analyze the time complexing for optimal marge patterns through an example.32. Write algorithm for job sequencing problem so that all jobs are completed in

deadline.33. Given the character set S=<a,b,c,d,e,f> with the following probability of occurrence

P=<1,1,2,3,5,8> build a binary tree according to greedy strategy.34. Devise an algorithm to a given amount for purchasing a particular item from the shop

using least number of coins. Assume that the available coin set is C={1,2,5,20,50,100,200} what is the total number of coins for purchasing the item of total cost 5.96.

35. Machine M can process a number of jobs. Each job has its own completion time devise an algorithm which minimize the time that all jobs spend in queue. Consider three jobs with times t1=5, t2=10 and t3=3. Compute the minimum time for processing all jobs.

36. Write the algorithm for Hulfman code & analyze it.37. Let G(V,E) be any weighted connected graph. If C is any cycle of G, then show that

the heaviest edge of C cannot belong to a minimum-cost spanning tree of G.38. Find the optimal placement for 13 programs on the three tapes T0, T1 and T2, where

the programs are of lengths 12, 5, 8, 32, 7, 5, 18, 26, 4, 3, 11, 10, 6.

39. Write the algorithm for Optimal Storage on tapes & analyze it.40. What is an MST? Write an algorithm for MST? Analyze it’s Time Complexity.

Page 47: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

41. Write Kruskal’s algorithm & analyze it.

Module IV &V42. Write the general method for Dynamic programming.43. State the all pairs shortest path problem & analyze its Time & Space complexity.44. Prove that the time efficiency of Warshall’s algorithm is cubic.45. Solve the all pairs shortest problem for the diagraph with the weight matrix

| 0 2 ∞ 1 8 | | 6 0 3 2 ∞ | | ∞ ∞ 0 4 ∞ | | ∞ ∞ 2 0 3 || 3 ∞ ∞ ∞ 0 |

46. Taking the Traveling saleman problem as case study, suggest an algorithm for this &

analyze its time complexity.47. State the 8-queens problem. Explain a back tracking algorithm for solving it.48. State and solve 8-puzzle using backtracking.49. Write an algorithm for sum of subsets & analyze it.50. Suppose you are given n men and n women and two nxn arrays P and Q such that

P(i,j) is the preference of man i for woman j and Q(i, j) is the preference of woman I for man j. Devise an algorithm that finds a pairing of men and women such that the sum of the product of the preference maximized.

51. Let MAZE(1:n, 1:n) be a zero or one valued, two dimensional array that represent a maze. A one means a blocked path whereas zero represents an open position. Develop an algorithm that begin at MAZE(1,1) and tries to find a path to position MAZE(n,n). Use backtracking to find your solution and analyze your algorithm.

52. Prove that the size of the set of all subsets of n elements is 2n

53. Let w={5,7,10,12,15,18,10} and m=35. Find all possible subsets of w that sum to m. Draw the state space tree for it.

54. What is multi stage graph problem. How it can be solved with dynamic programming approach.

55. Show that the computing time for optimal binary search tree is O(n2).56. Write Dynamic programming method to solve 0/1 knapsack problem.57. Consider the following instance of the knapsack problem:

N=6, (p1,p2, p3, p4, p5, p6)=(w1, w2, w3, w4, w5, w6)=(100, 50, 20, 10, 7, 3) and M=165. Solve the above problem using dynamic programming approarch.

Module VI58. What do you mean by Branch & Bonnd & how it is differ from other method.59. Write difference between FIFO branch and bound and LC branch and bound

algorithms.60. Devise algorithm for the knapsack problem using Branch and Bound Technique.61. Devise algorithm for the traveling salesman problem using Branch and Bound

Technique.

Page 48: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

62. Consider the following traveling salesman instance defined by the cost matrix∞ 7 3 12 83 ∞ 6 14 95 8 ∞ 6 189 3 5 ∞ 1118 14 9 8 ∞

Obtain the reduced cost matrix.63. Draw the state space tree generated by LCBB for the following knapsack instances:

(a) n=5, (p1,p2,…….,p5)=(10,15, 6, 8, 4), (w1, w2,…….,w5)=(4, 6, 3, 4, 2), and m=12

(b) n=5, (p1,p2,…….,p5)=(w1, w2,…….,w5)=(4, 4, 5, 8, 9), and m=15

64. Given a cost matrix for three persons P1,P2 P3 which are assigned following tasks:T1 T2 T3

P1 6 9 5C= P2 4 8 3

P3 5 11 6Obtain the minimum total cost of assignment using Branch and Bound Technique, where each person has exactly one task to perform.

Module VII65. Explain the concept of NP. Explain NP – completeness & satisfiability.66. Write an algorithm for Random Number Generations & write at least two application

of Random Number.67. What is a non-deterministic Turing machine? State cook’s theorem.

Show that the job sequencing with deadlines is NP-hard.Differentiate between NP, NP- complete and NP-hard.

Prove that if any NP – complete problem is solvable in polynomial time then all N⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪

e is a polynomial time algorithm is available for clique⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪ problem, then show that how to use clique solution to determine the maximum

clique size of a given graph in polynomial time.What do you mean by polynomial time reducibility. Explain with the help of an

example.

Page 49: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER-VI

CS 6103 SYSTEM PROGRAMMING TUTORIAL SHEETDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

Module-I1. What do you mean by system programming? How is a system program different from an

application program?

2. Write short notes on subroutines. Distinguish between open and closed sub-routines.

3. What is a language translator. Name some language translators?

4. Briefly describe the evolution of at least five system softwares .

5. What is the function of a compiler? How is it different from interpreter?

6. What are the different types of addressing modes. Explain each briefly.

7.Describe the architecture of Simplified Instructional computer(SIC).

8.Differentiate between RISC & CISC.

9.Describe basic architecture of RISC machine with some example.

10.Describe basic architecture of CISC machine with some example.

Module II & III

11. How does a machine level language differ from assembly language?

12. Describe briefly the elements of assembly language.

13. What are the different types of statements in assembly language programming?

14. Explain two ways in which constants can be used in assembly language programming.

15. Explain the term LC processing.

16. What is backward referencing?

17. Define the terms: Fragmentation, Paging, Demand Paging, Relocatable Partitions.

18. Define an assembler.

19. Without using the opcode MULT (03), write an assembly language program to compute the expression:

M / ( 5 + (75 * Y) – 2 ).

Give the equivalent machine language program for the program written. Use the mnemonics used for the

Simple Instructional Computer.

20. Describe two-pass structure of assembler? What are the data structures used in each pass? Explain how

forward references are handled.

Page 50: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

21. Explain variant-I of the intermediate code for the imperative statements.

22. Explain variant-II of the intermediate code for the imperative statements.

23. Illustrate with examples:

ORIGIN, EQU and LTROG

24. What do you understand by segment override? Explain.

25. What do you mean by analytic operators? Explain.

26. What do you mean by synthetic operators? Explain.

27. What is LC alignment? Explain.

28. What is the purpose of FRT and CRT? How are these tables organized?

29. Write the algorithm of the pass 1 of a two pass assembler.

30. Describe the different data structures used by the pass 1.

31. Compare the different intermediate code variants and discuss their advantages or disadvantages

32. The following program. Is fed to the assembler

START 100A DS 3L1 LOAD B

ADD C STORE D

D EQU A+1L2 PRINT D

ORIGIN A+2C DC '5'

ORIGINL 2+1STOP

B DC '19'END

(a) Show that contents of the symbol table at the end of pass 1

(b) Explain the significance of EQU and ORIGIN statements in the above

program and explain how they are processed by the assembler.

33. Describe how error-listing and error reporting are done in single pass assembly? What are the

various problems of single pass assembly and how they are tackled?

34. Present the algorithm of pass-2 of a two pass assembler.

35. What are the different machine dependent features of an assembler? Explain.

36. What are the different machine independent features of an assembler? Explain

37. What is a multi pass assembler?

38. Write the advantages and disadvantages of a single pass assembler over a multi pass assembler.

Page 51: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

Module IV & V

39. What is general loader scheme? What are its advantages over ‘compile and Go’ loader scheme?40. Compare and contrast ‘Compile and Go’ loaders and absolute loader.41. Explain direct linking loaders? What is the information that the assembler must provide to the direct linking loader? Explain with examples.42. What is program relocation and how it is performed? In which cases the loader or linker may change the origin of the program.43. What is address-sensitive program? What are the information that the assembler must provide to the linker so that it can perform relocation and liking of the program?44. With the help of an example explain how relocation and linking is performed by the direct linking loader.45. Describe the components of the object module of a program.46. Present the relocation algorithm.47. Present the algorithm for program linking.48. Explain

a) Non relocation programsb) Relocation programsc) Self relocation programs

49. What is an overlay structured program? What modifications in the linking algorithm are required for overlays?50. Explain relocation requirements in segmented addressing.51. Explain:

(i) Dynamic Loading(ii) Dynamic linking

52. What is Binder? Explain.53. What are the different machine dependent features of a Loader? Explain.53. What are the different machine independent features of a Loader? Explain

Module-VI

54. Explain the similarities and the differences between macro expansion and subroutine calls.55. Illustrate macro definition with an example.56. Present the macro expansion algorithm.57. Explain what are positional parameters with the help of an example.58. Explain what are keyword parameters with the help of an example.59. Describe nested macro calls with an example.60. Discuss a method for handling nested macro calls.61. What are macro preprocessors? Present the two pass structure of a macro–assembler.62. Explain semantic expansion of macro with the help of an example.63. Write a macro to calculate power of a number.64. With the help of an example show the content of MDT during a macro definition processing.65. Give a brief overview of macro assembler having 3 passes.66. How Macro can be expanded with arguments? Show with example.67. How Macro can be expanded with conditions? Show with example.

Module-VII

68. What is software engineering? 69. Define a software tool. What are the different categories of tools used in program design, coding, testing and debugging.70. What are functional and non-functional requirements in software engineering?

Page 52: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

71. What is SRS? 72. What are characteristics of good software design? List some software design tools.73. What do you mean by software maintenance? Distinguish between adaptive maintenance and enhancement.74. How might reverse engineering contribute to effective software maintenance? 75. What are different types of testing? How to design a test case?

SEMESTER-VI

CS 6106 COMPILER DESIGN LAB ASSIGNMENTSDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

[Questions in bold are optional and carry higher credit]You are permitted to use any of the 3 programming languages – C, C++, Java – unless and until explicitly stated in the problem statement.

Programming Assignments

1. Consider the following regular expressions:a) (0 + 1)* + 0*1*b) (ab*c + (def)+ + a*d+e)+

c) ((a + b)*(c + d)*)+ + ab*c*dWrite separate programs for each of the regular expressions mentioned above.

2. Design a Lexical analyzer for identifying different types of token used in C language. [Note that the reserved keywords such as if, else, class, struct etc must be reported as invalid identifiers. C allows identifier names to begin with underscore character too. Further, the real numbers can also be expressed in the form 1.75e-30 which is 1.75 x 10-30. ]

3. Given a text-file which contains some regular expressions, with only one RE in each line of the file. Write a program which accepts a string from the user and reports which regular expression accepts that string. If no RE from the file accepts the string, then report that no RE is matched.

4*. Write a program which accepts a regular expression from the user and generates a regular grammar which is equivalent to the R.E. entered by user. The grammar will be printed to a text file, with only one production rule in each line. Also, make sure that all production rules are displayed in compact forms e.g. the production rules:

S--> aB, S--> cdS--> PQ

Should be written as S--> aB | cd | PQ

And not as three different production rules. Also, there should not be any repetition of production rules.

5. Write a program to eliminate left recursion.

Page 53: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

6. Write a program for Recursive Descent Calculator.

7. Write a program that recognizes different types of English words.

8. Consider the following grammar:S --> ABCA--> abA | abB--> b | BCC--> c | cC

Following any suitable parsing technique(prefer top-down), design a parser which accepts a string and tells whether the string is accepted by above grammar or not.[This grammar is not as simple as it appears to be. Try to check if the string abbcc is accepted or not. It is accepted, but improper logic of parsing can cause the program to get stuck or go into infinite loop !! The students are permitted to generate an equivalent grammar by removing ambiguities (if any) and immediate left-recursion from the given grammar.]

9. Write a program which reads a left-recursive regular grammar, and removes left recursion from the grammar. For example: A possible input grammar is S--> Sa S-->a Its output after removal of left-recursion will be S--> aS S-->a[Extra credit will be given if the code is able to handle production rules of the type S--> Sa | a etc.]

10. Write a program which accepts a regular grammar with no left-recursion, and no null-production rules, and then it accepts a string and reports whether the string is accepted by the grammar or not.

11. Design a parser which accepts a mathematical expression (containing integers only). If the expression is valid, then evaluate the expression else report that the expression is invalid. [Note: Design first the Grammar and then implement using Shift-Reduce parsing technique. Your program should generate an output file clearly showing each step of parsing/evaluation of the intermediate sub-expressions. ][Extra credit will be given if the program can handle advanced operations such as exponentiation, square-root, cube-root, logarithm etc]

12. Implement problem no. 2 using LEX , and problem no. 8 and 11 using YACC .

13*. Consider the following sample program written in a hypothetical language.

BEGIN PRINT “HELLO” INTEGER A, B, C REAL D, E STRING X, Y A := 2 B := 4 C := 6 D := -3.56E-8 E := 4.567 X := “text1” Y := “hello there” PRINT “Values of integers are [A], [B], [C]” FOR I:= 1 TO 5 STEP +2

Page 54: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

PRINT “[I]” PRINT “Strings are [X] and [Y]”END

Output of the above hypothetical program is

HELLOValues of integers are 2, 4, 6135Strings are text1 and hello there.

Develop a grammar for this hypothetical language, and then write a compiler which works as per the following phases.

The input is a program in the aforesaid hypothetical language. Filename has the extension as “.hyp” Phase 1: Lexical analysis – checks whether the syntax is correct or not. If correct, proceed to Phase 2, else report the exact line number where the syntax is incorrect, and stop then and there.Phase 2: Generation of symbol table to handle the variables and their types etc. An output file called symtab.sym will be created which will contain the relevant data. This symbol table will be used while generating the intermediate code in next phase for detecting undeclared variables etc, and reporting linker errors appropriately. Phase 3: Using the result of lexical analysis, the input file and the symtab.sym – generate the intermediate code – in C++ or Java. The intermediate code will be generated in a file called _interm.c or _interm.java as the case may be. As explained above, if any undeclared variables, or invalid values for any variable are encountered, then generate a linker error containing the exact variable name, and line number, and stop immediately without generating any intermediate code.The intermediate code must be compiled and run by the appropriate compiler (cc or javac) without any errors.[This is a very open-ended problem. The more features of language taken into consideration, will be given more the marks. Also, check for cases of undeclared variables, assignment of integer value to STRING variables, assigning of real numbers to INTEGERS etc]

14. Develop a parser which accepts a string and reports whether it is a valid SQL query statement or not.

15*. Develop an interpreter which understands the assembly language instructions for Intel-8085 microprocessor, and executes the instructions correctly. User should be able to see the values in all relevant “registers” (registers will be implemented through variables) at any time.A sample working of the interpreter is shown below

input: MVI A, 34Houtput: Valid statement. A = 0x34 = 52input: MOV Aoutput: Invalid statement. No source register specifiedinput: INC Aoutput: Valid statement. A = 0x35 = 53input: MVI B, 10Houtput: Valid statement. B = 0x10 = 16input: ADD A, Boutput: Valid statement. A = 0x45 = 69, B = 0x10 = 16input: LXI H, 1234Houtput: Valid statement. Register pair HL. H = 0x12 = 18, L = 0x34 = 52

Page 55: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER-VI

CS 6108 COMPUTER NETWORKS LAB ASSIGNMENTDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

Class -I and II: Familiarization to: 1. Network components such as Modem, Gateways, Routers, Switches, Cables etc.2. Various network softwares, services and applications.3. Network trouble shooting Techniques: Trouble shooting basic TCP/IP problems.4. Commands like ipconfig, getmac, tracert, pathping, arp, ping, netstat, finger etc.5. Straight cabling, Cross cabling, Signal testing, T568A and B wiring standards (including

hands on practice)

Class -III, IV, and V: 1. Program that prints the address of www.bitmesra.ac.in2. Program that prints all the addresses of www.indianrail.gov.in3. Program that scans lower ports and prints them.4. Program to list host names from command line, attempt to open socket to each one and print

the remote host, the remote port, the local address and the local port.

Class - VI and VII: 1. Program for splitting the URLs entered into command line into component parts.2. Program to list all the interfaces available on a workstation.

Class - VIII and IX: TCP/IP and UDP/IP socket Programming1. Program for “echo” client. The Client enters data to the server, and the server echoes the data

back to the clients.2. Program for “echo” Server. The Server listens at the port specified and reads from client and

echoes back the result.

Class- X and XI: Serial Port programming1. Program to write out “Hello World” to a serial port or to a USB to Serial Converter.2. Simple RPC Programming. (Introductory level)

Text Book:1. Youlu Zheng and Shakil Akhtar, Networks for Computer scientists & Engineers/Labmanual, Oxford Univ. Press2. Douglas E.Comer, Hands on Networking with Internet Technologies, Pearson

Page 56: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

Education

SEMESTER-VI

CS 6110 SOFTWARE ENGINEERING LAB ASSIGNMENTDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

CompulsoryFor the given case/ problem statement do the following;

1. Prepare a SRS document in line with the IEEE recommended standards.2. Draw the use case diagram and specify the role of each of the actors. Also state the precondition,

post condition and function of each use case.3. Draw the activity diagram. 4. Identify the classes. Classify them as weak and strong classes and draw the class diagram.5. Draw the sequence diagram for any two scenarios.6. Draw the collaboration diagram.7. Draw the state chart diagram.8. Draw the component diagram.9. Perform forward engineering in java.(Model to code conversion)10. Perform reverse engineering in java.(Code to Model conversion)11. Draw the deployment diagram.

Optional1. Perform forward engineering in visual C++.2. Perform reverse engineering in Visual C++.3. Perform forward engineering in Visual Basic.4. Perform reverse engineering in Visual Basic.5. Write a program of memory leak and test it with rational purify.

Page 57: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER-VII

CP 7101 PRINCIPLES OF PROGRAMMING LANGUAGES TUTORIAL SHEETDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

Module I1) What do you understand by principles of programming languages? Why do we

need to study them? Give at least 3 reasons.2) Briefly summarize historical development of programming languages.3) Write short notes on evolution of software architectures.4) What are the various programming paradigms? Briefly explain each paradigm

with example.5) What are the attributes of a good programming language?6) Explain the concept of data abstraction and encapsulation.7) What are abstract types? Explain with example.8) What is interface? What is its use?9) What are the implementation difficulties with multiple inheritances?10) Design a Counter class, such that each Counter object is to be a counter (i.e.

nonnegative integer). Equip your class with operation to zero the counter, and inspect the counter. Implement your class using suitable object oriented language.

Module II11) What is importance of generic abstraction? How we can instantiate generic units

to generate ordinary program units?12) What is strongly typed language?13) How can we parameterize generic units with respect to values and types?14) Discuss how generic units are implemented? What are the problems caused by

type parameters?15) Consider the following objects. Develop a class hierarchy for them and define the

appropriate set of functions for computing volume, surface-area, and perimeter (as

Page 58: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

appropriate): box, circle, triangle, polygon, line, point, sphere, square, trapezoid, parallelogram, hexagon, pentagon, pyramid, and cone.

16) What is parametric polymorphism? Discuss its implementation.17) Distinguish between explicit and implicit type conversion with the help of

examples?18) What is context-independent overloading?

Module III & IV19) What is the effect of sequencers on the program’s control flow.20) What are exceptions and we can use them for handing abnormal conditions?21) Discuss the problems that are caused by concurrency which do not exist in

sequential programs.22) What do understand by critical reasons? What would be the advantages and

disadvantages of using Postscript rather than HTML as the Web display language?

23) How we can use high-level control abstraction for managing concurrency?24) Discuss the key concepts of imperative programming.25) Compare the disadvantages of using global variables and advantages of data

abstraction.26) Discuss the design issues of any one imperative programming language.27) Discuss the methods for establishing correspondence between actual parameters

and formal parameters.28) What are the various ways o transmitting parameters?29) Take one short program that you have written in an imperative language and

rewrite it to be applicative.

Module V30) What the key features are of object oriented programming.31) What are the basic differences of c and c++.32) What do you mean by data abstraction?33) Why the java implementation employ dynamic linking.34) What are the extra features added in ADA95.35) Every java object is heap variable, while a c++ object may be either global or

local variable or heap variable. What are the advantages and disadvantages of java’s inflexibility?

36) What are the basic differences between c++ spellchecker, java spellchecker explain with example.

37) Given an example of a feature from each of java and c/c++, which promote or violate the following language design principle: automation, simplicity, security, regularity, portability.

Page 59: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

Module VI & VII38) What are the key features of concurrent programming language?39) Explain the important concurrent control of ADA95.40) Explain the important concurrent control of java.41) Show neither the stop method in java, nor interrupt method, enables us to

guarantee of rough thread.42) Modify the Sieve of Eratosthenes example so that all printing is done by

printserver; that is a thread that loop through a buffer accepting prime numbers and printing them. Like the other threads, it should terminate when it received the negative number.

43) In java it is not possible to write synchronized block protecting acess to a component of primitive type.

a) Explain whyb) Suggest two ways you might work around this problem.

44) Write an implementation of Banker’s algorithm in java.45) Why the primitive priority scheduling important? To what extent do ADA95 and

java meet this need? Describe the Yeild method in JAVA and say why it is less useful than it might be. Find out the nearest equivalent in ADA 95.

46) Explain priority inversion. Show that many cases of priority can be automatically prevented in ADA. Suggest steps than programmer can take to reduce the risk of priority inversion in JAVA programs.

47) What are the key concepts of functional programming?48) The C++ expression “E1 && E2 “ Yields true if and only if both E1 and E2 yield

true; moreover , evaluation of E2 is short – circuited if E1 yields false. The ADA expression “E1 and then E2 “behaves likewise. Explain why “&&” and “and then” cannot be defined as ordinary operators or functions in their respective languages.

49) (a) Define a HASKELL function cond such that “cond (E1, E2, E3)” has exactly the same effect as the HASKELL expression “if E1 then E2 else E3”. Take advantage of lazy evaluation.

(b) Explain why such a function cannot be defined using eager evaluation50) Consider the function definition “F I= E” and the function call “F A”. Normal -

order evaluation might be characterized by1. F A ≡ E [I = A ]

Where E [I = A] is the expression obtained by substituting A for all free occurrences of I in E. (a) Characterize eager evaluation in an analogous fashion. (b) Show that E[I = A] must be defined carefully, because of the possibility of confusing the scopes of an identifier with more than one declaration. For example consider:

2. Let3. F n = let m = in m * n

a. m = 2 4. in f (m+1)

Page 60: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

51) Draw a diagram similar to Figure 14.2, that show the effect of evaluating “ns1 ++ ns2”, where ns1 is the list [2, 3, 5], ns2 is the list [7, 11, 13, 17], and “++” is the concatenation operator.

52) (a) Define a HASKELL type whose values are binary search trees (BSTs) with integer components. (b) Define a function that inserts a given integer into a BST. (c) Define a function that maps a given unsorted integer list to a BST, using your insertion function. (d) Define a function that maps a BST to an integer list using left –root – right traversal. (e) From the composition of function (c) and (d). What dose it do?

53) Write a Haskell function named element which count the number of elements in a list. It should produce the same result as the length function.

54) (a) Give a recursive definition of the Haskell function length, which compute the number of entries in a list.

(b) Prove by induction the following, given your definition of length: length (xs ++ ys)= length(xs)+length(ys).

55) What are the key features of logic programming?56) Write a Prolog program to find the maximum, minimum and the range of the

values in a list of numbers.57) Consider the Prolog to find the factorial of the number n.58) Explain the resolution and unification with example. What do you mean by Horn

clauses?59) a) Write the following statements as a series of prolog facts and rules. Mammals have four legs and no arm, or two arms and two legs. A cow is mammal. A cow has no arms. b) Can prolog derive the conclusion that a cow has four legs? Explain.60) What are the key features of scripting?61) Consider a spreadsheet used by a small organization to keep track of its finance.

Would you classify such spreadsheet as script? Explain your answer.62) Write the python procedure that neatly tabulates the component of dictionaries.63) Design and implement how the python spellchecker works.64) How the python has been used to help implement Web Search Engine.65) Why is Perl suited for CGI scripts? Why is C a poor choice to use instead of Perl?

Page 61: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER-VII

CS 7104 COMPUTER GRAPHICS LAB ASSIGNMENTDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

1. Write a program to display two big "M" one carded into the other using the character 'M' without using gotoxy() or other graphics functions.2. Write a program to display the horizontal mirror image of the ‘M’ generated in the above question no. 1. (Axis of reflection is vertical).3. Write a program to display the vertical mirror image of the ‘M’ generated in the above question no. 1. (Axis of reflection is horizontal).4. Write a program to display circles of randomly changing diameters, colors and fill patterns at random positions on the screen.5. Write a program to display triangles of randomly changing shapes, colors and fill patterns at random positions on the screen.6. Plot a graph of sin(x), 0<x<360, using the character ‘*’.7. Write an interactive program that will create a database of marks (out of 50) of 10 students in Computer-Graphics. Then display the marks and its percentile. Finally display the percentile using a 3D-Bar Graph.8. WAP to Using DDA algorithm draw a line from (20, 10) to (30, 15).9. WAP to Using Bresenham’s algorithm draw a line from (5, 7) (10, 10).10. WAP to draw a circle using Mid-Point algorithm.11. WAP to draw an ellipse using Mid-point ellipse algorithm.12. Generate a wheel structure. Rotate it.

OPTIONAL13. Plot a graph of cos(x), 0<x<360, using the character ‘*’.14. Draw a Bar chart for monthly sales over a period of one year. Indicate the sales & months.15. Draw a line graph for monthly sales over a period of one year. Indicate the sales & months.

Page 62: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

16. Write a program to simulate a Clock. (i) Analog (ii) Digital Give a relevant heading using gothic font.17. An airplane is flying across the screen and a tank is moving on the ground and trying to hit the airplane with bombs. When a bomb strikes the airplane an explosion occurs. Represent this graphically.18. Animate a square that takes the shapes of a circle, triangle, Rectangle and back to square. The axis of rotation is at the center of the square & normal to the screen.

SEMESTER-VII

CS 7106 PARALLEL COMPUTING LAB ASSIGNMENTDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

Compulsory

1. Write a parallel program to print any input message supplied by user.2. Write a parallel program to add two one dimensional arrays of size 'n'.3. Write a parallel program to add two matrices of order n * n.4. Write a parallel program to multiply two matrices.5. Write a parallel program to multiply a matrix of order n x n by a vector of size n. 6. Write a parallel Program to count the no. of vowels in a text.7. Write a parallel program to find the largest element of n elements.8. Write a parallel program to count no. of characters, words and lines in a file.9. Write a parallel program to find factorial value of an integer.10. Write a parallel program to find the transpose of a given Matrix.11. Write a parallel program to implement ring topology.12. Write a parallel program to find the largest and the second largest from a list of elements considering

minimum no. of comparisons.

OPTIONAL

13. Write a parallel program to sort n elements, using any sorting technique.14. Write a parallel program to solve a set of linear equations using gauss elimination method.15. Write a parallel program to find the inverse of a given matrix of n*n order.16. Write a parallel program to find minimal path (minimal cost) in an undirected graph.17. Write a parallel program to find roots of an equation using N-R method.

Page 63: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER-VII

CS 7108 DIGITAL IMAGE PROCESSING LAB ASSIGNMENTDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

[Questions in Bold are optional and carry more weightage]1. Implement basic contrast enhancement using in built Matlab functions. 2. Implement adaptive thresholding of a gray scale image and compare its performance with

ordinary thresholding.3. Implement Floyd Steinberg dithering on a 8 bit gray scale image.4. Implement bit plane slicing for a gray scale image. Reconstruct the image by joining select bit

planes.5. Implement histogram equalization without the use of Matlab’s in built functions and compare its

performance to Matlab’s in built function.6. Implement local histogram equalization.7. Implement histogram specification on a 8 bit gray scale image in Matlab.8. Develop a method to add random noise to an image for user specified parameters without the use

of Matlab’s in built functions9. Implement order statistic filtering of images. Compare the performance of your own

implementations with Matlab’s in built functions.10. Implement the following noise removal functions on 8 bit gray scale images using your own

functionsa. Max filterb. Min filterc. Alpha trimmingd. Contra harmonic filtere. Geometric mean filter

11. Implement homomorphic filtering in Matlab12. Implement filtering in the frequency domain for images using Matlab’s in built functions.13. Implement ILPF, BLPH, IHPF & BHPF for images using your own functions.14. Perform Weiner and Blind Deconvolution based image restoration using Matlab’s in built

functions.15. Write functions in Matlab to compute the entropy of an image.

Page 64: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

16. Generate Huffman codes for a gray scale 8 bit image17. Implement IGS on a gray scale image18. Simulate JPEG like compression on a gray scale image and report the compression ratio.19. Write a program in C to read a BMP file and extract its fields.20. Write a program in C to extract the contents from a TIFF file

SEMESTER-VIII

CS 8102 ARTIFICIAL INTELLIGENCE AND EXPERT SYSTEMS LAB ASSIGNMENTDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

1. Describe the following family tree as series of PROLOG facts.M – Married toC – Child of

Anthony – M – Mary | | C Harry Hazel – M – Tom

Write queries to answer the following:a) Who is the sister of Harry?b) Who is the father of Hazel?

2. The following Diagram depicts name of employees and their supervisors.Watson

Johnson John Banker

Smita Evens

WAP which contain all the supervisor relationship in diagram and answer the given queries. who is supervisor of evens whom supervisor is Watson

3. Write a PROLOG program that answers about family members and relationships. Include predicates & clauses which define sister, brother, father, mother, Grandchild, grandfather and uncle. The program should be able to answer question such as following.Father (X, bob)Grandson (X, Y)Uncle (bill, Sue)Mother (marry, X)

Page 65: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

4. Write Prolog Program to Create following database.

------------------------------------------------------- | P_Name | Age | Hobby | Pet | | -----------|---------|-------------------|----------| | Ram | 15 | Football | Dog | |------------|---------|-------------------|----------| | Mohan | 11 | Volleyball | Cat | |------------|---------|-------------------|----------| | Sohan | 25 | Card | Cow | |------------|---------|-------------------|----------| | Mahesh | 30 | Swimming | Dog | |------------|---------|-------------------|----------| | Ravindra | 11 | Football | GOat | |------------|---------|-------------------|----------| | Rakesh | 25 | Volleyball | Cat | |------------|---------|-------------------|----------| | Rajeev | 15 | Swimming | Dog | |------------|---------|-------------------|----------| | Raju | 30 | Swimming | Dog | |------------|---------|-------------------|----------| | Jaichand | 40 | Football | Cow | |------------|---------|-------------------|----------| | Vijay | 30 | Volleyball | Cat | -----------------------------------------------------

a) Write Query to display P_name and age, P_Name and hobby.

b) Find How many of them are child if age <=15 is child.

c) X will like Y if X & Y are Persons & they are not same in age but they are children & have a common interest then show who likes whom.

5. Write a Prolog code for Monkey Banana Problem.

6. Write a prolog program for insertion sort and bubble sort.

7. a) Write a prolog program to depict the functioning of cuts. b) Write Prolog program to find the sum of numbers in a list.

8. Write a Program to reverse list of names.

9. Prove that any planar graph cannot be colored with less than 4 colors in prolog.

10. Represent a graph in Prolog and apply Breath first search on it.

Optional Programs:1. Write a program in prolog to implement dfs on water jug problem.

Given a 4 - liter jug filled with water & an empty 3 - liter Jug, how can one obtain exactly 2 liters in 4 liters jug. There is no measuring mark on any of them.

2. Solve the 8 puzzle Problem-using A* algorithm in Prolog.

3. Write program for Backward and forward reasoning in Prolog4. Write a program to implement steepest ascent for 8 puzzle problem.

Page 66: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

CS 8104 SIMULATION AND MODELING LAB ASSIGNMENTDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

1. Simulation of a single server queuing system.2. Simulation of a multi –server queuing system.3. Simulation of an Inventory system.4. Simulation of a Multitellor Bank.5. Simulation of a Manufacturing system.6. Simulation of a Telephone system and determine what proportion are successfully completed,

blocked, or found to be busy calls.7. Simulation of a simple run of river storage demand system.8. Student Beer Company is trying to determine the distribution of the breaking strength of ther glass

bottles. Twenty five bottles are selected at random and tested for breaking strength, with the following results(in pounds per sq. inch):

218.95 232.75 212.80 231.10 215.95237.55 235.45 228.25 218.65 212.80230.35 228.55 216.10 229.75 229.00199.75 225.10 208.15 213.85 205.45219.40 208.15 198.40 238.60 219.55

a) Use the chi-square test with equiprobable intervals to test these breaking strengths for normality at a level of significance of α= 0.05

b) The manufacturing of the bottles says the breaking strengths are normally distributed with μ=200 and σ= 15.. Test the manufacturer’s claim at a level of significance of α= 0.05.

c) The highway between Atlanta, Georgia, and Athens, Georgia, has a high incidence of accidents along its 100km. Public safety officers say that the occurrence of accidents along the highway is randomly distributed, but the news media say otherwise. The Georgia Dept. of Public safety published records for the month of September. These records indicated the point at which 30 accidents involving an injury or death occurred, as follows( the data points represent the distance from the city limits of Atlanta):

88.3 40.7 36.3 27.3 36.891.7 67.3 7.0 45.2 23.398.8 90.1 17.2 23.7 97.432.4 87.8 69.8 62.6 99.720.6 73.1 21.6 6.0 45.376.6 73.2 27.3 87.6 87.2

Page 67: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

Use the K-S Test to determine whether the distribution of location of accidents is uniformly distributed for the month of September

9. Records pertaining to the monthly number of job related injuries at an underground coal mine were being studied by a federal agency. The values for the past 100 months were as follows:

Injuries Frequency of Occurrence---------- ---------------------------------

0 351 402 133 064 045 016 01

-------------------------------------------------a. Apply the chi-square test to these data to test the hypothesis that the

underlying distribution is Poisson. Use level of significance of α= 0.05b. Apply the chi-square test to these data to test the hypothesis that the

distribution is Poisson with mean 1.0 . Use level of significance of α= 0.05

c. What are the differences in parts (a) and (b), and when might each case arise?

10. Use the linear congruential method to generate a sequence of three two-digit random integers. Let Xo= 27, a=8, c=47, and m=100.Do we encounter a problem if X0 = 0 ?

11. Use the multiplicative congruential method to generate a sequence of four three-digit random integers. Let Xo=.117, a=43, and m=1000.

12. The sequence of numbers 0.54, 0.73, 0.98, 0.11, and 0.68 has been generated. Use the K-S. test with α=0.05 to determine if the hypothesis that the numbers are uniformly distributed on the interval [0,1] can be rejected.

13. Write procedure for generating random number using Acceptance-Rejection technique.14. Write a computer program that will generate 4 digit random numbers using the multiplicative

congruential method. Allow the user to input values of X0, a,c, and m15. Develop a generator for a triangular distribution with range (1,10) and mode at x=4

OPTIONAL

1. Simulate Traffic Control System.2. Simulate Auto Pilot System.3. Simulate Railway Reservation System.4. Simulate Automobile Suspension Problem5. Simulation of an Activity Network.

Page 68: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER-VIII

CS 8105 DISTRIBUTED SYSTEMS TUTORIAL SHEETDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

Module I: Characterization of Distributed Systems and System Models

1. What is a distributed system? Give a few examples of Distributed systems that are in practice.2. What is the motivation behind the development of distributed system?3. Enumerate and explain the benefits and challenges in a distributed system compared to its

centralized counterpart. You may consider an example scenario to justify the differences.4. What additional challenges has the nomadic computing added to the existing distributed

computing paradigm?5. What is a middleware? Give few examples of distributed middleware systems in practice.6. What is utility computing paradigm? How closely it is relevant to distributed computing paradigm

and what additional challenges does it pose?7. What are the homogenous and heterogeneous systems? Give examples.8. Resource management issue has been talked about a lot in distributed computing paradigm. What

are the issues and how those issues are addressed by different resource management systems?9. What is the Convolution process? How security to jobs executed remotely is provided through

convolution process?10. What is the issue of Scalability? Discuss some of the guiding principles for designing a scalable

distributed system.11. Taking an example middleware (say Globus), explain its functional components.12. Enumerate and explain in brief the important design issues for a distributed system.13. What are microkernel model and monolithic kernel models? Explore the suitability of these

models in a distributed scenario and justify your answer.14. What are the two broad categories of operating systems meant for distributed computing systems?

Compare them.15. In what respect are distributed computing systems better than parallel processing systems? Give

examples of three applications for which distributed computing systems will be more suitable than parallel processing systems.

16. Enumerate and explain various models used for building distributed computing systems.17. What are the Synchronous and Asynchronous distributed systems? What are the issues?18. The Network Time Protocol service can be used to synchronize computer clocks. Explain why,

even with this service, no guaranteed bound is given for the difference between two clocks.

Page 69: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

19. Define the integrity property of reliable communication and list all the possible threats to integrity from users and from system components. What measures can be taken to ensure the integrity property in the face of each of these sources of threats?

20. Describe possible occurrences of each of the main types of security threats (threats to processes, threats to communication channels, denial of service) that might occur in the Internet.

Module II: Networking and Internetworking

21. What is the task of an Ethernet switch? What tables does it maintain?22. What are Layer 2/3 switches? List out the network components and the specifications needed to

build a distributed computing fabric. You might need to consider a problem scenario.23. Compare connectionless and connection-oriented communication for the implementation of each

of the following application-level or presentation-level protocols: 1. Telnet, 2. FTP, 3. user location, 4. information browsing, 5. RPC

24. Write a note on any distributed FTP.25. Write note on ATM networks.

Module III: Interprocess Communication

26. What are the various layers of a middleware? Draw the layered diagram of a distributed system. Explain the functionalities of and services offered at each layer.

27. What are blocking and non-blocking communication primitives? Compare these from their efficiency viewpoint for use in Distributed systems. Justify.

28. With the help of architectural diagram explain CORBA.29. What is Group communication? When and where it is required? What are the open group and

closed groups and how group communication is accomplished?30. Write the primitives and explain the 4.3BSD UNIX IPC mechanism?31. What are idempotent and non-idempotent operations? Suggest a mechanism to handle idempotent

operations.32. What is remote method invocation and how it is achieved?33. What is the main purpose of using an acknowledgment message in an IPC protocol? Are

acknowledgment always needed for reliable communication? Give reasons for your answer.34. Write note on Remote Procedure Calls.35. Discuss the different types of call semantics used in RPC systems.

Module IV: Time and Global States; Coordination and Agreement

36. What is the clock synchronization problem? How this has a great bearing on execution of distributed applications?

37. What are External and internal synchronization? State example situations where these might be necessary.

38. Discuss the Christian and Berkley algorithms for clock synchronization. 39. What is the concept of logical and physical clocks? Enumerate the different issues involved in

these two approaches.40. Discuss how it is possible to compensate for clock drift between synchronization points by

observing the drift rate over time. Discuss any limitations to your method.41. Consider the behavior of two machines in a distributed system. Both have clocks that are

supposed to tick 1000 times per ms. One of them actually does, but the other ticks only 990 times per ms. If UTC updates come in once a minute, what is the maximum clock skew that will occur?

42. Why mutual exclusion is required in distributed systems? Discuss how it can be achieved in a centralized and distributed setup?

43. Explain the Bully algorithm.44. Suggest how to adapt the Bully algorithm to deal with temporary network partitions and slow

processes.

Page 70: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

45. Explain why the algorithm for reliable multicast over IP multicast does not work for open groups. Given any algorithm for closed groups, how, simply, can we derive an algorithm for open groups?

Module V: Transactions and Concurrency Control

46. What are ACID properties? 47. Describe the lost update problem.48. Describe the inconsistent retrieval problem.49. Explain the distributed deadlock problem. How the problem can be addressed?50. Describe the concurrency control mechanism. 51. Describe how a non-recoverable situation could arise if write locks are released after the last

operation of a transaction but before its commitment.52. What are the advantages and drawbacks of multiversion timestamp ordering in comparison with

ordinary timestamp ordering?

Module VI: Distributed Transactions

53. What are Flat and Nested transactions?54. What are one-phase and two-phase atomic commit protocols?55. How the two-phase commit protocol works for nested transactions?56. What are the Flat and Hierarchic two-phase commit protocols?57. Discuss the recovery of the two-phase commit protocol.58. Give an example of the interleavings of two transactions that is serially equivalent at each server

but is not serially equivalent globally.59. Extend the definition of two-phase locking to apply to distributed transactions. Explain how this is

ensured by distributed transactions using strict two-phase locking locally.60. Explain how the two-phase commit protocol for nested transactions ensures that if the top-level

transaction commits, all the right descendants are committed or aborted.

Module VII: Replication

61. What is active and passive replication? Discuss their role in fault tolerance.62. What are faults in distributed scenario and how replication helps in dealing with such situations?63. Discuss the “gossip” architecture in detail.64. What do you mean by a highly available service?65. Discuss the Bayou system.66. Discuss the Coda file system architecture.67. What are the different replication protocols? Explain.68. What is a network partition problem? How a replication scheme deals with such situations?69. Explain the Quorum based protocol.70. What are the different consistency models?

Page 71: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

EC 6112: VLSI DESIGN LABORATORY

LIST OF EXPERIMENTS:

COMPULSORY EXPERIMENTS:

1. Design of a half adder using the block level entries and simulate it on Active HDL

2. Design of a 3-to-8 decoder using block level entries and simulate it on Active

HDL

3. Design of a synchronous counter with the following states and simulate it making

the entries through FSM on Active HDL

Page 72: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

4. Writing of Code for Full adder using VHDL and its simulation on Active HDL.

5. Design of a 8:1 Multiplexer and its simulation on Active HDL

6. Design of a JK flip flop from a D flip flop and its simulation on Active HDL

7. Design of a two input X-OR using CMOS logic (on Cadence Tools)

8. Design of a two input NAND using Pseudo NMOS logic (on Cadence Tools)

9. Design of a Full Adder circuit using TG logic (on Cadence Tools)

10. Design of a common emitter amplifier using an NPN transistor with a gain of 50 plus and offset less than 20% of supply rail (on Cadence Tools)

11. Design of a common source amplifier using an NMOS transistor and active load for a gain of 50 plus and offset less than 20% of supply rail (on Cadence Tools)

12. Design of a difference amplifier with PMOS current mirror and NMOS input transistors for a gain of 50 plus and offset less than 20% of supply rail (on Cadence Tools)

Page 73: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

EE 5108: DIGITAL SIGNAL PROCESSING LABORATORY

LIST OF EXPERIMENTS:

COMPULSORY EXPERIMENTS:

1. Familiarization with MATLAB

2. Generation of the following sequence and to plot them using MATLAB:a.       Unit Sample Sequence D[n]b.      Unit Step Sequence u[n]c.       Ramp Sequence n. u[n]d.      Exponential Sequencese.       Sine / Cosine Sequences

3. Verification of the following general properties using MATLABa.       Linearityb.      Time Shiftingc.       Frequency Shifting

4. Computation of the linear convolution of two finite-length sequences using MATLAB

5. Obtaining the Partial Fraction Expansion of the Z-Transform expression and to find its Inverse Z-Transforms using MATLAB

6. Testing for the stability of given Discrete Time Systems using MATLAB

7. To write a MATLAB program for finding out the output of two Periodic Digital sequences using Circular Convolution. Compare your result with that obtained by theoretical evaluation

8. Computation of N-point DFT of the length-N sequence using MATLAB

9. Development of the program for finding out DFT and FFT using TMS 320C6713 DSK Processor

Page 74: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

10. To write a program and simulate using C language / assembly language for computation of Linear Convolution using TMS 320C6713 DSK Processor

11. To write a program and simulate using C language / assembly language for computation of Auto/ Cross Correlation using TMS Processor

12. To write a program and simulate using C language / assembly language for designing a Digital Filter (LP/ HP / BP / BR) using TMS 320C6713 DSK Processor

OPTIONAL EXPERIMENTS:

13. To develop a MATLAB program to convert Analog to Digital Frequencies using Bilinear Transformation

14. To design a Butterworth filter using standard design steps (for LP, HP, BP & BR filters), i.e. find out the order of the filter when Pass Band Gain, Sampling frequency and Pass Band and Stop Band Cut-Off frequencies are given. Then find out the Normalized Transfer Function and Actual Transfer Function

15. To design a Chebyshev filter using standard design steps (general programs for LP, HP, BP & BR filter design)

16. To develop a Cascade realization of the given Linear-Phase FIR/ IIR transfer functions using MATLAB

17. To write a MATLAB program to compute the Cross Correlation of two finite-length sequences. Compare your result with that obtained by theoretical evaluation

18. To write a MATLAB program to compute the Auto Correlation of two finite-length sequences. Compare your result with that obtained by theoretical evaluation

19. To write a MATLAB program to compute the PSD of two Sinusoids

20. To write a MATLAB program to compute the Inverse DFT

21. To write a MATLAB program for transforming an Analog filter into a Digital filter using Impulse invariant technique

22. To develop programs for following Frequency Transformations in the design of Digital filter: LP to Normalized Low Pass Transformations (NLPT); HP to NLPT; BP to NLPT; BR to NLPT

23. To develop a general program for Non-Recursive (FIR) filter using Rectangular, Hanning, Hamming, Blackman and Kaiser Window techniques

24. To implement LMS algorithm using TMS DSK 320C6713 DSK Processor

Page 75: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, BIT MESRATIS 1006 Foundation of Cryptography Lab.: Tutorial Sheet

MO’ 2017 Dr. (Mrs) Aruna Jain

1. WAP to check the strength of a given password.2. Implement Euclidean Algorithms to find the gcd of given numbers.3. Implement Extended Euclidean algorithm with suitable example.4. Find the multiplicative inverse of 23 in Z100.5. Find the particular and general solution to the equation:

(i) 25x + 10y = 15(ii) 40x + 16y = 88

6. What would be the transformation of a message “Good morning” using Rail Fence technique?

7. Consider a plain text message “I am a Hacker”, Encrypt it with the help of the following algorithm: (i) Replace each of the alphabet with its equivalent 7-bit ASCII Code.(ii) Add a 0 bit as the leftmost bit to make each of the above bit pattern 8 position

long.(iii) Swap the first four bits with the last 4 bit for each alphabet.(iv) Write the hexadecimal equivalent of every four bits.

8. Encrypt the message “this is an exercise” using one of the following ciphers. Ignore the space between words. Decrypt the message to get the original plaintext(a) Additive cipher with k = 20(b) Multiplicative cipher with k = 15 (c) Affine cipher with k = (15,20)

9. Use the Vigenere cipher ‘cryptography’ encipher the word using the key house.

Page 76: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

10. Use one-letter frequency attack to decipher the following message. Assume that you know it is enciphered using mono alphabetic cipher.ONHOVEJHWOBEVGWOCBWHNUGBLHBGR The encryption key in a transposition cipher is (3, 2, 6, 1, 5, 4) find the decryption key.

11. Implementation DES algorithm.12. Implementation RSA algorithm.13. Find 75 mod 11914. Using this playfair matrix

T M P Q S

Z V W X Y

E O C U R

F N A B D

L G H I/J K

Encrypt the message:“The enemy must be stopped at all costs. Do whatever is necessary.”

15. Encrypt the message “meet me at the usual place at ten rather than eight clock” using

the Hill cipher with the key (9 457 ) . Show your calculations and the result.

Page 77: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

SEMESTER-IV

CS 4108 OPERATING SYSTEM LAB ASSIGNMENTDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA

9. Write a program that will simulate FCFS, SJF, SRT (shortest remaining tine first), and round robin scheduling algorithm. For each algorithm, the program should compute waiting time, turnaround time of every job as well as the average waiting time and the average turn around time. The average values should be consolidated in a table for easy comparison. You may use the following data to test your program. The time quantum for round robin is 4 ms and the context switching time is zero.

Arrival time CPU cycle(in ms)0 63 25 19 710 512 314 416 517 719 2

Table 110. Using your program1, change the context switching time to 0.4 ms. Compare outputs from both

runs and print which is a better policy.11. Using the information give in table 2 and table 3 to complete the following program

Job listJob stream number Time Job Size1 5 57602 4 41903 8 32904 2 20305 2 25506 6 69907 8 8940

Page 78: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

8 10 7409 7 393010 6 689011 5 658012 8 382013 9 914014 10 42015 10 22016 7 754017 3 321018 1 138019 9 985020 3 361021 7 754022 2 271023 8 839024 5 595025 10 760

Table2

Memory listMemory Block Size1 95002 70003 45004 85005 30006 90007 10008 55009 150010 500

Table 3At one large batch- processing computer installation the management wants to decide what storage placement strategy will yield the best possible performance. The installation runs a large real storage computer under fixed partition multiprogramming. Each user program runs in a single group of contiguous storage locations. Users state their storage requirements and time units for CPU usage on their job control card. The operating system allocates to each user the appropriate partition and starts up the user’s jobs. The jobs remain in memory until completion. A total of 50,000 memory locations are available, divided into block as indicated in the table above.

c. Write a event driven simulation to help you decide which storage placement strategy should be used at this installation. Your program would use the job stream and memory partitioning as indicate previously. Rum the program until all jobs have been executed with the memory as is (in order by address). This will give you the first fit type performance results.

d. Sort the memory partitions by size and run the program a second time; this will give the best fit performance results. For both parts a. and b. you are investigating the performance of the system using a typical job stream by measuring:

(vi) throughput ( how many jobs are processed per given time unit)(vii) storage utilization (percentage of partitions never used, percentage of partitions heavily used,

etc)(viii) waiting queue length(ix) waiting time in queue(x) internal fragmentation

Page 79: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

12. Suppose your system (as explained in program 3) now has a “ spooler” (storage area in which to temporarily hold jobs) and the job scheduler can choose which will be served from among 25 resident jobs. Suppose also that the FCFS policy is replaced with SJF policy. This would require that a sort by time be performed on the job list before running the program. Dose this make a difference in the results. The program should be run twice to test this new policy with both best fit and first fit.

13. Suppose your “spooler” (as describe in program 4) replace the previous policy with one of “Smallest Job First Served”. This should require that a sort by job size be performed on the job list before running the program. The program should be run twice to test this new policy with both best fit and first fit. Print the result.

14. The following sequence of requests for program words is taken from a 460 word program: 10,11,104,170,73,309,185,245,246,434,458,364. Main memory can hold a total of 200words for this program and the page frame size will match the size of the pages into which the program has been divided. Calculate the page number according to the page size; divide by the page size, and the quotient gives the page number. The number of page frames in memory is the total number, 200, divided by the page size.

e. Find the success frequency for the request list using FIFO replacement algorithm and a page size of 100 words. (There are two page frames).

f. Find the success frequency for the request list using a FIFO replacement algorithm and a page size of 20 words. (10 pages. 0 through 9)

g. Find the success frequency for the request list using FIFO replacement algorithm and a page size of 200 words.

h. Repeat a. through c. above, using a main memory of 400 words. The size of each page frame will again correspond to the size of the page.Optional Questions

15. Given the following information for an assembly language program:Job size = 3126 bytesPage size = 1042 bytesInstruction at memory location 532: LOAD 1, 2098Instruction at memory location 1156: ADD 1, 2087Instruction at memory location 2086: SUB 1, 1052Data at memory location 1052: 015672Data at memory location 2098: 114321Data at memory location 2087: 077435

a. Find the number of pages needed to store the entire job?b. Compute the page number and displacement for each of the byte addresses where the

data is stored.c. Determine whether the page number and displacements legal for this job.

16. writ a program that will simulate the FCFS, SSTF, LOOK, and C-LOOK seek optimization strategies. Assume that:

e. The disk’s outer track is the 0 track and the disk contains 200 tracks per surface.Each track holds 8 sectors numbered 0 through 7.f. A seek takes 10+0.1* T ms, where T is the number of tracks of motion from one request to the

next, and 10 is movement time constant.g. One full rotation takes 8 ms.h. Transfer time is 1ms.Use the data in table 4 to test your program.For comparison purposes, compute the average, variance, standard deviation of time required to accommodate all request under each of the strategies. Consolidate your result into a table.

Table 4

Arrival Time Track requested Sector requested0 45 0

Page 80: d.bitmesra.ac.in€¦  · Web viewSEMESTER I. CS1302. FUNDAMENTALS OF . UNIX & C PROGRAMMING. LAB ASSIGNMENT. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA [Pro

23 132 625 20 229 23 135 198 745 170 557 180 383 78 488 73 595 150 7