2026 Midterm exam exercises Q-and-A.#
March 10 2026. Time 5:40 p.m. – 9:00 p.m.
Number of exercises: 4. Each exercise has a maximum score.
In home directory of user hostadm, you need to create a new subdirectory, MIDTERM and a file within it, answers.txt, where you will be writing answers to the exam exercises.
In the file, first, put your name, then proceed with answering to the questions below.
1. VM deployment in KVM (max score 2)#
A) Create a new VMs, vmm26, by cloning kvm1.
B) Set hostname to IP address resolution for vmm26 on your VD.
Make sure you can ping vmm26 from the desktop.
Answer:
A)
virt-clone -o kvm1 -n vmm26 -f KVM/vmm26.qcow2
B) On vmm26:
ip a
On the desktop, edit file /etc/hosts and add:
/etc/hosts
192.168.122.26 vmm26
Check if we can ping vmm26 from the desktop:
ping -c 3 vmm26
2. Command apt and dpkg (max score 2)#
A) Download package qt6-networkauth-dev into directory MIDTERM on the VD.
B) Extract the package content into new directory DEB.
Answer:
A)
apt download qt6-networkauth-dev
B)
dpkg -x qt6-networkauth-dev_6.4.2-1_amd64.deb DEB
3. Command find (max score 5)#
In directory DEB,
A) Find all files with extension .json
B) Find the largest file in directory DEB.
C) Find all files of size between 5 and 6 KB.
Answer:
A)
find DEB -name "*.json"
output:
DEB/usr/lib/x86_64-linux-gnu/metatypes/qt6networkauth_none_metatypes.json
DEB/usr/share/qt6/modules/NetworkAuth.json
B)
find DEB/ -size +10k -ls
output:
DEB/usr/lib/x86_64-linux-gnu/metatypes/qt6networkauth_none_metatypes.json
ls -lh DEB/usr/lib/x86_64-linux-gnu/metatypes/qt6networkauth_none_metatypes.json
output:
-rw-r--r-- 1 hostadm hostadm 41K Jan 26 2023 DEB/usr/lib/x86_64-linux-gnu/metatypes/qt6networkauth_none_metatypes.json
find DEB/ -size +5000c -size -6000c -ls
Output:
5636 Jan 26 2023 DEB/usr/lib/x86_64-linux-gnu/cmake/Qt6NetworkAuth/Qt6NetworkAuthVersionlessTargets.cmake
5908 Jan 26 2023 DEB/usr/lib/x86_64-linux-gnu/cmake/Qt6NetworkAuth/Qt6NetworkAuthTargets.cmake
5012 Nov 24 2021 DEB/usr/share/doc/qt6-networkauth-dev/copyright
4. Commands tar and scp (max score 5)#
A) On the VD, create new directory HED.
Copy all the files with extension .h from directory DEB into directory HED.
B) Archive directory HED with tar/gzip.
C) Copy the archive onto vmm26.
D) Extract the archive on vmm26.
Answer:
A)
mkdir HEM
find DEB/ -name *.h -exec cp '{}' DEB \;
B)
tar -zcvf HEM.tgz HEM
C) On the desktop:
scp HEM.tgz vmm26:
D)
tar -zxvf HEM.tgz
5. Shell script (max score 6)#
A) In directory MIDTERM, create shell script with name find_archive_1.sh that completes exercises 4A and 4B.
B) Create a modified version of the script, find_archive_2.sh, that
takes file names as an input prameter in the command line,
if directory HED already exists, it removes its content, otherwise, creates the directory.
C) Run find_archive_2.sh for files *.json.
Answer:
A)
#!/bin/bash
mkdir HED
find DEB/ -name "*.h" -exec cp '{}' HED \;
tar -zcvf HED.tgz HED
B)
#!/bin/bash
files=$1
if [ -d HED ]
then
rm HED/*
else
mkdir HED
fi
find DEB/ -name ${files} -exec cp '{}' HED \;
tar -zcvf HED.tgz HED
C)
./find_archive_2.sh *.json
ls HD
NetworkAuth.json qt6networkauth_none_metatypes.json