0
0
Hadoopdata~20 mins

HDFS command line interface in Hadoop - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
HDFS CLI Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this HDFS command?
Given the HDFS command hdfs dfs -ls /user/hadoop, what will it display?
Hadoop
hdfs dfs -ls /user/hadoop
ALists all files and directories inside /user/hadoop with details like permissions, owner, size, and modification date.
BDeletes the directory /user/hadoop and all its contents.
CCreates a new directory named /user/hadoop.
DDisplays the content of the file /user/hadoop.
Attempts:
2 left
💡 Hint
The command uses '-ls' which is similar to the Unix 'ls' command but for HDFS.
data_output
intermediate
2:00remaining
What is the result of this HDFS command?
What will be the result of running hdfs dfs -mkdir /user/hadoop/newdir if the directory already exists?
Hadoop
hdfs dfs -mkdir /user/hadoop/newdir
AThe command silently ignores and does nothing.
BThe directory is overwritten with a new empty directory.
CThe command creates a new directory inside /user/hadoop/newdir.
DAn error message indicating the directory already exists.
Attempts:
2 left
💡 Hint
Think about what happens when you try to create a directory that already exists in HDFS.
🔧 Debug
advanced
2:00remaining
Identify the error in this HDFS command
What error will this command produce? hdfs dfs -put localfile.txt /user/hadoop/ when localfile.txt does not exist locally.
Hadoop
hdfs dfs -put localfile.txt /user/hadoop/
APermission denied error on HDFS directory.
BFileNotFoundException: localfile.txt (No such file or directory)
CCommand runs successfully and uploads an empty file.
DSyntax error due to missing arguments.
Attempts:
2 left
💡 Hint
The command tries to upload a file that does not exist locally.
🧠 Conceptual
advanced
2:00remaining
What does the HDFS command hdfs dfs -du -h /user/hadoop show?
Choose the correct description of the output of hdfs dfs -du -h /user/hadoop.
ADisplays the disk usage of files and directories in /user/hadoop in human-readable format.
BDisplays the content of all files in /user/hadoop.
CDeletes all files in /user/hadoop and shows confirmation.
DShows the replication factor of files in /user/hadoop.
Attempts:
2 left
💡 Hint
The '-du' option is similar to Unix 'du' command but for HDFS.
🚀 Application
expert
3:00remaining
Which command sequence correctly copies a local directory to HDFS and verifies the copy?
You want to copy a local directory data/ to HDFS path /user/hadoop/data/ and then list the contents to verify. Which sequence of commands is correct?
Ahdfs dfs -put data /user/hadoop/data && hdfs dfs -ls /user/hadoop/data
Bhdfs dfs -copyFromLocal data /user/hadoop/data && hdfs dfs -cat /user/hadoop/data
Chdfs dfs -mkdir /user/hadoop/data && hdfs dfs -put data /user/hadoop/data && hdfs dfs -ls /user/hadoop/data
Dhdfs dfs -get data /user/hadoop/data && hdfs dfs -ls /user/hadoop/data
Attempts:
2 left
💡 Hint
Remember that the target directory must exist before copying if you want to keep the directory structure.