Learn about Hadoop FS shell commands, file operations (ls, cp, mv, rm), file permissions, and managing files in HDFS. This set of 30 MCQs will sharpen your HDFS command knowledge.
Introduction to Hadoop FS Shell (Questions 1-8)
What does the Hadoop FS Shell command allow you to do? a) View files in a local file system b) Perform file operations in Hadoop HDFS c) Monitor network traffic d) Set permissions for files
Which command is used to interact with HDFS through the Hadoop FS shell? a) hadoop fs -ls b) hadoop shell -fs c) hdfs -cmd d) hadoop -fs
In Hadoop, what is the main purpose of the FS Shell? a) Manage hardware resources b) Perform file system operations on HDFS c) Run Java applications d) Manage data processing tasks
Which of the following does the command hadoop fs -cat do? a) Creates a file b) Displays the contents of a file c) Deletes a file d) Moves a file
What is the use of the hadoop fs -put command? a) Deletes files from HDFS b) Copies a local file to HDFS c) Creates directories in HDFS d) Lists files in HDFS
How do you view the help documentation for a specific FS command in Hadoop? a) hadoop fs -help <command> b) hadoop fs -manual c) hdfs fs -info d) hadoop fs -guide
What does the command hadoop fs -du display? a) Directory contents b) Disk usage of files and directories c) File permissions d) Ownership details
How would you list files and directories in HDFS using the Hadoop FS Shell? a) hadoop fs -ls b) hadoop fs -list c) hdfs -ls d) hadoop fs -dir
Commands for File Operations (Questions 9-16)
Which command in Hadoop is used to copy files from local to HDFS? a) hadoop fs -move b) hadoop fs -copyFromLocal c) hadoop fs -putLocal d) hadoop fs -transfer
What does the hadoop fs -cp command do? a) Copies files from one HDFS location to another b) Creates directories in HDFS c) Copies local files to HDFS d) Changes file ownership
How would you move a file from one directory to another in HDFS? a) hadoop fs -moveFromLocal b) hadoop fs -move c) hadoop fs -mv d) hdfs fs -move
Which command removes files or directories in HDFS? a) hadoop fs -delete b) hadoop fs -rm c) hadoop fs -rmdir d) hdfs fs -remove
What happens if you try to use hadoop fs -rm on a non-empty directory? a) It removes all contents recursively b) It will display an error and not delete the directory c) It skips the directory d) It moves the contents to trash
What is the difference between hadoop fs -rm and hadoop fs -rmr? a) -rmr removes directories recursively, -rm does not b) -rm removes directories, -rmr only removes files c) -rm is for files, -rmr is for directories d) There is no difference
Which of the following commands copies an HDFS file to the local file system? a) hadoop fs -copyToLocal b) hadoop fs -download c) hadoop fs -localCopy d) hadoop fs -moveToLocal
How do you rename a file or directory in HDFS? a) hadoop fs -rename b) hadoop fs -move c) hadoop fs -renameFile d) hadoop fs -mv
File Permissions and Ownership (Questions 17-22)
Which command is used to change the owner of a file in HDFS? a) hadoop fs -chown b) hadoop fs -chmod c) hadoop fs -setOwner d) hdfs fs -chown
How do you modify file permissions in HDFS? a) hadoop fs -changeMode b) hadoop fs -chmod c) hadoop fs -permission d) hdfs fs -chmod
What does the hadoop fs -chmod 755 command do to a file in HDFS? a) Grants full permissions to the owner, and read and execute permissions to others b) Revokes all permissions c) Grants read and write permissions to the owner d) Sets execute permission for all users
Which command would you use to check the permissions of a file in HDFS? a) hadoop fs -ls b) hadoop fs -status c) hadoop fs -perm d) hadoop fs -permStatus
What does the hadoop fs -chown command modify in HDFS? a) File content b) File owner and group c) File permissions d) File path
In Hadoop, which part of the file system determines who can read, write, and execute a file? a) HDFS block size b) File permissions c) File metadata d) File system root
Viewing and Managing Files in HDFS (Questions 23-30)
Which command in Hadoop FS shell displays detailed information about files in HDFS? a) hadoop fs -info b) hadoop fs -stat c) hadoop fs -details d) hadoop fs -fileinfo
Which command lists the directory content in HDFS with detailed information? a) hadoop fs -dir b) hadoop fs -ls -R c) hadoop fs -ls -l d) hadoop fs -info -list
What does the hadoop fs -tail command do? a) Displays the first few lines of a file b) Displays the last part of a file c) Deletes the last part of a file d) Renames the last file in the directory
What would you use hadoop fs -du -s for in HDFS? a) Display the disk usage of a specific file b) Display the total disk usage of a directory c) Display the usage of a file or directory recursively d) Display the file owner and permissions
How would you view the contents of a file stored in HDFS? a) hadoop fs -view b) hadoop fs -cat c) hadoop fs -read d) hadoop fs -list
Which command shows the size of a file in HDFS? a) hadoop fs -size b) hadoop fs -du c) hadoop fs -df d) hadoop fs -length
What command allows you to move a file in HDFS? a) hadoop fs -move b) hadoop fs -rename c) hadoop fs -mv d) hadoop fs -copy
Which of the following commands will recursively delete a directory and all its contents in HDFS? a) hadoop fs -rm b) hadoop fs -rm -r c) hadoop fs -delete -r d) hadoop fs -del -r
Answer Key
QNo
Answer (Option with Text)
1
b) Perform file operations on HDFS
2
a) hadoop fs -ls
3
b) Perform file system operations on HDFS
4
b) Displays the contents of a file
5
b) Copies a local file to HDFS
6
a) hadoop fs -help <command>
7
b) Disk usage of files and directories
8
a) hadoop fs -ls
9
b) hadoop fs -copyFromLocal
10
a) Copies files from one HDFS location to another
11
c) hadoop fs -mv
12
b) hadoop fs -rm
13
b) It will display an error and not delete the directory
14
a) -rmr removes directories recursively, -rm does not
15
a) hadoop fs -copyToLocal
16
d) hadoop fs -mv
17
a) hadoop fs -chown
18
b) hadoop fs -chmod
19
a) Grants full permissions to the owner, and read and execute permissions to others