Showing posts with label Unix. Show all posts
Showing posts with label Unix. Show all posts

OPA -JAVA UNIX Student details

OPA -JAVA UNIX Student details


#!/bin/bash
read 
awk 'BEGIN{FS=",";t=0}
 {
a[t]=$1;
b[t]=$3+$4;
c[t]=$2;
 
t=t+1
 
}
END
{
for(i=0;i<t;++i)
{
   ma=0;
    pos=i;
    for(j=0;j<t;++j)
    {
        if (b[j]>ma)
        {
            ma=b[j];
            pos=j;
        }
    }
    if (b[pos]>99)
    print a[pos],c[pos];
    b[pos]=-1;
 
}
}
'

TCS PA Unix MCQs

TCS PA Unix MCQs

TCS PA Unix MCQs


1.To copy two files in a new files ?

cat file1 file 2 > file 3
 

2.To sort the records from large to small number and print the largest number ?

 Option with Desc limit 1
 

3.Grep tata.*services$//multiple answer question

which has tata --service –may contain anything like consultancy , conference etc..
 

4.To remove a folder  which have files

    rm –rf
 
 

5.Grep –v java// multiple answer question

options which doesn’t contain the java word in the line is the answer
 

6.S=0 {s=s+$2}
Avg of second column
Sum of second column
 

​7.Unix command to remove duplicates in line  ?
1.sort –u
2.sort unique
3.uniq
4.unique
 

8.What is output of below commands.. ?
grep –o cat animal.txtgrep ‘cat’ animal.txt

1.cat cat
 
 

9.File and directory permission access will be done by which command ... ?
chmod
 

10.On update cascade ensures what .. ?
1.Data integrity
 
 

11.Delete lines from ‘this’ file .. ?
 
Sed/’this’/d file
 
12.String ‘llp’ file case insensitive.. ?
1.Grep –i‘llp’ file.txt
 
 

13.Compress file in unix.. ?
 
  Zip
  gzip
 

14.Pattern match at beginning of file ?
 
          ^pat
 

15.Length of longest file .. ?
 
Wc –L <filename>
 

16.Sort file1| uniq–u
Sort the file name file 1 and diplaysdistinct lines
 
 

17.Query to delete primary key constraints .. ?     
Drop
 

18.To print first line from file1.txt use,
 
    awk 'NR==1' file1.txt   
    head -1 file1.txt     
    sed -n '1p' file1.txt
 

19.What is output of below command 
awk'BEGIN{s=0 while(s<55){print s; ++s}}'
 
  syntax error.     
 


20.To count only words from which command is used ?
1.wc filename
2.wc -w filename
3.wc -word filename
 

21.S=S+$2.. ?

 
     sum of second column
 


22._____displays all environment variables

     env
 

 

23.in order to determinvalue of a variable use the command?
 
  set
 

24.What are three main components of the Unix Architecture
 
 kernel,shell,utilities
 

25.When a process finished its execution and exit status not received by the parent, the process state becomes...
Zombie