20BCE0611ADVCLAD5
20BCE0611ADVCLAD5
Q1: Write a C program to delete the elements at the given position(s) in an array without using
second array by passing the array to a function and display the resultant array in display function.
CODE:
#include <stdio.h>
#include <conio.h>
int main ()
int arr[50];
printf( " Define the position of the array element where you want to delete: \n ");
else
arr[i] = arr[i+1];
}
return 0;
OUTPUT:
2. Write a C program to get 10 VIT registration numbers and store only the first year student’s
registration number into a file. Also retrieve the second last registration number from the file.
CODE:
#include <stdio.h>
int main(){
scanf("%s", regno[i]);
}
int a = 0;
fprintf(fp,"%s\n", regno[i]);
a++;
fclose(fp);
OUTPUT:
3. Write a C program using command line arguments to get 5 input numbers and calculate the total
number of odd numbers except ‘5’(if present), and the total number of even numbers except ‘2’ (if
present).
CODE:
#include <stdio.h>
{
int odd=0,even=0;
int a = atoi(argv[i]);
even++;
odd++;
return 0;
OUTPUT:
4. a) Write a program to know the PID and PPID of the calling process.
CODE:
#include<stdio.h>
#include<unistd.h>
int main(){
int p_id,p_pid;
p_id = getpid();
p_pid = getppid();
return 0;
OUTPUT:
b) Write a shell script to check the smallest and greatest number among the given 3 numbers.
CODE:
!/bin/bash
read n
for((i=0;i<n;i++))
do
read nos[$i]
done
for((i=0;i<n;i++))
do
echo ${nos[$i]}
done
small=${nos[0]}
greatest=${nos[0]}
for((i=0;i<n;i++))
do
small=${nos[$i]}
greatest=${nos[$i]}
fi
done
OUTPUT:
5. a) write a shell script to identify the vowels by reading a character from user using switch case
CODE:
read ch
case $ch in
Esac
OUTPUT:
CODE:
#!/bin/bash
-r q5_b.sh
ls| wc -l
OUTPUT:
CODE:
read a b
a+=$b
echo $a
OUTPUT:
7. Display all the options and descriptions which can be used along with PS command with example
CODE:
Ps
Ps -f
Ps -a
Ps -x
OUTPUT:
8. Discuss about the network communication utilities deployed in Unix OS
CODE:
TELNET
There are times when we are required to connect to a remote Unix machine and work on that
machine remotely. Telnet is a utility that allows a computer user at one site to make a connection,
Once you login using Telnet, you can perform all the activities on your remotely connected machine.
remote.