Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

Which symbol is used to change permissions for hidden files?(a) .(b) &(c) $(d) *This question was addressed to me in final exam.The query is from Changing File Ownership and Permissions topic in division Basic File Attributes of Unix

Answer»

Correct choice is (a) .

The best I can EXPLAIN: To change PERMISSIONS for hidden files, use the (.) SYMBOL with chmod command.

2.

UNIX allows the system administrator to use the only chown to change both owner and group.(a) True(b) FalseI have been asked this question during an interview.The above asked question is from Changing File Ownership and Permissions topic in section Basic File Attributes of Unix

Answer»

The CORRECT option is (a) True

Best explanation: UNIX provides a special privilege for the system ADMINISTRATOR to change both the owner and group using CHOWN command only. The syntax REQUIRES two arguments to be separated by a (:). For example,

3.

Like chmod, chown and chgrp can also use ___ option.(a) -R(b) -r(c) -x(d) -iI had been asked this question in an online interview.Question is taken from Changing File Ownership and Permissions topic in division Basic File Attributes of Unix

Answer»

The correct choice is (a) -R

For explanation: Like chmod, chown and CHGRP use the -R OPTION to perform their operations in a recursive manner.

4.

A user can change the group ownership of a file to another group to which he does not belong.(a) True(b) FalseI had been asked this question in final exam.My question is from Changing File Ownership and Permissions in division Basic File Attributes of Unix

Answer» CORRECT OPTION is (B) False

Best explanation: Group ownership can be changed only to that group to which the user also belongs otherwise a user cannot change the group ownership of a file to ANOTHER group to which he does not belong.
5.

Which command is used to change the group owner of the file?(a) chown(b) ch(c) chgrp(d) chmodThis question was posed to me in homework.My doubt is from Changing File Ownership and Permissions in chapter Basic File Attributes of Unix

Answer»

Right CHOICE is (c) chgrp

The BEST I can EXPLAIN: A user can CHANGE the group owner of a file but only to that group to which he belongs. A user can belong to more than one group and the one shown in /etc/psswd is the user’s MAIN group.

6.

Which option is used for the recursive functioning of chmod command?(a) -R(b) -r(c) -l(d) -iThe question was asked during a job interview.My doubt stems from Changing File Ownership and Permissions topic in division Basic File Attributes of Unix

Answer» CORRECT ANSWER is (a) -R

To ELABORATE: Like other UNIX commands, chmod can also descend a directory hierarchy and apply the EXPRESSION to every file and subdirectories it finds. This is done USING -R option. For example,
7.

Which command is used to change the ownership of a file?(a) chmod(b) change(c) ch(d) chownI got this question by my college professor while I was bunking the class.My query is from Changing File Ownership and Permissions in portion Basic File Attributes of Unix

Answer» CORRECT option is (d) chown

To explain I would say: For CHANGING the file ownership, we USE the chown command. chown transfer the ownership of a file to another user. The command requires the user-ID (UID) of the recipient. To change the ownership of a file from user01 to user02, use the FOLLOWING COMMANDS:
8.

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) chmod477 file01(d) chmod777 file01I got this question in quiz.I need to ask this question from Changing File Ownership and Permissions in division Basic File Attributes of Unix

Answer» CORRECT choice is (a) chmod 700 file01

To explain: SINCE 7(111) REPRESENTS read, write, execute permission. So 700 will represent read, write, execute permission only for the user (OWNER).
9.

A file has a permission set as 000 i.e. — — —. Can the file be deleted?(a) Yes(b) NoThis question was addressed to me by my college director while I was bunking the class.This interesting question is from Changing File Ownership and Permissions in chapter Basic File Attributes of Unix

Answer»

The correct ANSWER is (a) Yes

The explanation is: The file having permission set as 000 is useless i.e. it is not readable, writable or executable. But we can delete the file USING directory PERMISSIONS. If the directory has write permission, we can easily add or remove a file from it.

10.

A file has a permission set as 777 ie 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) NoI had been asked this question in quiz.This intriguing question originated from Changing File Ownership and Permissions in section Basic File Attributes of Unix

Answer»

The correct option is (b) No

The best EXPLANATION: Since we have only read permissions for the DIRECTORY and the directory permissions do not ALLOW us to add or REMOVE a file from it we cannot delete a file no matter what is the permission set of that file.

11.

While changing permissions in an absolute manner, we explicitly set all the nine bits irrespective of the previous permissions of the file.(a) True(b) FalseThe question was asked in examination.This intriguing question comes from Changing File Ownership and Permissions in chapter Basic File Attributes of Unix

Answer»

The correct choice is (a) True

The explanation: The EXPRESSION used by chmod in an absolute manner is a string of three octal numbers (BASE 8).A set of 3 bits represent a single octal DIGIT.

->Read permission –4 (100 in octal)

->Write permission –2(010 in octal)

->Execute permission –1(001 in octal)

For each category, we add up these numbers. For example, if we have to set read and write permission then an octal number will be 110 (4+2).

12.

To remove write permission from group and others, which one of the following commands will be used?(a) chmodgo+w file01(b) chmodgo-w file01(c) chmodug-w file01(d) chmod a-w file01This question was addressed to me by my school principal while I was bunking the class.This is a very interesting question from Changing File Ownership and Permissions topic in section Basic File Attributes of Unix

Answer»

The correct option is (b) chmodgo-w file01

For explanation I WOULD SAY: To remove a certain permission from a category of users we use (-) symbol. So above COMMAND will remove write permission from GROUP and others.

13.

Which character is used to replace ‘ugo’ string in chmod command?(a) a(b) v(c) x(d) oI got this question in an interview for internship.My doubt stems from Changing File Ownership and Permissions topic in chapter Basic File Attributes of Unix

Answer»

The correct CHOICE is (a) a

For explanation I would say: UNIX offers a SHORTHAND SYMBOL ‘a’ (all) that acts as a synonym for the ‘ugo’ string which represents all the categories of users.

14.

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) chmodu-x file01.txt(d) chmod u+x file01.txtI got this question during an interview.I'm obligated to ask this question of Changing File Ownership and Permissions topic in section Basic File Attributes of Unix

Answer» RIGHT choice is (d) CHMOD u+x file01.txt

The EXPLANATION is: To assign execute PERMISSION to the USER, above command is stated as follows:
15.

Which of the following symbol is used with chmod to assign permission to a file?(a) –(b) /(c) +(d) *This question was posed to me in a national level competition.Enquiry is from Changing File Ownership and Permissions in chapter Basic File Attributes of Unix

Answer»

Correct answer is (c) +

To ELABORATE: To ASSIGN and REMOVE permissions from a file, (+) and (-) symbols are used RESPECTIVELY.

‘+’ symbol will assign a permission

‘-‘ symbol will remove a permission

16.

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’The question was posed to me during an interview.This interesting question is from Changing File Ownership and Permissions in division Basic File Attributes of Unix

Answer»

Correct choice is (a) ‘u’ and ‘g’

To explain I WOULD say: Each character SPECIFIES a particular category of users as FOLLOWS:

‘u’ STANDS for a USER,

‘g’ for ‘group’

‘o’ for ‘others’.

17.

The expression used with chmod command to change permissions in a relative manner contains ____ components.(a) 5(b) 2(c) 4(d) 3I got this question by my college professor while I was bunking the class.Query is from Changing File Ownership and Permissions in chapter Basic File Attributes of Unix

Answer»

The correct option is (d) 3

For explanation: chmod command TAKES an EXPRESSION as its arguments which comprises of some LETTERS and SYMBOLS. The expression comprises three components:-

->User category (user, group, others)

->The operation to be performed (assign or remove a permission)

->Type of permission (read, write, EXECUTE).

18.

chmod command can be used in ____ ways.(a) 3(b) 2(c) 5(d) 0This question was posed to me during a job interview.The question is from Changing File Ownership and Permissions in chapter Basic File Attributes of Unix

Answer»

Correct OPTION is (B) 2

Explanation: chmod command can be USED in two manners i.e. relative (changes are specified to the CURRENT PERMISSIONS) and absolute (final permissions are specified).

19.

chmod command can take multiple filenames as arguments.(a) True(b) FalseThis question was addressed to me by my school teacher while I was bunking the class.Origin of the question is Changing File Ownership and Permissions in division Basic File Attributes of Unix

Answer»

Right OPTION is (a) True

The explanation: We can change permissions of MULTIPLE FILES by USING chmod command once. To change permissions of multiple files simultaneously just use the chmod command with multiple filenames as arguments.

20.

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 encounteredThe question was asked in quiz.The above asked question is from File Ownership and Permissions in division Basic File Attributes of Unix

Answer»

The correct option is (b) No

To explain I would say: The FILE owner cannot edit the file because the owner’s permission overrides the group’s permission. In other words, the PRIORITY of owner’s permission is GREATER than group’s permission.

21.

Which command is used to change the permissions of a file?(a) chmod(b) ch(c) chown(d) chgrpI have been asked this question in exam.The query is from Changing File Ownership and Permissions in division Basic File Attributes of Unix

Answer»

Correct answer is (a) chmod

Best EXPLANATION: The chmod (change mode) command is used to change the PERMISSIONS of files. This command can only be RUN by the owner of the FILE or by the super USER.

22.

Which of the following is default permission set for directories?(a) rw-rw-rw-(b) rwxrwxrwx(c) r–r–r–(d) rw-rw-rwxThis question was posed to me in final exam.I want to ask this question from File Ownership and Permissions topic in portion Basic File Attributes of Unix

Answer»

Correct OPTION is (b) rwxrwxrwx

The BEST I can explain: The DEFAULT PERMISSION set for an ordinary file is rwxrwxrwx i.e. it is READABLE, writable, executable by owner, group members and others.

23.

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 directoryThe question was posed to me during an online interview.My doubt stems from File Ownership and Permissions topic in section Basic File Attributes of Unix

Answer»

Right answer is (d) permission to search or navigate through the directory

Best EXPLANATION: Executing a directory does not make any sense, execute permission simply means that a USER can “pass through” the directory while searching for subdirectories. When we USE pathname with any command we should have execute permission for each of the directories involved in the COMPLETE pathname. For example,

24.

Which of the following is default permission set for ordinary files?(a) rw-rw-rw-(b) rwxrwxrwx(c) r–r–r–(d) rw-rw-rwxThis question was addressed to me by my college director while I was bunking the class.This key question is from File Ownership and Permissions in section Basic File Attributes of Unix

Answer» RIGHT OPTION is (a) rw-rw-rw-

Best explanation: The default permission SET for an ordinary file is rw-rw-rw i.e. it is readable and writable by owner, group MEMBER and others.
25.

If the file is write-protected and the directory has to write permission then we cannot delete the file.(a) True(b) FalseI had been asked this question in unit test.My doubt is from File Ownership and Permissions topic in portion Basic File Attributes of Unix

Answer»

Correct choice is (b) False

To explain I WOULD say: The term ‘WRITE-protected’ has a LIMITED meaning in the UNIX file system. A file which is write protected cannot be written, but it can be REMOVED if the DIRECTORY has to write permission.

26.

If a file is read protected, we can write to the file.(a) True(b) FalseThe question was asked in an online quiz.This is a very interesting question from File Ownership and Permissions topic in section Basic File Attributes of Unix

Answer» RIGHT answer is (b) False

The best explanation: If a file is not readable then it is OBVIOUS that we cannot write anything to the file. To write anything to a file it should be readable FIRST. But if a file is writable then we can READ the file easily but the reverse is not TRUE.
27.

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 itI got this question in homework.My enquiry is from File Ownership and Permissions in chapter Basic File Attributes of Unix

Answer»

Correct OPTION is (d) we can ADD or remove FILES to it

The explanation is: The write permission of a DIRECTORY does not imply that we can write to the directory. Only kernel is allowed to do that. It simply means that we can create or remove files from the directory.

28.

A file has permissions as rwx r– —. A user other than the owner cannot edit the file.(a) True(b) FalseThe question was asked in class test.The doubt is from File Ownership and Permissions topic in division Basic File Attributes of Unix

Answer»

The CORRECT ANSWER is (a) True

Explanation: Since the second and THIRD group of permissions of a FILE are r–and — respectively. So the file is only readable and that too, only by the MEMBERS of the group to which the file belongs.

29.

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 fileThe question was posed to me during an internship interview.This interesting question is from File Ownership and Permissions in portion Basic File Attributes of Unix

Answer»

The CORRECT choice is (a) group of users who can access the file

The best I can explain: When the system ADMINISTRATOR creates a user account, he assigns the user two parameters; UID (user ID) and GID (group ID). Group id denotes the group to which the user belongs.

In SIMPLE WORDS, group ownership defines the group to which the file is accessible.

30.

When we create a file, we are the owner of a file.(a) True(b) FalseThe question was posed to me in an interview.My query is from File Ownership and Permissions topic in section Basic File Attributes of Unix

Answer»

Correct answer is (a) True

Explanation: In most cases, the user which creates the file is REGARDED as owner of the file. The owner of the file can create, DELETE or edit the file or he can change the permissions ASSOCIATED with it.

31.

Which of the following symbol is used to indicate the absence of a permission of a file?(a) $(b) &(c) +(d) –The question was asked during an interview.I want to ask this question from File Ownership and Permissions in division Basic File Attributes of Unix

Answer»

Correct CHOICE is (d) –

Explanation: ( – ) is used to indicate the ABSENCE of a single or set of permissions of a file. For example, if a file has all the three permissions for owner but is only READABLE by group members and others, then the set of permissions WOULD be,

32.

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,wI had been asked this question in unit test.Asked question is from File Ownership and Permissions in section Basic File Attributes of Unix

Answer»

The correct OPTION is (a) r,w,x

For EXPLANATION: A file can have THREE types of permissions; read, WRITE and EXECUTE which is represented by characters r, w and x respectively.

33.

A file can be recognized as an ordinary file or directory by ____ symbol.(a) $(b) –(c) *(d) /I have been asked this question in an interview for internship.This intriguing question comes from File Ownership and Permissions in division Basic File Attributes of Unix

Answer»

The correct option is (B) –

For explanation: When LS COMMAND is used with -l option its displays attributes of a file in the multi-columnar FORM. The first column defines the file types and permissions associated with a file. If the permissions are preceded by a (-), then it is an ordinary file OTHERWISE it is a directory.

34.

How many types of permissions a file has in UNIX?(a) 1(b) 2(c) 3(d) 4This question was addressed to me in semester exam.This key question is from File Ownership and Permissions topic in chapter Basic File Attributes of Unix

Answer»

Correct option is (c) 3

To explain: In UNIX system, a file can have three TYPES of PERMISSIONS -read, write and execute. Read permission means that the file is readable. Write permission means that the file can be EDITED while executing permission (for a DIRECTORY) means that we can “pass through” the directory file for searching subdirectories.

35.

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(c) 2048(d) 4096I had been asked this question by my college professor while I was bunking the class.I would like to ask this question from Listing File and Directory Attributes in section Basic File Attributes of Unix

Answer»

The correct choice is (C) 2048

Explanation: SINE files are written to the disk in terms of BLOCK SIZE, the size consumed by the file vary from the original size of the file. Suppose, if a file size is 800 bytes but the block size on the system is 1024 bytes, then that file will consume 1024 bytes on diskspace i.e. 1 block.

36.

File attributes are of major concern as compared to directory attributes while performing operations on file system.(a) True(b) FalseThe question was asked by my school teacher while I was bunking the class.My query is from Listing File and Directory Attributes in section Basic File Attributes of Unix

Answer»

Correct answer is (B) False

Easy explanation: Directory attributes are of major concern as compared to FILE attributes when PERFORMING any operation on file system because files are a part of directory or we can say that files are stored under the directory in the directory TREE. So if directory attributes does not ALLOW us to perform a particular operation on the directory than that operation can never be performed on the file which is stored inside that directory.

37.

Which option is used with ls command to list the directory attributes rather than its contents?(a) -b(b) -a(c) -l(d) -dThe question was asked in homework.Enquiry is from Listing File and Directory Attributes topic in division Basic File Attributes of Unix

Answer»

Correct choice is (d) -d

For explanation: LS command when combined with -d OPTION DISPLAYS the attributes of a directory RATHER than its contents.

38.

Soft linked files are provided with different inode number as the original one.(a) True(b) FalseThe question was asked during an interview.I need to ask this question from Listing File and Directory Attributes in chapter Basic File Attributes of Unix

Answer»

The correct CHOICE is (a) True

Explanation: Soft linked FILES are PROVIDED with a separate inode number each of which points to the original FILE location.

39.

Hard linked files are provided with the same inode number as the original one.(a) True(b) FalseThe question was asked in homework.This intriguing question comes from Listing File and Directory Attributes in division Basic File Attributes of Unix

Answer»

Correct OPTION is (a) True

Easy explanation: Hard linked FILES are provided with the same INODE number as the ORIGINAL file so they refer to the same physical LOCATION of the file.

40.

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 directoryThe question was asked in a job interview.The origin of the question is Listing File and Directory Attributes in section Basic File Attributes of Unix

Answer» CORRECT ANSWER is (a) NUMBER of filenames of a single file that are maintained by the system

The explanation is: Links are defined as the number of filenames of a single file that are maintained by the system. This file can be accessed through as MANY filenames as there is a number of links to that file.
41.

In how many categories are links divided?(a) 1(b) 2(c) 4(d) 0I have been asked this question in an online quiz.My doubt stems from Listing File and Directory Attributes topic in portion Basic File Attributes of Unix

Answer»

Correct answer is (b) 2

For explanation I would say: There are basically two types of links; HARD LINK and soft links.

42.

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 fileThe question was posed to me in an interview for internship.This question is from Listing File and Directory Attributes in portion Basic File Attributes of Unix

Answer»

Right option is (d) word count of file

To elaborate: When -l option is used with ls command it simply displays seven attributes of a file which are file type and permissions, LINKS, OWNERSHIP, group ownership, file SIZE, last MODIFICATION time, filename.

43.

Which command is used to list the attributes of a file?(a) cp(b) list(c) ls(d) attrThis question was posed to me in unit test.I need to ask this question from Listing File and Directory Attributes topic in portion Basic File Attributes of Unix

Answer»

The CORRECT option is (C) ls

The EXPLANATION is: ls command is used for listing the attributes of a file or directory. ls command when used with -L displays all the seven attributes of a file.

44.

An attribute is a specification of an object that defines its property.(a) True(b) FalseI had been asked this question by my school teacher while I was bunking the class.This is a very interesting question from Listing File and Directory Attributes in portion Basic File Attributes of Unix

Answer»

Right ANSWER is (a) True

Best explanation: An attribute DEFINES the PROPERTY of an object. In UNIX, every file has a set of ATTRIBUTES which defines the specification of the file.