bsit 4p

6
BSIT 4P B.Sc.(IT) 4 th Semester Practical Question Paper Set (Give any one set to each student randomly) Set- 1 1. Write a program to print “ Welcome to Java Programming” on the screen 2. Using a case statement, write a shell program to read a command (eg., who, cal, ls, ps) from the user and execute it. Set- 2 1. Using awk, sum the file sizes in your working directory and print the results. 2. Write a program to check whether the given two numbers are equal. If not then find the greater of the given two numbers. Set- 3 1. Using switch and case statements write a program to add, subtract , multiply and divide the two numbers 2. Write a shell program that adds the integers 1 to 100 and displays the result with a suitable message. Set- 4 1. Write a shell program to test for arguments arg1, arg2 and arg3. If they are not present, prompt the user for them. 2. Using for loop write a program to print the table of a given number on the screen. Set- 5 1. Write a program to find the even sum and the odd sum in the given array 2. Write a background command to edit all the files in the directory replacing the word while with until. Set- 6 1. Write a program to print all the prime numbers between n and m. 2. Write a shell program using if-the-else to test whether a variable name is a directory or a file.

Upload: kiran-naik

Post on 02-Dec-2014

238 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: BSIT 4P

BSIT 4P B.Sc.(IT) 4th Semester

Practical Question Paper Set (Give any one set to each student randomly)

Set- 1

1. Write a program to print “ Welcome to Java Programming” on the screen

2. Using a case statement, write a shell program to read a command (eg., who, cal, ls, ps) from the

user and execute it.

Set- 2

1. Using awk, sum the file sizes in your working directory and print the results.

2. Write a program to check whether the given two numbers are equal. If not then find the greater of the given two numbers.

Set- 3

1. Using switch and case statements write a program to add, subtract , multiply and divide the two numbers

2. Write a shell program that adds the integers 1 to 100 and displays the result with a suitable message.

Set- 4

1. Write a shell program to test for arguments arg1, arg2 and arg3. If they are not present, prompt the user for them.

2. Using for loop write a program to print the table of a given number on the screen.

Set- 5

1. Write a program to find the even sum and the odd sum in the given array

2. Write a background command to edit all the files in the directory replacing the word while with until.

Set- 6

1. Write a program to print all the prime numbers between n and m.

2. Write a shell program using if-the-else to test whether a variable name is a directory or a file.

Set- 7

1. Write a program to add the two matrices.

2. Write a shell program to translate the /etc/passwd file into uppercase and translate the “:” delimiter into tab characters.

Page 2: BSIT 4P

Set- 8

1. Write a class circle which consists of functions getdata() and area(), and also write a main

program to create a circle object and to find the area by calling the function area () in circle class

and display the result on the screen.

2. Write a shell program to extract and sort all the users in the file system. Use the /etc/passwd file as input.

Set- 9

1. Write a class Box with the variable width, depth and height and constructor to assigning the

values for these variables and a method to find the volume of the box and also write the main

program, which creates the box object, and find the volume of the box. Print the result on the

screen

2. Write an interactive shell using I/O redirection to accept input from file1, put stdout in file2 and stderr in file3.

Set- 10

1. Write a program to demonstrate the method overloading for sum ( ) function.

2. The ls command with the –R option lists the files in the specified directory and also subdirectories, if any. Use this with a suitable pip-and-filter arrangement to determine whether a file exists in the account logged in.

Set- 11

1. Write a program to demonstrate the overriding of constructor methods for the program no. 9.

2. Put a long-running process in the background and check the accuracy of the sleep command.

Set- 12

1. Write a program to concatenate two strings

2. For a directory myfolder in your working directory, do the following:

a) allow everyone to list files in myfolder. No other privileges are to be changed.b) allow the owner to and group members to list, remove or add files. All privileges are to be removed from everyone else.c) give write privileges to everyone except the ownerd) allow the owner and group members to execute myfolder. Only the owner gets read or write permission.

Page 3: BSIT 4P

Set- 13

1. Write a program to find whether a given string is a palindrome or not

2. For a file named myfile in the working directory, do the following:

a) give everyone permission to read myfile. No other privilege is to be changedb) allow the owner and group members to read and write the file. All privileges are to be removed for everyone else.c) remove write privileges from everyone except the ownerd) allow the owner and group members to execute myfile and give only the owner permission to read or write to it.

Set- 14

1. Write a program to change the case of the given string

2. Assuming you have a directory containing the following files: sprite, cola, choco, orange, book, lemon, lotus, apple use the ls command to list only those files that a) consist of four letters b) begin with the letter c c) end with the letter e d) have the second letter o

Set- 15

1. Write a program to create a thread by extending the thread class

2. For a file named myfile in the working directory, do the following:

a) give everyone permission to read myfile. No other privilege is to be changedb) allow the owner and group members to read and write the file. All privileges are to be removed for everyone else.c) remove write privileges from everyone except the ownerd) allow the owner and group members to execute myfile and give only the owner permission to read or write to it.

Set- 16

1. Use the echo command to display the line UNIX is fun to learn

Redirect the displayed line to a file. Append the outputs of the commands to show the users logged into your system, your login account and the current date in the dd-mm-yyyy format to the file.

2. Using for loop write a program to print the table of a given number on the screen.