Skip to main content

TCS Xplore 2023 ( iON proctored Assessment ) - MCQ on Unix with clear concept

                   Unix ( Multiple Choice Quistion ) 


1.  Which Symbol be used with grep command to match the the pattern pat at the beginning of a line ? 

        a. ^pat

        b. $pat

        c. pat$

        d. pat^

Correct Answer : a

Explantion : 

Matching the lines that start with a string : The ^ regular expression pattern specifies the start of a line. This can be used in grep to match the lines which start with the given string or pattern.

$ grep "^unix" file.txt


2. Which command is used to sort the lines of a data in a file in reverse order ?

           a.  sort 

           b. sh

           c. sort-r

           d. st

           e. None of the above 

Correct Answer : c

Explanation :  sort is used to sort the data but sort-r is used to sort the data in reverse order 

                       sh command is used to invoke the system shell or default shell 

                  

3. Which of the command to change the protection mode of files starting with string emp           and ending with 1,2 or 3 ? 

             a. chmod u+x emp[1-3]

             b. chmod 777 emp*

             c. chmod u+r ??? emp

             d. chmod 222 emp?

             e. None of these 

Correct answer : a

Explanation : chmod 777 means give  red , write , execute permission to everybody .

                      chmod 222 Write Permissions for Owner, Group members and Others. First 2                        assigns write permission for Owner (user), second 2 will assign write                                      permission to Group members and Third 2 assigns write permissions to others.

                      chmod u+x will made the file executable for your user


4. Which command is used to remove the directory ?

         a. rd

         b. rmdir

         c. dl dir

         d. rdir 

Correct answer : b

Explanation :    rd command is used to remove an empty directory

                         rmdir removes the directory, specified by the Directory parameter, from the                           system


 5.  Find the occurrences of word and print its occurrence count.

answer :     grep –o –i “unix” myfile| wc –l

Explanation : grep is used for search , -i remove case sensitive , wc for word count . -l is for                         print the word count 

6.   What will be the output of the below command?

       find . -type f -perm 0777 -print

               a. Display all files who has all the three permission for all levels of users

               b. Display all directories who has all the three permission for all levels of users

               c. Display all files who has minimum level of  permission for all levels of users

               d. Display all folders who has all the three permission for all levels of users

 Correct answer : a

Explanation :
type f return only the files , 
                        [ Note : ls commands used to display the folders ]

7. Which awk script will give you the average of second column of the file named file1, which      has ‘|’ as the delimiter ? 

                 a. awk ‘BEGIN(FS=”|”;s=0)(s=s+$2)END(print s/NR)’ file1

                 b. awk ‘BEGIN{FS=”|”;s=0}{s=s+$2}END{print s/NR}’ file1

                 c. awk ‘BEGIN{FS=”|”;s=0}{s=s+$2}END{print s}’ file1

                 d. awk ‘BEGIN{FS=” ”;s=0}{s=s+$2}END{print s/NR}’ file1

Correct answer : c

8. Select the correct command to search "Hello Unix" in a file ignoring case ?

          a.  grep "Hello Unix" file name

          b. grep -i "Hello Unix" file name

          c.  grep  -c "Hello Unix" file name

          d. grep  -i file name "Hello Unix" 

Correct answer : b

9. Which of the following command in unix used to remove the duplicate lines ? 

           a. sort -u

           b. sort uniq

           c. uniq

           d. uniqe

correct answer : c

Some Useful Commands of Unix :

1. ls - used to show the list of all the folders in an directory 

2. ltr - used to show the list of all the folders but with more information like date time of                 creation .

3. cmd - used to change the current directory 

4. pwd - tells us in which directory , we are working 

5. mkdir - used to create new directory 

6. cat - used to print content of a file and it also allow us to write content to the directory 

7. mv - used to move files from one directory to others .

8. chmod -  used to change the permission of files and directory 

9. grep - used to search the the string or text 

10. echo - used to print the string written after echo 





Comments

Popular posts from this blog

Complete Strategy to clear TCS Xplore IPA in One Attempt Now ( 80+ Score )

  So hello Everyone , Here are the all Links from where you can Practice !  All the resources are searched from my best !  1. For KYT and Bizzskill  Link :- tcs Xplore course  2. Unix Operating system Link :-    a.  click here Link 1 b.  click here Link 2 c.  Click here Link 3   3. UI  Link :-  click here 4. SQL and Pl SQL Link : -  Click here Click here click here 5. Java MCQ  Link :-  click here click here click here 6. Java coding :-  Access the playlist on YouTube :-  click here to watch Access the blogs :-  click here All in one link :-   click here

TCS IPA previous year quistion ( 35 marks ) , Quistion , Input , output

 Problem Statement Video Link :    https://youtu.be/XCBvfJAo908 Create a class TravelAgencies with below attributes: regNo – int agencyName – String pakageType – String price – int flightFacility – boolean Write getters, setters for the above attributes . Create constructor which takes parameter in the above sequence. Create class Solution with main method. Implement two static methods – findAgencyWithHighestPackagePrice and agencyDetailsforGivenIdAndType in Solution class. findAgencyWithHighestPackagePrice method: This method will take array of TravelAgencies objects as an input parameter and return the highest package price from the given array of objects. agencyDetailsForGivenldAndType method: This method will take three input parameters -array of TravelAgencies objects, int parameter regNo and String parameter packageType. The method will return the TravelAgencies object based on below conditions. FlightFacility should be available. The input parameters(regNo and pack...

TCS Xplore 2023 - JAVA MCQ question for best practice ( iON Proctored Assessment )

           Multiple Choice Question ( JAVA )     ---------------------->>>>    Click Here : Subscribe to click   <<<<< -------------------------- PART - 01  Q1 . What is size of float and double ?         a.  32 and 64                      b. 32 and 32          c.  64 and 64                      d. 64 and 32  Ans : 32 and 64  Q2 .  What will be the output ?            short x=10;           x*=5;           System.out.println(x);         a.  50                                b. 10         c.  No output    ...