Friday, March 18, 2016

Unix Test upwork

1. The wc filter :
Answers:
  1. counts the number of words in a disk file or in the standard input
  2. counts the number of characters in a disk file or in the standard input
  3. counts the number of lines in a disk file or in the standard input
  4. can only be used with one file at a time
2. Which command compresses a file?
Answers:
  1. compress
  2. zip
  3. pack
  4. comp
  5. size
3. Who can change the password of a user account?
Answers:
  1. Administrator
  2. The root user
  3. All the members of the Administrator group
  4. Account owner
4. Which of the following commands can be used to view the calendar of April 2007?
Answers:
  1. $ cal april 2007
  2. $ cal april 07
  3. $ calendar 4 07
  4. $ cal 4 2007
5. The file oldies-goldies has the details of the sale of books.The records are sorted on the names of the authors and
are as follows
Alexandre Dumas
Alexandre Dumas
Alexandre Dumas
Gerald Durrell
Giovanni Guareschi
Giovanni Guareschi
James Herriot
Louisa May Alcott
Louisa May Alcott
Louisa May Alcott
Based on the above information, what will be the output of the command
uniq -u oldies-goldies ?
Answers:
  1. Gerald Durrell
  2. James Herriot
  3. Gerald Durrell James Herriot
  4. Alexandre Dumas Gerald Durrell Giovanni Guareschi James Herriot Louisa May Alcott
  5. Louisa May Alcott
6. Which keystroke combination sends or signals an interrupt request to a process ?
Answers:
  1. Ctrl+c
  2. Ctrl+d
  3. Ctrl+u
  4. Ctrl+s
  5. Ctrl+q
7. Which command will you use to count the number of words in a file?
Answers:
  1. count
  2. grep
  3. wc
  4. word count
8. The main objective of a time-sharing operating System like UNIX is to :
Answers:
  1. Minimize the net execution time.
  2. Maximize the processor utilization.
  3. Minimize the user response time.
  4. Minimize the number of instructions required for a process.
  5. Minimize the end user’s involvement required for a task.
9. Which command gives information about space being used by files and directories ?
Answers:
  1. sp
  2. mem
  3. hd
  4. du
  5. rm
10. The chmod command :
Answers:
  1. changes the current execution status from the user mode to the kernel mode.
  2. makes a file hidden so that it cannot be seen using the ls command.
  3. switches the screen from character to graphical mode.
  4. changes the access permissions of a file or directory.
  5. changes the password of a user.
11. Which of the following locations store the information about the currently installed Software on a local system?
Answers:
  1. /var/adm/sw/install
  2. /var/adm/sw/software
  3. /var/adm/sw/recent
  4. /var/adm/sw/products
12. What will be the result of command ” rm -r directory/* ”?
Answers:
  1. It will remove the directory and all the files present in that directory
  2. It will remove all the files but not the directory
  3. It will show an error message
  4. None of the above
13. What is the exit code of a successful command ?
Answers:
  1. 0
  2. 1
  3. -1
  4. 100
  5. 10
14. Which variable contains the system prompt ?
Answers:
  1. PS1
  2. PATH
  3. PROMPT
  4. HOME
  5. LOGNAME
15. The mv command :
Answers:
  1. changes the name of a file
  2. changes the name of a directory
  3. moves a file from one location to another
  4. a and b
  5. a,b and c
16. Which of the following commands can be used to change group ownership of a file/directory?
Answers:
  1. chmod
  2. chgroup
  3. chgrp
  4. grpch
17. Which option used along with find prompts the user for confirmation before any operation is performed on a file ?
Answers:
  1. -name
  2. -type
  3. -ok
  4. -exec
  5. -mtime
18. The command
rmdir c-prog
will not work if :
Answers:
  1. c-prog is not empty.
  2. c-prog is the current working directory.
  3. full pathname is specified with rmdir.
  4. a and b.
  5. a and c.
19. Which command is used by a user to define a printer for their session?
Answers:
  1. Using lpdest environmental variable
  2. Using spooler command
  3. Using lpadmin command
  4. Using printf command
20. The command
ls | more
displays a list of :
Answers:
  1. all the files in the current directory.
  2. all the files in the current directory one line at a time.
  3. all the files in the current directory one screen at a time.
  4. all the files in the current directory and then waits for the next command.
  5. all the files in all the directories.
21. Which special variable will display the exit status of the last executed command in Bourne or Korn shell?
Answers:
  1. $#
  2. $-
  3. $?
  4. $$
  5. $!
22. Which variable will display the list of the positional parameters?
Answers:
  1. $#
  2. $*
  3. $?
  4. $$
  5. $!
23. Which option of the uniq command would you use to display only those lines which have a multiple occurrence ?
Answers:
  1. -u
  2. -d
  3. -c
  4. -l
  5. -r
24. Point out the incorrect statement regarding standard input , output and error :
Answers:
  1. The terminal is the standard source for input and the standard output and standard error destination for most UNIX commands.
  2. All data sources and destinations are treated as files in UNIX.
  3. The three standard files have a file descriptor 0 – standard output file 1 – standard input file 2 – standard error file
  4. The input , output and error output can be redirected to a file other than the standard file using file descriptors and the > or < symbol.
  5. The output and error can be redirected in the append mode to add the redirected output or error to an existing file using the >> symbol.
25. Which option of the sort filter performs a numeric sort ?
Answers:
  1. -r
  2. -f
  3. -n
  4. -t
  5. -o
26. You want to read through the reference manual.What command will you use ?
Answers:
  1. assist
  2. help
  3. reference
  4. aid
  5. man
27. You want to make a new directory.What command will you use ?
Answers:
  1. md
  2. makedir
  3. mkdir
  4. dirmake
  5. newdir
28. Which UNIX command provides the type of information contained in a particular file ?
Answers:
  1. more filename
  2. type filename
  3. file filename
  4. info filename
  5. list filename
29. Which of the following statements regarding file naming is incorrect?
File names :
Answers:
  1. should not have a blank, or a tab.
  2. can contain digits, a dot, the hyphen or the underscore anywhere.
  3. can contain both upper-case and lower-case alphabets.
  4. are not case sensitive.
30. Which type of users can be associated with each file in UNIX ?
Answers:
  1. The file owner.
  2. The group owner of the file.
  3. Other users who are not part of the group.
  4. a and b.
  5. a,b and c.
31. Which of the following commands can be used to communicate directly with other users by sending messages?
Answers:
  1. $ msg
  2. $ talk
  3. $ send
  4. $ call
32. Which screen manipulation command sets the screen to reverse video?
Answers:
  1. tput cup
  2. tput smso
  3. tput rmso
  4. tput blink
  5. tput rev
33. Consider the following command cat re*
Which of the following files will not be displayed by this command ?
Answers:
  1. reminder
  2. receipt
  3. Receipt
  4. recipe-cake
  5. re.c
34. Suppose you have a file named trans and you want to display fields two to four. Which of the following commands will you use ?
Answers:
  1. cut -f4-2 trans
  2. cut -f2,3,4 trans
  3. cut -f2-4 trans
  4. a or b.
  5. b or c.
35. Which of the following files is configured for login name, login directory and login shell variables?
Answers:
  1. /etc/profile
  2. /etc/home
  3. /etc/passwd
  4. /etc/conf
36. Which option used along with the find command allows one to perform operations on the files that are located by the find command ?
Answers:
  1. -name
  2. -type
  3. -ok
  4. -exec
  5. c or d.
37. Which filter will you use to translate a set of charaters to another ?
Answers:
  1. grep
  2. cut
  3. tr
  4. wc
  5. tee
38. Which command will symbolically link two files in a directory?
Answers:
  1. link f1 f2
  2. link -s f1 f2
  3. ln f1 f2
  4. ln -s f1 f2
  5. ln -l f1 f2
39. What is the default standard error file ?
Answers:
  1. err
  2. error
  3. stderr
  4. errfile
  5. errdev
40. Which of the following commands can be used to add the read and write permissions to the user and group classes of a file named abc?
Answers:
  1. chmod ugo +rw abc
  2. chomd abc ug -rw
  3. chmod ug -rw abc
  4. chmod ug+rw abc
41. Which command identifies the current working directory ?
Answers:
  1. pwd
  2. cd
  3. dir
  4. ls
  5. cur
42. Mounting a file system means :
Answers:
  1. Preparing it for backup.
  2. Copying all the files from one filesystem to another.
  3. Moving all the files from one filesystem to another.
  4. Loading a filesystem from backup medium like tape.
  5. Providing a link to the filesystem to be mounted so that it appears as a local subdirectory.
43. What is the file descriptor for the standard error file ?
Answers:
  1. 0
  2. 1
  3. 2
  4. 3
  5. 4
44. With regard to UNIX, a process is :
Answers:
  1. the name of a command.
  2. the name of the administrator.
  3. the name of the UNIX server.
  4. a program in a state of execution.
  5. another name for a file.
45. Which of the following is incorrect about the restrictions imposed by the restricted shell ?
Answers:
  1. The user cannot move out of the current working directory.
  2. The user cannot change the path; execution of programs in directories other than those authorised by the system is prevented.
  3. The user cannot specify absolute path-names beginning at the root.
  4. The user cannot redirect input or output.
  5. The user is not allowed to see the listing of files in his working directory.
46. Which of the following characters can be used to run multiple commands on a single line?
Answers:
  1. /
  2. :
  3. ,
  4. ;
47. Which command will you use to see your current group?
Answers:
  1. who am i
  2. show group
  3. group
  4. id
48. Which command will delete a directory only if it is empty ?
Answers:
  1. rmdir
  2. rmdir -r
  3. rmdir -e
  4. rmdir -t
  5. rmdir -u
49. Using which command can you move to a different directory?
Answers:
  1. pwd
  2. cd
  3. ls
  4. mv
  5. rm
50. Pipes is/are :
Answers:
  1. special programs that prevent the system from crashing.
  2. disk management utilities.
  3. memory management utilities.
  4. a special feature by which the standard output of a command or user program can be sent as the standard input to another command or user program
  5. special channels for high speed data transfer.
51. Which command would make the scope of a shell variable global to the subshells ?
Answers:
  1. global
  2. export
  3. scope
  4. grant
  5. extend
52. Which of the following statements is incorrect ?
Answers:
  1. UNIX operating system is available on machines with a wide range of computing power, from microcomputers to mainframes.
  2. UNIX is a multi-user system designed to support a group of users simultaneously.
  3. UNIX uses a hierarchical file structure to store information.
  4. At the core of UNIX is the shell, a program controlling the computer’s resources.
  5. UNIX has facilities called pipes and filters which permit the user to create complex programs from simpler programs.
53. What is the correct command to delete all files with two character file-names from the directory /user/group2 ?
Answers:
  1. rm /user/group2/..
  2. rm /user/group2/??
  3. rm /user/group2/**
  4. rm /user/group2/–
  5. rm /user/group2/;;
54. Study the following statements and select the incorrect one :
Answers:
  1. UNIX files assume all data to be consisting of streams of bytes.
  2. UNIX commands use the system calls for their operations.
  3. UNIX adopts a priority based scheduling strategy.
  4. UNIX process priorities cannot be changed by the user.
  5. The UNIX system call signal is used to handle interrupts.
55. UNIX offers the following benefits :
Answers:
  1. Time-sharing
  2. Multi-tasking
  3. Multi-programming
  4. a and b.
  5. a,b and c.
56. In UNIX , shell is a program which :
Answers:
  1. reads a command line from the standard input and interprets it according to a fixed set of rules.
    is a framework into which functions or utilities can be added when required.
  2. is the interface between the user and the kernel.
  3. a and b.
  4. a and c.
57. You want to search for the pattern “Newa” or “Newb” or “Newc”. Which regular expression will you use with the grep command ?
Answers:
  1. “New[abc]”
  2. “New[a-c]”
  3. “New[^abc]”
  4. a or b.
  5. b or c.
58. Which of the following statements is incorrect regarding variables?
Answers:
  1. Variables have no data type.
  2. Variables can be local or global.
  3. Variables can be created at the $ prompt or within a shell script.
  4. Global variables are created by the global command.
  5. Environment variables are created by the shell.
59. What is the file descriptor for the standard output file ?
Answers:
  1. 0
  2. 1
  3. 2
  4. 3
  5. 4
60. Which command invokes a text editor ?
Answers:
  1. write
  2. edit
  3. editor
  4. pad
  5. vi
61. Which option of the uniq command would you use to display lines with only one occurence?
Answers:
  1. -u
  2. -d
  3. -c
  4. -l
  5. -r
62. What is the default UNIX prompt?
Answers:
  1. !
  2. #
  3. @
  4. $
63. What is the number of standard file pointers in UNIX?
Answers:
  1. 3
  2. 4
  3. 5
  4. 6
  5. 7
64. In which of the following high level languages most of the UNIX is written?
Answers:
  1. C++
  2. JAVA
  3. PASCAL
  4. FORTRAN
  5. C
65. Which command is used to run a command at a specified time ?
Answers:
  1. timer
  2. at
  3. time
  4. atq
  5. dd
66. You have two variables, v1 and v2. You want to assign the value of v2 to v1.Which of the following declarations is correct ?
Answers:
  1. v1=v2
  2. v1=$v2
  3. v1=${v2}
  4. a or b.
  5. b or c.
67. What communication command allows a user to communicate with another user logged on by splitting the screen and providing two way communication ?
Answers:
  1. talk
  2. write
  3. chat
  4. talkto
  5. transmit
68. The number of arguments can be known by which variable ?
Answers:
  1. $-
  2. $?
  3. $!
  4. $#
  5. $$
69. UNIX is an example of :
Answers:
  1. Batch processing operating system.
  2. Time sharing operating system.
  3. Real time sharing system.
  4. Single user operating system.
  5. Assembly language.
70. What information does the who am i command display?
Answers:
  1. The user’s name.
  2. The user’s terminal file name.
  3. The day the user logged in.
  4. The time the user logged in.
  5. The day the user logged in the last time.
71. You want to declare a variable vs with the value hello. Which of the following declarations is correct ?
Answers:
  1. vs = ‘hello’
  2. vs=’hello’
  3. vs=hello
  4. a or b
  5. b or c
72. Which of the following is not a filter ?
Answers:
  1. sort
  2. grep
  3. uniq
  4. pg
  5. echo
73. What is the command that can print lines of 1st file matching with 2nd file ?
Answers:
  1. printline
  2. cmp
  3. com
  4. comm
  5. prncomm
74. Which file contains the commands run by all users at login?
Answers:
  1. /usr/init
  2. /usr/profile
  3. /usr/startup
  4. /etc/startup
  5. /etc/profile
75. Which command would you use if you want to display selective fields from a file ?
Answers:
  1. pg
  2. wc
  3. tr
  4. cut
  5. tee
76. Which filter is used to copy the standard input to the standard output and also to a disk file ?
Answers:
  1. grep
  2. cut
  3. tr
  4. wc
  5. tee
77. You are writing a shell script.For a given condition, you want to terminate a loop. Which command will you use ?
Answers:
  1. terminate
  2. end
  3. break
  4. stop
  5. exit
78. The find command :
Answers:
  1. searches for specific patterns of characters in file.
  2. is used for locating words in a file.
  3. Is used to locate files in a directory and in all subdirectories of that directory.
  4. can only be used by the administrator.
  5. is used for locating users in a network.
79. By which screen manipulation command can you specify the coordinates for the cursor position ?
Answers:
  1. tput cup
  2. tput smso
  3. tput rmso
  4. tput blink
  5. tput reverse
80. Highlight the incorrect statement regarding the uniq command :
Answers:
  1. uniq is a filter.
  2. It compares adjacent lines in a sorted file.
  3. It can display lines that are unique.
  4. It can display lines that are repeated.
  5. It automatically sorts the file that is specified.
81. The command
rm -r project
Answers:
  1. deletes the file project from the current directory.
  2. deletes all the files from the directory project.
  3. recursively deletes the directory project and all its subdirectories.
  4. deletes the file project found in all directories.
  5. is invalid.
82. You want to specifically search for the character [ . What character(s) would you use in the expression to achieve this ?
Answers:
  1. []
  2. ^
  3. .

  4. $
83. Which screen manipulation command sets the screen back to normal?
Answers:
  1. tput cup
  2. tput smso
  3. tput rmso
  4. tput blink
  5. tput reverse
84. Which character of the grep filter specifies that the pattern preceding it must occur at the end of each line ?
Answers:
  1. []
  2. ^
  3. $
  4. .

85. Which option of the grep filter prints out all those lines that do not match the pattern specified by the regular expression ?
Answers:
  1. -n
  2. -c
  3. -d
  4. -l
  5. -v
86. Which character would be used in the grep filter to specify a pattern which consists of any one of a set of characters?
Answers:
  1. []
  2. ^
  3. $
  4. .

87. The user passwords are kept in which file on most Unix systems?
Answers:
  1. /etc/passwd
  2. /etc/password
  3. /usr/password
  4. /bin/passwd
  5. /system/password
88. Which option of the sort filter folds lower case characters to upper case ?
Answers:
  1. -r
  2. -f
  3. -n
  4. -t
  5. -o
89. Which file contains the commands that the system executes when a user logs in?
Answers:
  1. $HOME/startup
  2. user/init
  3. $HOME/.profile
  4. etc/startup
90. The executable file name for the Bourne shell is :
Answers:
  1. bsh
  2. sh
  3. csh
  4. ksh
  5. lsh
91. By which command a user can add a password for his login name?
Answers:
  1. passwd
  2. pass
  3. chpass
  4. password
  5. setpass
92. Which of the following is the only filter?
Answers:
  1. echo
  2. wc
  3. mv
  4. rm
93. Consider the following file listing of file abc1 for a user abc
-rw——- 1 abc student 10 jan 10:39 abc1
What inference would you make regarding the file access permissions ?
Answers:
  1. The group have full permissions.
  2. Only the owner has full permissions.
  3. Only the owner has read and write but no execute permissions.
  4. The group has read and write permissions.
  5. Others have read and write permissions.
94. Which command gives all differences between two files ?
Answers:
  1. filecmp
  2. filecompare
  3. filediff
  4. diff
95. Which of the following shells is typically used for guest logins and in secure systems ?
Answers:
  1. sh
  2. csh
  3. ksh
  4. rsh
  5. lsh
96. Which option of the sort filter changes the output to reverse order ?
Answers:
  1. -r
  2. -f
  3. -n
  4. -t
  5. -o
97. Which of the following is not a valid file command ?
Answers:
  1. ls
  2. cat
  3. mv
  4. cp
  5. break
98. Which wild-card matches one character ?
Answers:
  1. *
  2. #
  3. ?
  4. @
99. A single command which lists all files in a directory, distinguishing between a directory, executable and symbolic link files is:
Answers:
  1. ls -l
  2. ls -F
  3. ls -o
  4. ls -r
  5. ls -h
100. What would be displayed on the screen if the pwd command is entered when the user is in /usr directory?
Answers:
  1. /
  2. home
  3. /home/username
  4. usr/
  5. usr>
  6. usr/username
101. Which of the following statements is incorrect regarding positional parameters ?
Answers:
  1. They are used to create generalised scripts.
  2. There can be a maximum number of 9 variables.
  3. The shift command is used when the number of parameters exceeds 9 to shift the values of variables.
  4. Depending upon the number of arguments specified in the command line, the shell will assign values to some or all of the positional parameters.
  5. The command name is put into the variable $1.
102. How can a root user find the password of a user who has forgotten his password?
Answers:
  1. By looking in the etc/passwd
  2. By using passwd command
  3. It is not possible
  4. None of the above
103. Which of the following statements is incorrect regarding the UNIX environment?
Answers:
  1. It has the provision of security through the login and passwd programs.
  2. In it the file names are not case insensitive.
  3. It has the provision of various commands and utilities for file and directory manipulation.
  4. It does not allow relative path names.
  5. It allows the use of wild-card characters for file-name expansion.
104. Which command is used for splitting a file horizontally?
Answers:
  1. cut
  2. head
  3. tail
  4. b and c
  5. a, b and c
105. Which of the following is a responsibility of the system administrator?
Answers:
  1. Setting permissions for files and directories
  2. Creation of users and group-ids
  3. Providing security through the use of passwords
  4. a and c
  5. a,b and c
106. The shell variable that defines internal field separator is.
Answers:
  1. PS1
  2. PATH
  3. HOME
  4. LOGNAME
  5. IFS
107. Which of the following statements is not true regarding the grep filter?
Answers:
  1. It is used to seach a file for a particular pattern of characters and displays all lines that contain that pattern.
  2. The pattern that is searched for in the file is referred to as the regular expression.
  3. grep can be used without specifying a regular expression.
  4. The filenames are optional.In this case grep expects standard input.
  5. The -c option prints only a count of the lines that match the pattern.
108. What control character signals the end of the file ?
Answers:
  1. Ctrl+a
  2. Ctrl+b
  3. Ctrl+c
  4. Ctrl+d
  5. Ctrl+e
109. Which command will you use to see the available routes and their status?
Answers:
  1. show route
  2. route status
  3. netstat -rn
  4. None of the above
110. Which error will you see when an NFS client can no longer access mounted file system?
Answers:
  1. File Not Found
  2. Stale File Handle
  3. Invalid Command
  4. File Inaccessible
111. What is the user id of a root user?
Answers:
  1. 0
  2. 1
  3. 2
  4. 3

No comments:

Post a Comment