Ios Practical Answers - Durga
Ios Practical Answers - Durga
1)a)List out the number of lines, characters and words present in a file using the necessary UNIX
command. (15)
wc filename
output:
Example:
wc myfile.txt
wc -l filename # lines
wc -w filename # words
wc -m filename # characters
1)b) Create a process and print the process id of current process and its parent process. (15)
#include <stdio.h>
#include <unistd.h>
int main() {
return 0;
}
3)a) Using the desired UNIX command rename a file of the user to a new name. (15)
mv old_filename new_filename
Example:
mv report.txt summary.txt
3)b) Write a Shell program to find the area and circumference of a circle. (15)
#!/bin/bash
read r
#!/bin/bash
read marks
grade="A+"
grade="A"
grade="B"
grade="C"
elif [ $marks -ge 50 ]; then
grade="D"
else
grade="F"
fi
#include <stdio.h>
#include <stdlib.h>
int main() {
scanf("%d", &n);
int requests[n];
scanf("%d", &requests[i]);
scanf("%d", &head);
head = requests[i];
return 0;
}
8) Write a C program to implement SSTF disk scheduling strategy.
#include <stdio.h>
#include <stdlib.h>
int main() {
scanf("%d", &n);
scanf("%d",&head);
while(done<n) {
for(int i=0;i<n;i++)
printf("%d\n",seek);
#include <stdio.h>
#include <unistd.h>
int main() {
return 0;
f=$(( (c * 9 / 5) + 32 ))
#include <stdio.h>
#include <pthread.h>
int main() {
pthread_t t;
pthread_join(t, NULL);
2. Q: How do you count only the number of words in a file using wc?
A: Use the command wc -w filename.
14. Q: How would you make the temperature conversion script handle decimal inputs?
A: Use bc with scale, like echo "scale=2; ($c * 9 / 5) + 32" | bc.
15. Q: What is a thread in C?
A: A thread is a lightweight process used to perform multiple tasks concurrently within a
program.
20. Q: How can you prevent invalid marks like over 100 in a grading script?
A: Add a condition like if [ $marks -le 100 ] to ensure input is within the valid range.
ALL THE ANSWERS AND THE SAMPLE VIVA QUESTIONS WERE GENERATED BY CHAT GPT SO
EDHAVADHU THAVARUGAL IRUNDHAL NAN PORUPU ALLA .