Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to allow network access when running a Deno script.
Deno
deno run [1] script.tsAttempts:
3 left
💡 Hint
Common Mistakes
Using --allow-read instead of --allow-net
Forgetting to add any permission flag
Using --allow-write which is for file writing
✗ Incorrect
The --allow-net flag grants network access to the Deno script.
2fill in blank
mediumComplete the code to allow network access only to example.com.
Deno
deno run --allow-net=[1] script.tsAttempts:
3 left
💡 Hint
Common Mistakes
Using a wrong domain like google.com
Not specifying any domain, which allows all
Using localhost when the task asks for example.com
✗ Incorrect
Specifying --allow-net=example.com restricts network access to example.com only.
3fill in blank
hardFix the error in the command to allow network access to both example.com and api.example.com.
Deno
deno run --allow-net=[1] script.tsAttempts:
3 left
💡 Hint
Common Mistakes
Using spaces or semicolons instead of commas
Using pipes which are invalid separators
Not separating the hosts properly
✗ Incorrect
Multiple hosts are separated by commas in --allow-net flag.
4fill in blank
hardFill both blanks to complete the command that allows network access to localhost and denies all other hosts.
Deno
deno run --allow-net=[1] script.ts # Only allow [2]
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatching the allowed host and comment
Using a different host in the comment
Allowing multiple hosts when only localhost is needed
✗ Incorrect
Using --allow-net=localhost restricts network access to localhost only.
5fill in blank
hardFill all three blanks to create a command that allows network access to api.example.com, localhost, and deno.land.
Deno
deno run --allow-net=[1],[2],[3] script.ts
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong host names
Separating hosts with spaces or other characters
Missing one or more hosts
✗ Incorrect
The --allow-net flag accepts multiple hosts separated by commas in any order.
