Sie sind auf Seite 1von 6

ANNA UNIVERSITY: CHENNAI 600025 M.C.A.

. DEGREE EXAMINATIONS MAY/JUNE - 2012 Second Semester MC9228 System Software Laboratory ( REGULATIONS 2009 )

Time: 3 Hrs. 1. a.

Maximum Marks: 100 40

Write Script to find out biggest number from given three numbers. The numbers are supplied as command line argument. Print error if sufficient arguments are not supplied.

b.

Write a C program that reads an ASCII decimal number from standard input. 60 The input is assumed to be a valid integer number in the range of 65-90 (corresponding to the ASCII codes of the characters 'A'-'Z'). For each input number, your program does the following processing: 1. writes its process ID enclosed in square brackets, followed by a colon and the input number to standard output. 2. then writes the corresponding character to a pipe 3. Continues to read numbers from standard input until end of file is reached. 4.The pipe is read by a child process, which writes its process ID enclosed in square brackets, followed by a colon and the character received from the parent to standard output.

2.

a. b.

Write script to print nos as 5,4,3,2,1 using while loop. Write a C program that reads an ASCII character from standard input. The input is assumed to be a valid character A Z, a z; For each input, your program does the following processing: 1. writes its process ID enclosed in square brackets, followed by a colon and the input character to standard output. 2. then writes the corresponding ASCII decimal number to a pipe 3. Continues to read characters from standard input until end of file is reached. 4. The pipe is read by a child process, which writes its process ID enclosed in square brackets, followed by a colon and the decimal equivalent of the character received from the parent to standard output.

40 60

3.

a. b.

Write Script, using case statement to perform addition and subtraction Write a C program that reads an integer in character form from standard input. The input is assumed to be a valid character 0 9; For each input, your program does the following processing: i. writes its process ID enclosed in square brackets, followed by a colon and the input character to standard output. ii. iii. iv. then writes the corresponding input to a pipe Continues to read characters from standard input until end of file is reached. The pipe is read by a child process, which writes its process ID enclosed in square brackets, followed by a colon and converts the sequence of characters as a decimal integer received from the parent and writes to standard output.

40 60

4.

a.

Script, using case statement to perform multiplication and division

40

b.

Implement a round robin process-scheduling algorithm with CPU time quanta 2 for each process and estimate the average waiting time and turn around time of the processes

60

5.

a.

Write script to print given number in reverse order. For example, if the input is 123 it must print as 321 Implement a priority process-scheduling algorithm and estimate the average waiting time and turn around time of the processes

40

b.

60

6.

a.

Write a shell program that gives only the date in a banner display. Be careful not to give your program the same name as a UNIX system command. Implement a Shortest Job first process-scheduling algorithm with CPU time quanta 2 for each process and estimate the average waiting time and turn around time of the processes

40

b.

60

7.

a.

Write script to print given numbers sum of all digit, For eg. If no is 123 it's sum of all digit will be 1+2+3 = 6

40

b.

Implement a first come first served, process-scheduling algorithm with CPU time quanta 2 for each process and estimate the average waiting time and turn around time of the processes

60

8.

a.

Write script to determine whether given file exist or not, file name is supplied as command line argument, also check for sufficient number of command line argument

40

b.

Write a program in C that reads a file Input.txt. The input contains 60 strings of the following format +LDT #48 +LDA #L1 LDA #11 LDX @L3 Write a function called GENERATEOBJ, that takes a string in the above format as the first argument, followed by atmost 2 arguments and produce the object code following proper instruction format. Write the object code to a file Output.txt. The following is provided in main() int main() { struct optab[ ] = {{LDT, 0x74} , { LDX, 0x04 }, {LDA, 0x00} }; struct symtab[ ] = { {L1, 0x1000}, {L2, 0x1006}, {L3, 0x1003} }; // open your input file and read Call GENERATE OBJ return 0; }

9.

a.

Make a list of files in your home directory that were changed less than 10 40 hours ago, using Grep, but ignore the directories.

b.

Write a C program that performs edit, cut operations of a text editor

60

10. a.

Using Grep, find and list the 1-syllable words, where the input is a 40 sentence given in command line

b.

Write a C program that performs edit and save operations of a text editor

60

11. a.

Using Grep, determine a count of and print the list of words having 40 Uppercase letters when the input sentence is given in command line.

b.

Explain with a program the use of signals in inter process communication.

60

12. a.

Using Grep, determine a count of and print the list of words having 40 Lowercase letters when the input sentence is given in command line

b.

Write a C program that links two object files into one object file and make 60 it ready for loading at address 1000

13. a.

Using Grep, determine a count of and print the list of words having 40 Mixedcase letters when the input sentence is given in command line.

b.

Write a C program that reads from standard input a number in seconds. 60 The input is assumed to be a valid character number; For each input, your i. program does the following processing: writes its process ID enclosed in square brackets, followed by a colon and the input character to standard output. ii. iii. iv. then writes the corresponding input to a pipe Continues to read characters from standard input until end of file is reached. The pipe is read by a child process, which writes its process ID enclosed in square brackets, followed by a colon and converts the time in seconds to time in hours, minutes and seconds, received from the parent and writes to standard output.

14. a.

Using Grep, determine and count the number words that starts with a 40 k/K and has atleast one vowel in it Write a C program that reads from standard input a number in days. The input is assumed to be a valid character number; For each input, your program does the following processing: i. ii. iii. iv. writes its process ID enclosed in square brackets, followed by a colon and the input character to standard output. then writes the corresponding input to a pipe Continues to read characters from standard input until end of file is reached. The pipe is read by a child process, which writes its process ID enclosed in square brackets, followed by a colon and converts the days to the representation year, months and days and writes to standard output. 60

b.

15. a.

Write a script which displays Good morning, Good afternoon or Good evening, on the monitor, depending on the time of running the script.

50

b.

Explain the use of more and pipe commands in unix by means of a simple program

50

16. a.

Write a script that displays and print the number of files with a .sh extension and having the while construct

50

b.

Explain the use of FIFOs by means of a simple program.

50

17. a.

Displays and print the lines containing words starting with L, of length five and containing at least 2 vowels

40

b.

Setup a two-way pipe between parent and child processes in a C program. i.e. both can send and receive signals. Demonstrate this communication by transmitting alphabets between the processes

60

18. a.

Write a simple shell script that takes any number of arguments on the command line, and prints the arguments with Hello in front.

50

b.

Demonstrate the use of execl() and wait() functions in interprocess communication by means of a program

50

19. a.

Write a shell script that takes two arguments, and add them together if both are even and subtracts them if both are odd

50

b.

Use popen() to pipe the rwho (UNIX command) output into more (UNIX command) in a C program.

50

20. a.

Write a shell script that takes two arguments and multiply them together if both are divisible by 3 and divide them otherwise.

50

b.

List and demonstrate the variations of the ls command in UNIX (atleast 5)

50

Das könnte Ihnen auch gefallen