Quiz - Module 7: Command Line
Test your knowledge on CMD, services, and scheduled tasks!
Question 1
Which command displays the contents of a folder?
- A) cd
- B) dir
- C) copy
- D) del
See the answer
Answer: B) dir
dir lists the files and folders in the current directory.
Question 2
Which command changes the directory?
- A) dir
- B) cd
- C) copy
- D) del
See the answer
Answer: B) cd
cd (change directory) allows navigation through folders.
Question 3
How to go up to the parent folder?
- A) cd ..
- B) cd /
- C) dir ..
- D) up
See the answer
Answer: A) cd ..
cd .. goes up one level in the directory tree.
Question 4
Which command copies a file?
- A) move
- B) copy
- C) del
- D) dir
See the answer
Answer: B) copy
copy source destination copies a file.
Question 5
Which command moves or renames a file?
- A) copy
- B) move
- C) del
- D) dir
See the answer
Answer: B) move
move moves or renames files.
Question 6
Which command deletes a file?
- A) copy
- B) move
- C) del
- D) dir
See the answer
Answer: C) del
del or erase deletes files.
Question 7
Which command creates a folder?
- A) cd
- B) mkdir
- C) del
- D) copy
See the answer
Answer: B) mkdir
mkdir or md creates a new folder.
Question 8
Which command deletes an empty folder?
- A) del
- B) rmdir
- C) copy
- D) move
See the answer
Answer: B) rmdir
rmdir or rd deletes an empty folder.
Question 9
How to delete a folder with its contents?
- A) del /s
- B) rmdir /s /q
- C) copy /all
- D) move /r
See the answer
Answer: B) rmdir /s /q
rmdir /s /q deletes recursively without confirmation.
Question 10
What is a Windows service?
- A) A text file
- B) A program that runs in the background
- C) A browser
- D) A file type
See the answer
Answer: B) A program that runs in the background
Services run without a user interface.
Question 11
Which command lists the services?
- A) dir services
- B) sc query
- C) services.msc
- D) net list
See the answer
Answer: B) sc query
sc query displays the status of services.
Question 12
How to start a service in CMD?
- A) start service
- B) net start [service]
- C) run service
- D) service start
See the answer
Answer: B) net start [service]
net start ServiceName starts a service.
Question 13
How to stop a service?
- A) stop service
- B) net stop [service]
- C) kill service
- D) end service
See the answer
Answer: B) net stop [service]
net stop ServiceName stops a service.
Question 14
Which graphical console manages services?
- A) cmd.exe
- B) services.msc
- C) regedit.exe
- D) notepad.exe
See the answer
Answer: B) services.msc
services.msc opens the service manager.
Question 15
What is a scheduled task?
- A) A virus
- B) A program that runs automatically at a given time
- C) A temporary file
- D) A protocol
See the answer
Answer: B) A program that runs automatically
Scheduled tasks automate actions (backups, scripts...).
Question 16
Which console manages scheduled tasks?
- A) services.msc
- B) taskschd.msc
- C) cmd.exe
- D) notepad.exe
See the answer
Answer: B) taskschd.msc
taskschd.msc opens the Task Scheduler.
Question 17
Which command displays scheduled tasks?
- A) dir tasks
- B) schtasks /query
- C) task list
- D) schedule show
See the answer
Answer: B) schtasks /query
schtasks /query lists scheduled tasks.
Question 18
What extension do batch scripts have?
- A) .txt
- B) .bat or .cmd
- C) .exe
- D) .ps1
See the answer
Answer: B) .bat or .cmd
Batch scripts use .bat or .cmd.
Question 19
Which command displays text on the screen?
- A) print
- B) echo
- C) write
- D) display
See the answer
Answer: B) echo
echo text displays text in the console.
Question 20
How to disable command display in a script?
- A) @echo on
- B) @echo off
- C) silent
- D) quiet
See the answer
Answer: B) @echo off
@echo off hides the display of executed commands.
Question 21
How to create a pause in a batch script?
- A) stop
- B) pause
- C) wait
- D) sleep
See the answer
Answer: B) pause
pause waits for the user to press a key.
Question 22
How to access a variable in batch?
- A) $variable
- B) %variable%
- C)
{variable} - D) [variable]
See the answer
Answer: B) %variable%
Batch variables are surrounded by %.
Question 23
Which variable contains the Windows folder path?
- A) %PATH%
- B) %WINDIR%
- C) %TEMP%
- D) %HOME%
See the answer
Answer: B) %WINDIR%
%WINDIR% points to C:\Windows.
Question 24
How to redirect output to a file?
- A) command | file
- B) command > file
- C) command + file
- D) command : file
See the answer
Answer: B) command > file
> redirects output (overwrites), >> appends to the file.
Question 25
What does the pipe | do?
- A) Redirects to a file
- B) Sends the output of one command to the input of another
- C) Deletes a file
- D) Displays help
See the answer
Answer: B) Sends the output to the input of another command
The pipe allows chaining commands.
Question 26
Which command finds text in files?
- A) search
- B) find or findstr
- C) look
- D) grep
See the answer
Answer: B) find or findstr
find and findstr search for text in files.
Question 27
How to run a command as an administrator?
- A) sudo
- B) runas /user:Administrator command
- C) admin command
- D) root command
See the answer
Answer: B) runas /user:Administrator command
runas allows execution with different privileges.
Question 28
Which command displays help for a command?
- A) command /?
- B) command -help
- C) man command
- D) info command
See the answer
Answer: A) command /?
/? displays help for most CMD commands.
Question 29
How to chain commands that must all succeed?
- A) command1 | command2
- B) command1 && command2
- C) command1 ; command2
- D) command1 + command2
See the answer
Answer: B) command1 && command2
&& executes the second command only if the first succeeds.
Question 30
Which command stops a process by its PID?
- A) stop
- B) taskkill /PID [number]
- C) kill
- D) end
See the answer
Answer: B) taskkill /PID [number]
taskkill /PID 1234 stops the process with PID 1234.
Score
| Score | Level |
|---|---|
| 27-30 | Excellent! |
| 22-26 | Very good! |
| 17-21 | Good |
| 12-16 | Fair |
| 0-11 | Needs review |
Module 7 Quiz - Command Line - 30 questions