Font size
WorksheetsIT26210_MODULES 1-3
Total questions: 81
Worksheet time: 41mins
What is the output when the following code is entered into a Python program interpreter?
[1,2,4,5] + [3,6]
32
A user enters the commands as shown.
devasc@labvm:~/Documents$ pwd /home/devasc/Documents
devasc@labvm:~/Documents$ mv myfile.sh ../Desktop/myfile2.sh
What is the result after the mv command is entered?
A student new to Python is working in the interactive interpreter mode. The student issues the commands:
>>> ipAddress = {"R1":"10.1.1.1","R2":"10.2.2.1","R3":"10.3.3.1"}
Which data type is used to represent the variable ipAddress?
A student new to Python is working in the interactive interpreter mode. The student issues the command:
>>> ipAddress = {"R1":"10.1.1.1","R2":"10.2.2.1","R3":"10.3.3.1"}
Which Python expression can be used to retrieve the IP address of R2?
A user issues a series of Linux commands as shown.
(omitted)$ pwd
/home/devasc/labs/ansible/backups
(omitted)$ cd ../..
Which directory is the current directory after the cd command is entered?
A student new to Python is working in the interactive interpreter mode. The student issues the commands:
>>> devicenames=["RT1", "RT2", "SW1", "SW2"]
>>> hostnames=devicenames + ["RT3", "SW3"]
>>> del hostnames[3]
>>> hostnames
What is the result?
A student is learning Python in the interactive interpreter mode. The student issues the commands:
>>> y=2
>>> y*3
6
>>> 'Test'*y
What is the result?
A student is learning Python and is reviewing a Python script as follows:
aclNum = int(input("What is the IPv4 ACL number? "))
if aclNum >= 1 and aclNum <= 99:
print("This is a standard IPv4 ACL.")
elif aclNum >=100 and aclNum <= 199:
print("This is an extended IPv4 ACL.")
else:
print("This is not a standard or extended IPv4 ACL.")
Under which condition will the elif statement be evaluated?
A user issues a Linux command and the result is shown:
total 40
drwxr-xr-x 2 devasc devasc 4096 Mar 30 21:25 Desktop
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Documents
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Downloads
drwxr-xr-x 5 devasc devasc 4096 Mar 30 21:21 labs
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Music
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Pictures
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Public
drwxr-xr-x 5 devasc devasc 4096 Mar 30 21:24 snap
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Templates
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Videos
devasc@labvm:~$
Which Linux command is used to display the contents of the current directory as shown?
A student is learning Python using the interactive interpreter mode. The student issues these commands:
>>> class Uri():
... def_init__(self, host, prot):
... self.host = host
... self.prot = prot
... self.url = self.prot + "://" + self.host
>>>
Which command should the student use to create an object with one attribute being a valid URL?
A student is learning Python using the interactive interpreter mode. The student issues the commands:
>>> routers=[]
>>> switches=[]
>>> devices=["RT1", "RT2", "RT3", SW1", "SW2", "SW3"]
>>> devices=devices + ["RT4", "SW4"]
>>> for i in devices:
if "R" in i:
routers.append(i)
else: switches.append(i)
>>> switches
What is the result?
A student is learning Python in the interactive interpreter mode. The student issues the commands:
>>> devicenames = ["RT1", "RT2", "SW1", "SW2"]
>>> devicenames[-1]
What is the result?
What Linux command is used to display the contents of the current directory?
pwd
cat
ln
ls
What command is used to rename a file in a Linux system?
mv
dd
cp
rm
A user issues a Linux command and the result is shown.
total 40
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Videos
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Templates
drwxr-xr-x 5 devasc devasc 4096 Mar 30 21:24 snap
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Public
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Pictures
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Music
drwxr-xr-x 5 devasc devasc 4096 Mar 30 21:21 labs
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Downloads
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Documents
drwxr-xr-x 2 devasc devasc 4096 Mar 30 21:25 Desktop
devasc@labvm:~$
ls -l
ls -a
ls -lr
ln
A system administrator of a Linux server is searching the passwd file for the username taylor that appears at the beginning of the line. Which grep command should the administrator use?
grep taylor /etc/passwd
grep ‘.taylor’ /etc/passwd
grep ‘^taylor’ /etc/passwd
grep ‘[taylor]’ /etc/passwd
A user issues the apt-get upgrade command to update system files in a Ubuntu Linux system and receives an error message of “permission denied.” What should the user do to complete the task?
allow apt-get upgrade command.
sudo apt-get install command.
apt-get install –allow command.
sudo apt-get upgrade command.
