You are on page 1of 10

UNIX SHELL PROGRAMMING (21CS482)

1. Which command is used to list the attributes of a file?


a) cp
b) list
c) ls
d) attr
2. Which one of the following is not an attribute displayed by ls command?
a) File Permissions
b) File Ownership
c) Links
d) Word count of file
3. What are links referred to as in file attributes?
a) Number of filenames of a single file that are maintained by the system
b) Number of duplicates of a single file
c) Number of copies of a single file
d) Number of files present in a directory
4. In how many categories are links divided?
a) 1
b) 2
c) 4
d) 0
5. Hard linked files are provided with the same inode number as the original one.
a) True
b) False
6. Soft linked files are provided with different inode number as the original one.
a) True
b) False
7. Which option is used with ls command to list the directory attributes rather than its
contents?
a) -b
b) -a
c) -l
d) -d
8. File attributes are of major concern as compared to directory attributes while performing
operations on file system.
a) True
b) False
9. A file contains 1026 bytes. How many bytes of disk space will it consume if size of a
disk block is 1024 bytes.
a) 1026
b) 1024

Department of CSE Page 1


UNIX SHELL PROGRAMMING (21CS482)

c) 2048
d) 4096
10. A file can be recognized as an ordinary file or directory by __________ symbol.
a) $
b) -
c) *
d) /
11. How many types of permission a file has in UNIX.
a) 1
b) 2
c) 3
d) 4
12. Permissions of a file are represented by which of the following characters?
a) r,w,x
b) e,w,x
c) x,w,e
d) e,x,w
13. A file named abd.txt has the following set of permissions.

-rwxrwxrwx

All the three operations i.e read, write and execute can be performed on the file by the owner,
group owner and others.

a) True
b) False
14. Which of the following symbol is used to indicate the absence of a permission of a file.
a) $
b) &
c) +
d) -
15. When we create a file, we are the owner of a file.
a) True
b) False
16. What is group ownership ?
a) Group of users who can access the file
b) Group of users who can create the file
c) Group of users who can edit the file
d) Group of users who can delete the file
17. A file has permission as rwxr-----. A user other than the owner cannot edit the file.
a) True

Department of CSE Page 2


UNIX SHELL PROGRAMMING (21CS482)

b) False
18. If a file is read protected, we can write to the file.
a) True
b) False
19. The write permission for a directory determines that ____________
a) We can write to a directory file
b) We can read the directory file
c) We can execute the directory file
d) We can add or remove files to it
20. If the file is write protected and the directory has to write permission then we cannot
delete the file.
a) True
b) False
21. What is execute permission?
a) Permission to execute the file
b) Permission to delete the file
c) Permission to rename the file
d) Permission to search or navigate through the directory
22. What of the following is default permission set for ordinary files?
a) rw-rw-rw-
b) rwxrwxrwx
c) r--r--r--
d) rw-rw-rwx
23. Which of the following is default permission set for directories?
a) rw-rw-rw-
b) rwxrwxrwx
c) r--r--r--
d) rw-rw-rwx
24. A file owner does not have a permission to edit the file but the group to which the file
owner belong do have the permission to edit it. Can owner edit the file?
a) Yes
b) No
c) Cannot be defined.
d) Error will be encountered
25. Which command is used to change the permission of a file?
a) chmod
b) ch
c) chown
d) chgrp
26. chmod command can take multiple filename as arguments.

Department of CSE Page 3


UNIX SHELL PROGRAMMING (21CS482)

a) True
b) False
27. chmod command can be used in _________ways.
a) 3
b) 2
c) 5
d) 0
28. The expression used with chmod command to change permissions in a relative manner
contains ______ components.
a) 5
b) 2
c) 4
d) 3
29. Which of the following characters specify the user and group category ?
a) ‘u’ and ‘g’
b) ‘g’ and ‘o’
c) ‘us’ and ‘gr’
d) ‘u’ and ‘o’
30. Which of the following symbol is used with chmod to assign permission to a file ?
a) -
b) /
c) +
d) *
31. Which of the following symbol is used with chmod to remove permission from a file ?
a) -
b) /
c) +
d) *
32. To assign execute permission to the user(owner) for a file named file01.txt which of the
following command will be used?
a) chmod u+r file01.txt
b) chmod u+w file01.txt
c) chmod u-x file01.txt
d) chmod u+x file01.txt
33. What does the following command do ?

$chmod ugo +w file01.txt

a) Assign write permission to users, group and others


b) Assign write permission to the user(owner) only
c) Assign write permission to group and others

Department of CSE Page 4


UNIX SHELL PROGRAMMING (21CS482)

d) Command not executable


34. Which character is used to replace ‘ugo’ string in chmod command ?
a) a
b) v
c) x
d) o
35. To remove write permission from group and others, which one of the following
commands will be used.
a) chmod go+w file01
b) chmod go-w file01
c) chmod ug-w file01
d) chmod a-w file01
36. While changing permission in an absolute manner, we explicitly set all the nine bits
irrespective of the previous permissions of the file
a) True
b) False
37. What are the permission of file01 after executing this command ?

chmod 777 file01

a) rwxrwxrwx
b) rw-rw-rw-
c) r—r—r—
d) r—r-----
38. A file named file01 should be readable, writable and executable only by the user(owner).
Which one of the following set of command will be used?
a) chmod 700 file01
b) chmod 000 file01
c) chmod 477 file01
d) chmod 777 file01
39. A file has a permission set as 000 i.e --- --- --- . Can the file be deleted?
a) Yes
b) No
40. A file has a permission set as 777 i.e rwxrwxrwx but the directory permissions are 400. If
the user tries to delete the file. Will he be able to do it ?
a) Yes
b) No
41. Which command is used to change the ownership of a file?
a) chmod
b) change
c) ch

Department of CSE Page 5


UNIX SHELL PROGRAMMING (21CS482)

d) chown

42. Which option is used for the recursive functioning of chmod command?

a) -R
b) -r
c) -l
d) -i
43. Which command is used to change the group owner of the file?
a) chown
b) ch
c) chgrp
d) chmod
44. A user can change the group ownership of a file to another group to which he does not
belong.
a) True
b) False

45. Like chmod, chown and chgrp can also use ________ option.

a) -R
b) -r
c) -x
d) -i
46. UNIX allows the system administrator to use the only chown to change both owner and
group.
a) True
b) False
47. Which symbol is used to change permissions for hidden files ?
a) .
b) &
c) $
d) *
48. The file permission 764 means:
a) Every one can read, group can execute only and the owner can read and write
b) Every one can read and write, but owner alone can execute
c) Every one can read, group including owner can write, owner alone can execute
d) Every one can read and write and execute
49. The permission –rwxr—r—represented in octal expression will be
a) 777
b) 66
c) 744

Department of CSE Page 6


UNIX SHELL PROGRAMMING (21CS482)

d) 711
50. If the umask value value is 0002, what will be the permissions of new directory?
a) 777
b) 775
c) 774
d) 664
51. What is the command to set the execute permissions to all the files and subdirectories
within the directory /home/user1/direct
a) chmod –r+x /home/user1/direct
b) chmod –R+x /home/user1/direct
c) chmod –f-r+x /home/user1/direct
d) chmod –F+x /home/user1/direct
52. Which command is used for locating files.
a) search
b) find
c) loc
d) type
53. The syntax of find command is ___________

a) find path_list selection_criteria action


b) find action path_list selection_criteria
c) find selection_criteria action path
d) find path action

54. Which symbol is used with find command for specifying arguments?
a) +
b) –
c) + and –
d) |

55. What will be the output of the following command?


$ find / -name a.out -print

a) all files having filename as a.out


b) all files in the root directory
c) undefined output
d) erroneous

Department of CSE Page 7


UNIX SHELL PROGRAMMING (21CS482)

56. We can use relative pathname in the path list while using find command.

a) True
b) False

57. Which one of the following option is used for locating the files by inode number?

a) -name
b) -inum
c) -inode
d) -ind

58. Which option is used with find command for specifying the file type?

a) -perm
b) -inum
c) -name
d) -type

59. To specify permissions while using find command we have to use _____ option.

a) -perm
b) -inum
c) -name
d) -type

60. Which option is used to find command to search for files based on access time?

a) -atime
b) -mtime
c) -time
d) -type

61. Which of the following command will be used to locate those files that have not been
modified for more than a year?

a) find . -mtime 1
b) find . -mtime 1 year -print
c) find . -mtime +365 -print
d) find . -mtime -365 -print

Department of CSE Page 8


UNIX SHELL PROGRAMMING (21CS482)

62. Which of the following operator is used with find command for performing the negate
function?

a) -a
b) -o
c) &&
d) !

63. Which operator is used to specify the AND condition in find command?

a) !
b) &&
c) -A
d) -a

64. Which operator is used to specify the OR condition in find command?

a) !
b) &&
c) -o
d) -a

65. Which of the following option is used with find command for taking action on selected files?
a) -exec
b) -atime
c) -mtime
d) -a

66. By default if any regular file is created, the number of link is displayed as 1 ?

a) True
b) False

67. A user creates a link to a file file1 using the following command “ln file1 file2”. Which of
the following is not true?
a) file1 and file2 have the same inode numbers
b) The number of links for file1 is displayed as 1
c) The number of links for file1 is displayed as 2
d) The number of links for file2 is displayed as 2

68. Deleting a soft-link

Department of CSE Page 9


UNIX SHELL PROGRAMMING (21CS482)

a) Deletes the destination file


b) Deletes both the softlink and the destination file
c) Deletes just the softlink
d) backup of the destination is automatically created

69. There are two hard links to the “file1” say hl and h2 and a softlink sl. What happens if we
deleted the “file1”?

a) We will still be able to access the file with hl and h2 but not with sl
b) We will not be able to access the file with hl and h2 but with sl
c) We will be able to access the file with any of hl, h2 and sl
d) We will not be able to access the file with any of hl, h2 and sl

70. A file is linked with the __________ command.

a) ln

b) li

c) ls

d) link

71. _______ option is used along with ln command to create a soft link.

a) –s

b)-l

c) –h

d) -e

Department of CSE Page 10

You might also like