0
0
Intro to Computingfundamentals~10 mins

Folder hierarchy and paths in Intro to Computing - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to show the root folder in a file path.

Intro to Computing
root = "[1]"
Drag options to blanks, or click blank then click option'
Ausers
B/
Cdocuments
Dhome
Attempts:
3 left
💡 Hint
Common Mistakes
Using a subfolder name like 'home' or 'users' as the root folder.
Confusing the root folder with other folder names.
2fill in blank
medium

Complete the code to join folder names into a path using the correct separator.

Intro to Computing
path = "home" + [1] + "documents"
Drag options to blanks, or click blank then click option'
A/
B\\
C:
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using backslash \\ which is used in Windows paths.
Using symbols like ':' or '-' which are not folder separators.
3fill in blank
hard

Fix the error in the path string by replacing the wrong separator.

Intro to Computing
path = "C:[1]Users[1]Documents"
Drag options to blanks, or click blank then click option'
A/
B:
C-
D\\
Attempts:
3 left
💡 Hint
Common Mistakes
Using forward slash "/" in Windows paths.
Using colon ":" as a separator.
4fill in blank
hard

Fill both blanks to create a relative path from 'documents' to 'photos'.

Intro to Computing
relative_path = "[1]" + [2] + "photos"
Drag options to blanks, or click blank then click option'
A..
B/
C\\
D.
Attempts:
3 left
💡 Hint
Common Mistakes
Using "." which means current folder, not parent.
Using backslash \\ in Unix-like paths.
5fill in blank
hard

Fill all three blanks to create an absolute path to 'file.txt' inside 'downloads' folder.

Intro to Computing
absolute_path = "/[1]" + [2] + "downloads" + [3] + "file.txt"
Drag options to blanks, or click blank then click option'
Ahome
B/
Duser
Attempts:
3 left
💡 Hint
Common Mistakes
Using backslash \\ instead of forward slash "/".
Missing separators between folder names.