#!
/bin/bash
>[Link]
While read -r line; do
Sum=0
for sum in $line; do
sum=$(sum+num)
done
echo “$line $sum” >> [Link] ”
done < [Link]
#!/bin/bash
While read -r line; do
Sum=0
for num in $line; do
sum=$(sum+num)
done
echo “$line $sum”
done < [Link] > [Link]
answer
1. ftp and scp
2. df -kh, df for disk utilisation, du for-disk utilisation in particular file or folder, dfspace and df both are same but dfspace will give in MB
3. nohup ./script,sh
4. :set fileformat:unix
5. while read -r line; do
6.1. matches x or y or z
6.2. matches any character except p, q, r
6.3. matches a through z or A through Z
7. A process whose child process is completed but parent is not recognized
ps -eaf|grep defunct
8. top, htop
9. CPU intensive process, insufficient resources, malware and background process and services
10. FCFS, shortes job first, priority scheduling and round robin
OOPs concept question
Interface- It defines a contract; all methods are abstract (can have default/static in java 8+).
Abstract class- It can have both abstract and concrete methods, used for partial implementation
Compile time- It checked by compiler must be handled for exception.
Run-time- It occurs during exception not checked by compiler for null pointer exception.
Method overloading- Same name, different parameters for compiling time polymorphism.
Method overriding- same signature in subclass for runtime polymorphism.
Garbage collection- automatic memory cleanup by JVM for unused objects
- Prevents memory leaks and improve performance
Database
1. Select e.emp_name form employee e, employment ee where e.emp_id=ee.emp_id and emp_country = ‘India’;
2. Select count(*) as numberofemployee from employee e, employment ee where e.emp_id=ee.emp_id and ee.emp_join_date
=’2022-12-11’ abd e.emp_name like ‘Vivek%’;
3. Select emp_join_date as day_of_year, count(*) from employment group by emp_join_date order by numberofemployee desc;
4. We can use index for faster retrieve, execution plan for the query and proper joins on the query.\
Data structure
1. Stack- LIFO (last in, first out) example- undo operations
Queue- FIFO- (first in, first out) example- printer jobs
2. Tree- tree is hirerachial structure with nodes connected by edges and no cycles
Graph- It’s a general network of nodes and edges, can have cycles.
3. Array- Array is fixed size, fast random access and costly insert/delete
Linkedlist- Its in dynamic size, fast, insert/delete and slow random access.
4. Circular linked list- Linked list where the last nodes points back to the first node.
5. Hashmap- Key value for data structure that allows fast lookups using a hash function.
Coding questions
def FizzBuzz(n);
Answer=[]
For i in range(1, n+1);
If i% 15 ==0;
[Link](“FizzBuzz”)
elif i % 3 ==0;
[Link](”Fizz”)
elif i % 5 ==0;
[Link](“Buzz”)
else;