ge2155-2012 question papers for the lab exams up to 2012

30
ANNA UNIVERSITY: CHENNAI – 600 025 B.E./B.Tech. DEGREE EXAMINATIONS, MAY/JUNE - 2012 Regulations - 2008 Second Semester (Common to All Branches) GE2155: COMPUTER PRACTICE LABORATORY II Time: 3 Hours Maximum Marks: 100 1. a. Execute the following using UNIX Commands: i. To print the present working directory 5 ii. To create a directory 5 iii. To change the directory 5 iv. To copy files 5 b. Write a shell program to find the sum and average of four integers 20 c. Write a ‘C’ program to perform matrix addition. 50 d. Viva- Voce 10 2. a. Execute the following using UNIX Commands: i. To copy files 5 ii. To concatenate two files 5 iii. To change the permission of the file 5 iv. To find out who's logged in 5 b. Write a shell program to compute simple interest and compound interest. 20 c. Write a ‘C’ program to perform matrix multiplication. 50 d. Viva- Voce 10 3. a. Execute the following using UNIX Commands: i. To print the present working directory 5 ii. To create a directory 5 iii. To change the permission of the file 5 iv. To find out who's logged in 5 b. Write a shell program to swap two numbers 20 c. Write a ‘C’ program to compute the transpose of a matrix 50 d. Viva- Voce 10

Upload: kishore-vignesh

Post on 03-Jan-2016

35 views

Category:

Documents


1 download

DESCRIPTION

its for anna university Be 2 sem students .

TRANSCRIPT

ANNA UNIVERSITY: CHENNAI – 600 025 B.E./B.Tech. DEGREE EXAMINATIONS, MAY/JUNE - 2012

Regulations - 2008

Second Semester (Common to All Branches)

GE2155: COMPUTER PRACTICE LABORATORY II

Time: 3 Hours Maximum Marks: 100

1. a. Execute the following using UNIX Commands:

i. To print the present working directory 5

ii. To create a directory 5

iii. To change the directory 5

iv. To copy files 5

b. Write a shell program to find the sum and average of four integers 20

c. Write a ‘C’ program to perform matrix addition. 50

d. Viva- Voce 10

2. a. Execute the following using UNIX Commands:

i. To copy files 5

ii. To concatenate two files 5

iii. To change the permission of the file 5

iv. To find out who's logged in 5

b. Write a shell program to compute simple interest and compound interest. 20

c. Write a ‘C’ program to perform matrix multiplication. 50

d. Viva- Voce 10

3. a. Execute the following using UNIX Commands:

i. To print the present working directory 5

ii. To create a directory 5

iii. To change the permission of the file 5

iv. To find out who's logged in 5

b. Write a shell program to swap two numbers 20

c. Write a ‘C’ program to compute the transpose of a matrix 50

d. Viva- Voce 10

4. a. Execute the following using UNIX Commands:

i. To view one page of the file 5

ii. To view first 10 lines of the file 5

iii. To view last 10 lines of the file 5

iv. To view the commands which was executed 5

b. Write a shell program to compute the power of x. 20

c. Write a ‘C’ program to find the greatest of ‘N’ numbers using arrays 50

d. Viva-Voce 10

5. a. Execute the following using UNIX Commands:

i. To create a directory 5

ii. To change the directory 5

iii. To change the permission of the file 5

iv. To clear the screen 5

b. Write a shell program to check whether a given year is leap year or not. 20

c. Write a ‘C’ program to sort ‘N’ numbers. Use pointers. 50

d. Viva-Voce 10

6. a. Execute the following using UNIX Commands:

i. List all filenames which has dot at the end 5

ii. List all filenames which has an extension 5

iii. Find the subdirectories available in the present working directory 5

iv. Display all files, sub directories and files in subdirectories including their sizes

5

b. Write a shell program to find whether the given number is odd or even 20

c. Write a ‘C’ program to perform matrix addition 50

d. Viva-Voce 10

7. a. Execute the following using UNIX Commands:

i. To print the calendar 5

ii. To print the date and time 5

iii. To change the password 5

iv. To print presently who is using the system 5

b. Write a shell program to check whether the given number is positive or negative.

20

c. Write a ‘C’ program using pointers to read in an array of integers and print its elements in reverse order

50

d. Viva- Voce 10

8. a. Execute the following using UNIX Commands:

i. To append the contents of one file into another 5

ii. To link files 5

iii. To change the password 5

iv. To display the file attributes 5

b. Write a shell program to find the quotient and remainder of two numbers 20

c. Develop a ‘C’ function that will scan a character string passed as an argument and convert all lower-case characters to their upper-case equivalents.

20

d. Viva- Voce 10

9. a. Execute the following using UNIX Commands:

i. To print the calendar 5

ii. To print the date and time 5

iii. To append more than one file 5

iv. To link files 5

b. Write a shell program to check whether a number is divisible by 5 20

c. Develop a ‘C’ program to copy the contents of one file into another 50

d. Viva- Voce 10

10. a. Execute the following using UNIX Commands:

i. To print the present working directory 5

ii. To print the calendar 5

iii. To append more than one file 5

iv. To display the file attributes 5

b. Write a shell program to check whether the given number is a prime number or not.

20

c. Develop a ‘C’ program to print the number of vowels in a given paragraph 50

d. Viva- Voce 10

11. a. Execute the following using UNIX Commands:

i. To list files and directories, recursively on a single line 5

ii. To view the files page by page 5

iii. To move the files 5

iv. To change the permission of the file 5

b. Write a shell program to find the GCD of numbers. 20

c. Write a ‘C’ program to sort ‘N’ numbers. Use functions 50

d. Viva- Voce 10

12. a. Execute the following using UNIX Commands:

i. To create a directory 5

ii. To print the present working directory 5

iii. To list files and directories, recursively on a single line 5

iv. To remove an empty directory 5

b. Write a shell program to find the factorial of a number 20

c. Write a ‘C’ program to sort ‘N’ names alphabetically. Use pointers. 50

d. Viva- Voce 10

13. a. Execute the following using UNIX Commands:

i. To find out who's logged in 5

ii. To print the calendar 5

iii. To print the date and time 5

iv. To change the password 5

b. Write a shell program to reverse the digits of a number 20

c. Write a ‘C’ program to sort ‘N’ names alphabetically. Use functions 50

d. Viva- Voce 10

14. a. Execute the following using UNIX Commands:

i. Print the calendar for 2012 for the month July 5

ii. Store the output of date command in a file called date. out 5

iii. Sort the files in alphabetical order 5

iv. Display the file attributes 5

b. Write a shell program to find the sum of the digits of a given number 20

c. Develop a ‘C’ program to find the transpose of a given matrix. Use function 50

d. Viva- Voce 10

15. a. Execute the following using UNIX Commands:

i. Show manual for a command 5

ii. Change the file to read only mode 5

iii. Sort the files in alphabetical order 5

iv. To concatenate two files 5

b. Write a shell program to find the greatest among three numbers 20

c. Develop a ‘C’ program to compute the roots of a quadratic equation. 50

d. Viva- Voce 10

16. a. Execute the following using UNIX Commands:

i. To print the present working directory 5

ii. To create a directory 5

iii. To list files and directories, recursively on a single line 5

iv. To find out who's logged in 5

b. Write a shell program to print the first ‘N’ even numbers. 20

c. Develop a ‘C’ function that will scan a character string passed as an argument and convert all lower-case characters to their upper-case equivalents.

50

d. Viva- Voce 10

17. a. Execute the following using UNIX Commands:

i. Copy the directory and its file to the other directory 5

ii. Change the mode of the file, where the changed file should posses all the permission

5

iii. To print the calendar 5

iv. To print the date and time 5

b. Write a shell program to print the first ‘N’ odd numbers. 20

c. Develop a ‘C’ program to copy the contents of one file into another 50

d. Viva- Voce 10

18. a. Execute the following using UNIX Commands:

i. To append more than one file 5

ii. To link files 5

iii. Sort the files in alphabetical order 5

iv. To concatenate two files 5

b. Write a shell program to print the first ‘N’ prime numbers. 20

19. a. Execute the following using UNIX Commands:

i. List all filenames which has dot at the end 5

ii. List all filenames which has an extension 5

iii. Store the output of date command in a file called date. out 5

iv. Sort the files in alphabetical order 5

b. Write a shell program to print the first ‘N’ numbers divisible by 4. 20

c. Write a ‘C’ program to perform matrix addition. Use functions. 50

d. Viva- Voce 10

20. a. Execute the following using UNIX Commands:

i. Copy the directory and its file to the other directory 5

ii. Change the mode of the file, where the changed file should posses all the

permission

5

iii. List all files in current directory whose second character is a digit 5

iv. Print today’s date and the calendar of the current month using single

command

5

b. Write a shell program to print the factorial of first ‘N’ numbers 20

c. Write a ‘C’ program to perform matrix multiplication. 50

d. Viva- Voce 10

********

ANNA UNIVERSITY: CHENNAI – 600 025 B.E./B.Tech. DEGREE EXAMINATIONS, MAY /JUNE- 2012

Regulations - 2008

Second Semester

(Common to All Branches)

GE2155 – COMPUTER PRACTICE LABORATORY –II

Time: 3 Hours Maximum Marks: 100

1. a. Write and execute the following UNIX commands

i. Create a file named GE2155 ii. Display only the first two characters of all the lines from a file. iii. Convert the all the characters from lower case to uppercase iv. Display your user name v. Display the calendar

(20)

b. Write a Shell program to execute various UNIX commands using case statements

(20)

c. Write an interactive shell script that asks for a word and file name and then tells how many times that word occurred in the file.

(20)

d. Write a C program that uses pointers to compute the sum of all elements stored in an array.

(40)

2. a. Write and execute the following UNIX commands i. Create two files with the name of name.txt, which contain only

names and reg.txt with the content of register number respectively ii. Combine the two files in the form of register number followed by

name iii. Sort the two files in ascending order iv. Count the number of lines in the files v. Rename the two files

(30)

b. Write a Shell program to count the number of vowels in a line of text (30)

c. Given the number of elements and size of elements, write a C program to allocate memory using functions( Hint: Using malloc())

(40)

3. a. Write and execute the following UNIX commands i. To view only the files in a directory

ii. Display the working directory iii. Execute more than one command at a time. iv. Demonstrate the pipe command v. Count the number of words in the file

(20)

b. Write a Shell program to find the sum of odd digits and even digits from a number

(40)

c. Create a file test2.txt and write a C program to perform the read and write operation in to the file.

(40)

admin
Highlight
admin
Highlight

4. a. Write and execute the following UNIX commands

i. To remove the directory with files. ii. Execute more than one command at a time iii. Display the user-id/Group-id iv. Convert all the content in a file into uppercase v. Concatenate the contents of 2 files

(30)

b. Write a Shell program to find the smallest and largest number from a set of numbers. (30)

c. Write a C program that prints the address of a variable along with its value (40)

5, a. Write and execute the following UNIX commands

i. Demonstrate the pipe command ii. Demonstrate tee command iii. Display all files, subdirectories and files in sub directories including

their sizes. iv. Create a file called create.txt v. Move the file create.txt to move.txt

(30)

b. Write a Shell program to find the largest among 3 numbers (30)

c. Write a C program to swap the values stored in two locations in the memory (40)

6. a. Write and execute the following UNIX commands

i. Create a directory Exam and a file file1.txt inside it ii. Display the file attributes iii. Display the today date and store it in a file called date.out iv. Print the calendar for the month of April 2012 v. View the file created

(20)

b. Write a Shell program to check the given number and its reverse are same (40)

c. Create two files test1.txt and test2.txt and write a C program to read the file text1.txt character by character on the screen and paste it at the end of test2.txt

(40)

7. a. Write and execute the following UNIX commands

i. Extract the last ten lines and display them ii. Display the file content size

iii. Display the file with the line number iv. Count the number of words and lines in the file

(30)

b. Write a Shell program to find the factorial of a number using for loop. (40)

c. Write a C program using user defined function to sort the numbers in descending order

(30)

admin
Highlight
admin
Highlight
admin
Highlight

8. a. Write and execute the following UNIX commands

i. Print today date and the calendar of the current month using single command

ii. Create a sub-directory with your name in the Home directory iii. Create a file in the Home directory iv. Copy the file to the sub directory v. Using pipe command sort the files in alphabetical order and store it in

file1.dat

(30)

b. Write a Shell program to generate Fibonacci series. (40)

c. Write a C program to merge two files in to third file. The names of the files must be entered using the command line arguments.

(30)

9. a. Write and execute the following UNIX commands

i. Display the calendar of the current month ii. Display today’s date and time

iii. Display the present working directory iv. Display your login username and access privilege v. Try to login as root

vi. Create a file using cat command

(20)

b. Write a Shell program to check the given number is even or odd. (40)

c. Write a C program to implement the queue data structure using malloc() and do the insert operation

(40)

10. a. Write and execute the following UNIX commands

i. Create a directory named Results ii. View all directories created by the currently logged-in user

iii. Rename the directory Results and hide the directory iv. View all the directories starting with a character “R” v. View only the hidden directories

(30)

b. Write a Shell program to display leap years using command line argument (30)

c. Write a C program to find the position of an element using linear search (40)

11. a. Write and execute the following UNIX commands

i.View only files from a directory ii. List all the files names starting with “f” and of size more than 4K iii. Display the present working directory and check whether there are hidden files in the same iv. Display your login name and access privilege

(20)

b. Write a Shell program to find the area and circumference of a circle (40)

c. Write a C program with function that accepts an integer in between 1-12 to represent the month and displays the corresponding month of the year

(40)

12. a. Write and execute the following UNIX commands

i. Create a directory with the name of Exam

ii. Change the Exam directory as the working directory iii. Create a file called exam.txt in the Exam directory iv. Copy the content of the exam.txt file to another file named exam2.txt v. Rename the file exam.txt to test.txt

(20)

b. Write a Shell program to check the given string is palindrome or not. (40)

c. Write a C program to read marks of 10 students in the range of 0-100. Then make 10 groups: 0-10, 10-20, 20-30, etc. Count the number of values that falls in each group and display the results

(40)

13. a. Write and execute the following UNIX commands

i. Create two directories called GE215 and GE255 ii. Create a file called 1101.txt in the GE215 directory

iii. Give read only permission to the file 1101.txt iv. Try to copy the file 1101.txt from GE215 to GE255 v. Change the access privilege and copy the file 1101.txt to GE255

vi. Remove the directory GE215

(30)

b. Write a Shell program to check the given number is Armstrong number or not (30)

c. Write a C program to read the content of the file and write it to another file (40)

14. a. Write and execute the following UNIX commands i. Create a file file1.txt

ii. Rename a file as file2.txt iii. Change the mode of the file to read only iv. View the content of a file and display the 7th line of the file v. Count the number of words in a file

(20)

b. Write a Shell program to generate prime numbers less than 100 (40)

c. Write a C program that reads the file name and text of 20 words as command line arguments.  Write the text into a file whose name is given as the file name.

(40)

15. a. Write and execute the following UNIX commands i. Create a file test1.txt

ii. Display only the first two characters of all the lines from test1.txt. iii. Covert the lower case characters in the file to uppercase characters iv. Display the lines of file with string “and” v. Display the calendar of the year 2012

(20)

b. Write a Shell program to find the sum of square of individual digits (40)

c. Write a program to copy 4 characters of a character array from the 4th position in another character  array

(40)

16. a. Write and execute the following UNIX commands i. Create a file start.txt

ii. Display the beginning and end of the file iii. Add “;” to the end of the file iv. Delete the 7th line of a file v. Display the content of file

(20)

b. Write a Shell program to find the sum of cube of Individual digits of a given number

(40)

c. Write a C program to find the maximum and minimum number entered in an array using the array and pointer as function arguments

(40)

17. a. Write and execute the following UNIX commands i. Create two file file1.txt and file2.txt

ii. Assign different modes to the files and enter some values to both the files

iii. Compare the files and sort them in the ascending order of values iv. Differentiate the file and list them in command line

(30)

b. Write a Shell program to find the smallest and the largest digits of a number. (30)

c. Write a program using pointer variables to read a character until “;” is entered. If the character is in upper case, print in lower case and vice versa. Also count the number of upper and lower case characters entered

(40)

18. a. Write and execute the following UNIX commands i. Create a file test1.txt and enter the values from 1 to 10

ii. Sort the content of file in ascending order iii. Split the file in to 3 number of files iv. View the content of file

(20)

b. Write a shell script to compute the gross salary of an employee according to the following rules. If BASIC salary is < 1500 then HRA = 10% of the BASIC and DA = 90% of the BASIC. If BASIC salary is >= 1500 then HRA = Rs 500 and DA = 98% of the BASIC

(40)

c. Write a C program to insert and delete an element in array (40)

19. a. Write and execute the following UNIX commands i. Create two files file1.txt and file2.txt

ii. Check the file attributes and size of the files iii. Cut and paste the file content of file 1 to file 2 iv. Check the file sizes of file1.txt and file2.txt v. View the content of file 2.txt

(20)

b. Write a shell script program to find the degree of x in a quadratic equation x4+3x2+1=0

(40)

c. Write a C program to copy one string into another and count the number of characters copied

(40)

20. a. Write and execute the following UNIX commands

i. Create a file file3.txt ii. Enter a string in to the file3.txt

iii. Translate the character “I” in the file to “E” iv. Check the number of occurrence of character “I”.

 

(20)

b. Write a shell script to display the digits which are in odd position in a given number

(40)

c. Write a C program to find the number of characters in a file and also find the frequency of all alphabets in a string

(40)

ANNA UNIVERSITY: CHENNAI – 600 025

B.E./B.Tech. DEGREE EXAMINATIONS, MAY /JUNE - 2012

Regulations - 2008

Second Semester

(Common to All Branches)

GE2155: COMPUTER PRACTICE LABORATORY II

Time: 3 Hours Maximum Marks: 100

1. a. Write and execute the following UNIX commands (i) Create a file. (ii) Display only the first two characters of all the lines from a file. (iii) Convert the lower case to uppercase. (iv) Combine two strings. (v) Display the file contents in descending order.

b. Write a Shell program to check the given number is even or odd c. Write a C program using dynamic memory allocation to sort ‘n’ numbers in ascending order.

2. a. Write and execute the following UNIX commands (i) Create two files with the name of name.txt, which contain only names, and reg.txt with

the content of register number respectively. (ii) Combine the two files in the form of register number followed by name (iii) Sort the two files in ascending order (iv) Count the number of lines in the files (v) Rename the two files.

b. Write a Shell program to check and display 10 leap years c. Write a C program using dynamic memory allocation to sort ‘n’ numbers in descending order.

3. a. Write and execute the following UNIX commands (i) Create two files. (ii) Combine the two files. (iii) Search a specific word from any one of the file. (iv) Search a specific file from a directory. (v) Display the common and distinct line of contents from a file.

b. Write a Shell program to find the area and circumference of a circle. c. Write a C program using dynamic memory allocation to sort ‘n’ names in ascending order.

4. a. Write and execute the following UNIX commands (i) Create two files. (ii) Display the contents of both the files. (iii) Count the number of characters in both the files. (iv) Rename the two files. (v) Combine the two files without duplicate.

b. Write a Shell program to check the given number and its reverse are same. c. Write a C program using dynamic memory allocation to sort ‘n’ names in descending order.

5. a. Write and execute the following UNIX commands (i) To view all the files and directories page by page (ii) To view only the directories page by page. (iii) To view only the files in a directory. (iv) Display the working directory. (v) Display the complete path of the working directory.

b. Write a Shell program to check the given string is palindrome or not. c. Write a C program using dynamic memory allocation to add two matrices.

6. a. Write and execute the following UNIX commands (i) Display the calendar. (ii) Execute more than one command at a time (using semi-colon ;) (iii) Display the user’s full details. (iv) Display the user-id / Group-id. (v) Execute more than one command at a time (using logical-AND &&).

b. Write a Shell program to find the sum of odd and even numbers from a set of numbers. c. Write a C program using dynamic memory allocation to subtract two matrices.

7. a. Write and execute the following UNIX commands (i) Demonstrate pipe command (ii) Demonstrate tee command (iii) Use more than one command at a time (who and date) (iv) Create a file called create.txt (v) Move the file create.txt to move.txt

b. Write a Shell program to find the roots of a quadratic equation c. Write a C program using dynamic memory allocation to transpose a given matrix

8. a. Write and execute the following UNIX commands (i) Create a file (ii) Print the specified number of lines of a file from start to end of the file. (iii) Display the file content with line number (iv) Update the file content with I/O redirection (v) Rename the file

b. Write a Shell program to check the given integer is Armstrong number or not. c. Write a C program using dynamic memory allocation to copy one matrix to another matrix

9. a. Write and execute the following UNIX commands (i) Create a directory (ii) Create a file (iii) Rename the directory (iv) Rename the file (v) View the file

b. Write a Shell program to check the given integer is prime or not c. Write a C program using dynamic memory allocation to perform multiplication of two matrices

10. a. Write and execute the following UNIX commands (i) Create a file (ii) Update the file (iii) Display the file content (iv) Display the file with line number (v) Count the number of words in the file

b. Write a Shell program to generate prime numbers between 1 and 50 c. Write a C program using dynamic memory allocation to find the sum of elements of a matrix

11. a. Write and execute the following UNIX commands (i) Create a Directory called main (ii) Create a sub-directory called sub in the main directory (iii) Create a file in the main directory (iv) Copy the file to the sub directory (v) Delete the file in the main directory

b. Write a Shell program to find the sum of square of individual digits of a number c. Write a C program using dynamic memory allocation to develop a mark sheet of 5 students.

12. a. Write and execute the following UNIX commands (i) Display the calendar (ii) Display the date and time (iii) Display the present working directory (iv) Display your user name (v) Create a file using cat command

b. Write a Shell program to find the sum of cube of individual digits of a number c. Write a C program using dynamic memory allocation to develop salary details of 5 employees

13. a. Write and execute the following UNIX commands

(i) Use finger command (ii) Use grep command (iii) Use diff command (iv) Use uniq command (v) Use cmp command

b. Write a Shell program to execute various UNIX commands using case statements c. Write a C program using dynamic memory allocation to find the minimum and maximum of a

set of numbers.

14. a. Write and execute the following UNIX commands (i) Create a directory (ii) View all directories from a user (iii) Rename a directory (iv) View all the directories starting with a specific character. (v) View only the hidden directories

b. Write a Shell program to count the number of vowels in a line of text c. Write a C program to find the sum of ‘n’ numbers using function.

15. a. Write and execute the following UNIX commands (i) Create a file (ii) View only files from a directory (iii) Rename a file (iv) View all files starting with a specific character (v) View all the files which has a specific extension

b. Write a Shell program to display student grades c. Write a C program using pointers to allocate a memory for the string “University” and reallocate

the memory for the string to “University Examinations”

16. a. Write and execute the following UNIX commands (i) Create a directory with the name of Exam (ii) Change the Exam directory as the working directory (iii) Create a file called exam.txt in the Exam directory (iv) View the content of the exam.txt file (v) Rename the file exam.txt to test.txt

b. Write a Shell program to find the smallest number from a set of numbers c. Write a C program using pointers to combine two array elements without duplicate

17. a. Write and execute the following UNIX commands

(i) To check the working directory (ii) Change the password (iii) To display today’s date (iv) To display the calendar of this month (v) To display a message “University Exam” using a special character

b. Write a Shell program to find the smallest digit from a number c. Write a program to perform file copy operation

18. a. Write and execute the following UNIX commands (i) Create two directories called CS1101 and CS1102 (ii) Create a file called cs1101.txt in the CS1101 directory (iii) Copy the file cs1101.txt from CS1101 to CS1102 (iv) Update the file content of cs1101.txt in the CS1102 directory (v) Rename the file in the CS1102 with cs1102.txt

b. Write a Shell program to find the sum of all numbers between 50 and 100, which are divisible by 3 and not divisible by 5

c. Write a program to create two files and perform merge operation on it

19. a. Write and execute the following UNIX commands (i) Create a file (ii) Rename a file (iii) Change the mode of the file to read only (iv) View the content of a file (v) Count the number of words in a file

b. Write a Shell program to find the sum of digits of a number until a single digit is obtained. c. Write a C program using dynamic memory allocation to copy one matrix to another matrix

20. a. Write and execute the following UNIX commands (i) Count the specific number of lines from a file start from the beginning of the file (ii) To destroy a specific file from a user directory (iii) Send a greeting message to other user (iv) Execute a shell program (v) To display current time

b. Write a Shell program to find the second highest number from a set of numbers c. Write a C program using dynamic memory allocation to develop salary details of 5 employees

Mark Allocation

UNIX Commands - 10 marks Shell Programming* - 40 marks C - Programming* - 40 marks Viva-voce - 10 marks

---------------- Total - 100 marks

----------------

* Shell programming and C programming mark allocation (40 marks)

Algorithm - 10 marks Program - 20 marks Execution - 10 marks

-------------- Total - 40 marks

--------------

ANNA UNIVERSITY: CHENNAI – 600 025

B.E./B.Tech. DEGREE EXAMINATIONS, MAY/JUNE - 2012

Regulations - 2008

Second Semester

(Common to All Branches)

GE2155: COMPUTER PRACTICE LABORATORY II

Time: 3 Hours Maximum Marks: 100 1. a. Write and execute the following UNIX commands

(i) Create a directory (ii) Create a file (iii) Rename the directory (iv) Rename the file (v) View the file

b. Write a Shell program to execute various UNIX commands using case statements c. Write a C program to create a file, which contains register number, name, age etc. and display

the contents of the file.

2. a. Write and execute the following UNIX commands (i) Create a file (ii) Update the file (iii) Display the file contents (iv) Display the file with line number (v) Count the number of words in the file

b. Write a Shell program to count the number of vowels in a line of text c. Write a C program to create a file, which contains employee id, name, age etc and display the

contents

3. a. Write and execute the following UNIX commands (i) Create a Directory called main (ii) Create a sub-directory called sub in the main directory (iii) Create a file in the main directory (iv) Copy the file to the sub directory (v) Delete the file in the main directory

b. Write a Shell program to display student grades c. Write a C program to create a file, which contains two numbers followed by an operator in a line.

Read a line of the file, while reading it; with respect to the operator perform the operation against the numbers.

4. a. Write and execute the following UNIX commands

(i) Display the calendar (ii) Display the date and time (iii) Display the present working directory (iv) Display your user name (v) Create a file using cat command

b. Write a Shell program to find the smallest number from a set of numbers c. Write a program to perform file copy operation.

5. a. Write and execute the following UNIX commands (i) Use finger command (ii) Use grep command (iii) Use diff command (iv) Use uniq command (v) Use cmp command

b. Write a Shell program to find the smallest digit from a number c. Write a program with an append operation on an existing file.

6. a. Write and execute the following UNIX commands (i) Create a directory (ii) View all directories from a user (iii) Rename a directory (iv) View all directories start with a specific character (v) View only the hidden directories

b. Write a Shell program to find the sum of all numbers between 50 and 100, which are divisible by 3 and not divisible by 5

c. Write a program to create two files and perform merge operation on it

7. a. Write and execute the following UNIX commands (i) Create a file (ii) View only files from a directory (iii) Rename a file (iv) View all files starting with a specific character (v) View all the files which has a specific extension

b. Write a Shell program to find the sum of digits of a number until a single digit is obtained. c. Write a C program to find the second largest digit from a number using function.

8. a. Write and execute the following UNIX commands (i) Create a file (ii) Display only the first two characters of all the lines from a file (iii) Convert the lower case to uppercase (iv) Combine two strings (v) Display the file contents in descending order

b. Write a Shell program to find the second highest number from a set of numbers c. Write a C program to find the sum of digits of a number using function.

9. a. Write and execute the following UNIX commands (i) Create two files with the name of name.txt, which contain only names, and reg.txt with

the content of register number respectively. (ii) Combine the two files in the form of register number followed by name (iii) Sort the two files in ascending order (iv) Count the number of lines in the files (v) Rename the two files.

b. Write a Shell program to find the second largest digit from a number c. Using function, write a C program to check whether the given number and its reverse are same

10. a. Write and execute the following UNIX commands (i) Create two files (ii) Combine the two files (iii) Search a specific word from any one of the file (iv) Search a specific file from a directory (v) Display the common and distinct line of content from a file

b. Write a Shell program to find the sum of odd digits and even digits from a number c. Write a C program to find the sum of square of individual digits of a number using function.

11. a. Write and execute the following UNIX commands (i) Create two files (ii) Display the content of both the file (iii) Count the number of characters of both the files (iv) Rename the two files (v) Combine the two file without duplicate

b. Write a Shell program to find the sum of two numbers using function programming c. Write a C program to find the smallest digit from a number using function.

12. a. Write and execute the following UNIX commands (i) To view all the files and directories page by page (ii) To view only the directories page by page (iii) To view only the files from a directory (iv) Display the working directory (v) Display the complete path of the working directory

b. Write a Shell program to find the largest number between two numbers using function. c. Using function, write a C program to check whether the given number and its reverse are same

13. a. Write and execute the following UNIX commands (i) Display the calendar (ii) Execute more than one command at a time (using semi-colon ;) (iii) Display the user’s full detail (iv) Display the user-id / Group-id (v) Execute more than one command at a time (using logical-AND &&)

b. Write a Shell program to find the largest among three numbers c. Write a C program using dynamic memory allocation to perform binary search operation

14. a. Write and execute the following UNIX commands (i) Demonstrate pipe command (ii) Demonstrate tee command (iii) Use more than one command at a time (who and date) (iv) Create a file called create.txt (v) Move the file create.txt to move.txt

b. Write a Shell program to find the largest among ‘n’ different numbers c. Write a C program using dynamic memory allocation to perform linear search operation

15. a. Write and execute the following UNIX commands (i) Create a file (ii) Print the specified number of lines of a file start from end of file (iii) Display the file content with line number (iv) Update the file content with I/O redirection (v) Rename the file

b. Write a Shell program to find the largest digit of a number c. Write a C program to create a file, which contains employee id, name, age etc and display the

content

16. a. Write and execute the following UNIX commands (i) Create a directory with the name of Exam (ii) Change the Exam directory as the working directory (iii) Create a file called exam.txt in the Exam directory (iv) View the content of the exam.txt file (v) Rename the file exam.txt to test.txt

b. Write a Shell program to find the sum of ‘n’ different numbers. c. Write a program with an append operation on an existing file.

17. a. Write and execute the following UNIX commands (i) To check the working directory (ii) Change the password (iii) To display today’s date (iv) To display the calendar of this month (v) To display a message “University Exam” using a special character

b. Write a Shell program to find the sum of digits of a number c. Write a C program using pointers to swap two numbers

18. a. Write and execute the following UNIX commands (i) Create two directories called CS1101 and CS1102 (ii) Create a file called cs1101.txt in the CS1101 directory (iii) Copy the file cs1101.txt from CS1101 to CS1102 (iv) Update the file content of cs1101.txt in the CS1102 directory (v) Rename the file in the CS1102 with cs1102.txt

b. Write a Shell program to print the reverse of a number c. Write a C program using pointers to copy the content of one array to another

19. a. Write and execute the following UNIX commands (i) Create a file (ii) Rename a file (iii) Change the mode of the file to read only (iv) View the content of a file (v) Count the number of words in a file

b. Write a Shell program to find the factorial of a number using for loop c. Write a C program to create a file, which contains two numbers followed by an operator in a line.

Read a line of the file, while reading it; with respect to the operator perform the operation against the numbers.

20. a. Write and execute the following UNIX commands (i) Count the specific number of lines from a file start from the beginning of the file (ii) To destroy a specific file from a user directory (iii) Send a greeting message to other user (iv) Execute a shell program (v) To display current’s time

b. Write a Shell program to generate Fibonacci series c. Write a C program to create a file, which contains register number, name, age etc. and display

the content of the file.

Mark Allocation

UNIX Commands - 10 marks Shell Programming* - 40 marks C - Programming* - 40 marks Viva-voce - 10 marks

---------------- Total - 100 marks

----------------

* Shell programming and C programming mark allocation (40 marks)

Algorithm - 10 marks Program - 20 marks Execution - 10 marks

-------------- Total - 40 marks

--------------

ANNA UNIVERSITY: CHENNAI – 600 025 B.E./B.Tech. DEGREE EXAMINATIONS, MAY/JUNE - 2012

Regulations - 2008

Second Semester (Common to All Branches)

GE2155: COMPUTER PRACTICE LABORATORY II

Time: 3 Hours Maximum Marks: 100

1. a. Write and execute the following UNIX commands (i) Create a directory (ii) View all directories of a user (iii) Rename a directory (iv) View all directories starting with a specific character (v) View only the hidden directories

b. Write a Shell program to find the largest among three numbers c. Write a C program using dynamic memory allocation to perform linear search operation

2. a. Write and execute the following UNIX commands (i) Create a file (ii) View only files from a directory (iii) Rename a file (iv) View all files starting with a specific character (v) View all the files which has a specific extension

b. Write a Shell program to find the largest among ‘n’ different numbers c. Write a C program using dynamic memory allocation to perform binary search operation

3. a. Write and execute the following UNIX commands (i) Create a directory with the name of Exam (ii) Change the Exam directory as the working directory (iii) Create a file called exam.txt in the Exam directory (iv) View the content of the exam.txt file (v) Rename the file exam.txt to test.txt

b. Write a Shell program to find the largest digit of a number c. Write a C program using dynamic memory allocation to sort ‘n’ numbers in ascending order.

4. a. Write and execute the following UNIX commands (i) To check the working directory (ii) Change the password (iii) To display today’s date (iv) To display the calendar of this month (v) To display a message “University Exam” using a special character

b. Write a Shell program to find the sum of ‘n’ different numbers c. Write a C program using dynamic memory allocation to sort ‘n’ numbers in descending order

5. a. Write and execute the following UNIX commands (i) Create two directories called CS1101 and CS1102 (ii) Create a file called cs1101.txt in the CS1101 directory (iii) Copy the file cs1101.txt from CS1101 to CS1102 (iv) Update the file content of cs1101.txt in the CS1102 directory (v) Rename the file in the CS1102 with cs1102.txt

b. Write a Shell program to find the sum of digits of a number c. Write a C program using dynamic memory allocation to sort ‘n’ names in ascending order

6. a. Write and execute the following UNIX commands

(i) Create a file (ii) Rename a file (iii) Change the mode of the file to read only (iv) View the content of a file (v) Count the number of words in a file

b. Write a Shell program to print the reverse of a number c. Write a C program using dynamic memory allocation to sort ‘n’ names in descending order.

7. a. Write and execute the following UNIX commands

(i) Count the specific number of lines in a file from the beginning of the file (ii) To destroy a specific file from a user directory (iii) Send a greeting message to other user (iv) Execute a shell program (v) To display current’s time

b. Write a Shell program to find the factorial of a number using for loop c. Write a C program using dynamic memory allocation to perform addition of two matrices

8. a. Write and execute the following UNIX commands (i) Create a file (ii) Display only the first two character of all the lines from a file (iii) Convert the lower case to uppercase (iv) Combine two string (v) Display the file content in descending order

b. Write a Shell program to generate Fibonacci series c. Write a C program using dynamic memory allocation to subtract two matrices

9. a. Write and execute the following UNIX commands

(i) Create two files with the name of name.txt, which contain only names, and reg.txt with the content of register number respectively.

(ii) Combine the two files in the form of register number followed by name (iii) Sort the two files in ascending order (iv) Count the number of lines in the files (v) Rename the two files.

b. Write a Shell program to check the given number is even or odd c. Write a C program using dynamic memory allocation to perform transpose of a given matrix

10. a. Write and execute the following UNIX commands

(i) Create two files (ii) Combine the two files (iii) Search a specific word from any one of the file (iv) Search a specific file from a directory (v) Display the common and distinct line of content from a file

b. Write a Shell program to check and display 10 leap years c. Write a C program using dynamic memory allocation to copy one matrix to another matrix

11. a. Write and execute the following UNIX commands (i) Create two files (ii) Display the contents of both the files (iii) Count the number of characters in both the files (iv) Rename the two files (v) Combine the two files without duplicate

b. Write a Shell program to find the area and circumference of a circle c. Write a C program using dynamic memory allocation to multiply of two matrices

12. a. Write and execute the following UNIX commands (i) To view all the files and directories with page by page (ii) To view only the directories with page by page (iii) To view only the files from a directory (iv) Display the working directory (v) Display the complete path of the working directory

b. Write a Shell program to check the given number and its reverse are same c. Write a C program using dynamic memory allocation to find the sum of elements of a matrix

13. a. Write and execute the following UNIX commands (i) Display the calendar (ii) Execute more than one command at a time (using semi-colon ;) (iii) Display the user’s full details (iv) Display the user-id / Group-id (v) Execute more than one command at a time (using logical-AND &&)

b. Write a Shell program to check the given string is palindrome or not c. Write a C program using dynamic memory allocation to develop a mark sheet of 5 students.

14. a. Write and execute the following UNIX commands

(i) Demonstrate pipe command (ii) Demonstrate tee command (iii) Use more than one command at a time (who and date) (iv) Create a file called create.txt (v) Move the file create.txt to move.txt

b. Write a Shell program to find the sum of odd and even numbers from a set of numbers c. Write a C program using dynamic memory allocation to develop salary details of 5 employees

15. a. Write and execute the following UNIX commands (i) Create a file (ii) Print the line number of a file from start to end of the file (iii) Display the file content with line number (iv) Update the file content with I/O redirection (v) Rename the file

b. Write a Shell program to find the roots of a quadratic equation c. Write a C program using dynamic memory allocation to find the minimum and maximum of a

set of numbers.

16. a. Write and execute the following UNIX commands (i) Create a directory (ii) Create a file (iii) Rename the directory (iv) Rename the file (v) View the file

b. Write a Shell program to check the given number is Armstrong or not c. Write a C program to find the sum of ‘n’ numbers using function.

17. a. Write and execute the following UNIX commands

(i) Create a file (ii) Update the file (iii) Display the file content (iv) Display the file with line number (v) Count the number of words in the file

b. Write a Shell program to check the given number is prime or not c. Write a C program using pointers to swap two numbers

18. a. Write and execute the following UNIX commands (i) Create a Directory called main (ii) Create a sub-directory called sub in the main directory (iii) Create a file in the main directory (iv) Copy the file to the sub directory (v) Delete the file in the main directory

b. Write a Shell program to generate prime numbers between 1 and 50 c. Write a C program using pointers to copy the content of one array to another

19. a. Write and execute the following UNIX commands (i) Display the calendar (ii) Display the date and time (iii) Display the present working directory (iv) Display your user name (v) Create a file using cat command

b. Write a Shell program to find the sum of square of individual digits of a number c. Write a C program using pointers to allocate a memory for the string “University” and reallocate

the memory for the string to “University Examinations”

20. a. Write and execute the following UNIX commands (i) Use finger command (ii) Use grep command (iii) Use diff command (iv) Use uniq command (v) Use cmp command

b. Write a Shell program to find the sum of cube of individual digits of a number c. Write a C program using pointers to combine two array elements without duplicate

ANNA UNIVERSITY PRACTICAL EXAMINATIONS (MAY – JUNE 2010) GE2155 – Computer Practice Lab-II

Mark Allocation

UNIX Commands - 10 marks Shell Programming* - 40 marks C - Programming* - 40 marks Viva-voce - 10 marks

---------------- Total - 100 marks

----------------

* Shell programming and C programming mark allocation (40 marks)

Algorithm - 10 marks Program - 20 marks Execution - 10 marks

-------------- Total - 40 marks

--------------