bsit4

4
BSIT 4P B.Sc.(IT)4 th Semester Assignment Questions Subject :UNIX & Shell Programming And JAVA Programming (Answer any 7 of your choice) Set -1 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. Write a program to print “ Welcome to Java Programming” on the screen Set -2 1. 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

Upload: warrior432

Post on 13-Nov-2014

33 views

Category:

Documents


0 download

DESCRIPTION

assignment questions

TRANSCRIPT

Page 1: BSIT4

BSIT 4PB.Sc.(IT)4th Semester

Assignment Questions Subject :UNIX & Shell Programming And JAVA Programming

(Answer any 7 of your choice)

Set -1

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. Write a program to print “ Welcome to Java Programming” on the screen

Set -2

1. 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

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. 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 changed

Page 2: BSIT4

b) 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 owner

d) allow the owner and group members to execute myfile and give only the owner

permission to read or write to it.

2. Using switch and case statements write a program to add, subtract , multiply and divide

the two numbers

Set -4

1. 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 owner

d) allow the owner and group members to execute myfolder. Only the owner gets

read or write permission.

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

Set -5

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

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

Set -6

1. 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.

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

Set -7

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

2. Write a program to add the two matrices.

Page 3: BSIT4

Set -8

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

2. 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.

Set -9

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

2. Write a program to demonstrate the method overloading for sum ( ) function.Set -10

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

2. Write a program to concatenate two strings Set -11

1. Write a shell program in which an infinite loop prompts a user for file names to be removed and remove the files. Use trap to exit when finished.

2. Write a program to find whether a given string is a palindrome or notSet -12

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

2. Write a program to change the case of the given stringSet -13

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

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