Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
2 Assuming that you have the right to change permissions for existing file food.txt, after which of
the following commands you can be sure that its permissions are:- for the owner: at least readable
and executable- for the group: at least readable- for the others: at least readable
a,b,c
a. chmod u+rx,g+r,o+r food.txt
b. chmod 544 food.txt
c. chmod 755 food.txt
d. chmod u+r,g+r,o+r food.txt
3. Assuming file USP.txt exists and you can read it, the output of which of the following commands
contains the string USP.txt?
B,c,d
a. wc < USP.txt
b. wc USP.txt
c. wc -lwc USP.txt
d. wc USP.txt | cat
4 When you request the execution of a command on the command line by its filename, where does
the system certainly look for it?
C (b)
a. In extreme cases, searching the whole hard disk might be deemed necessary. Fortunately for
performance, this does not occur very often.
b. In system directories such as /bin, /usr/bin and /usr/local/bin.
c. In the list of directories specified in the environment variable PATH.
d. In your current directory.
5 Assuming shell variable LANGUAGE is currently assigned with value C, which of the following
commands assign it with value C++?
A,c,d
a. LANGUAGE='C++'
b. LANGUAGE='$LANGUAGE'++
c. LANGUAGE=`echo C++`
d. LANGUAGE=${LANGUAGE}++
6 Command ls is used to list directory contents. Which of the following statements are true,
provided directories exist and all relevant permissions apply?
A,d (a c d)
a. Command ls * lists all filenames in the current directory.
b. Command ls dir/* changes the current directory to dir and lists all filenames in it.
c. Command ls dir/* lists all filenames in directory dir, each preceded by string dir/.
d. Command ls `pwd`/* lists all filenames in the current directory as absolute pathnames.
8 Command ls -i shows all i-node numbers and corresponding filenames in the current directory.
Which of the following statements are true?
B
a. The same filename can appear twice.
b. The same i-node number can appear multiple times.
c. The i-node numbers must all be contiguous (such as N, N+1, N+2 etc, with N an arbitrary
integer).
9 Assuming that a file system uses:- file blocks of 1024 B each;- block addresses of 4 B each;- i-
nodes with 12 direct links, 1 singly-indirect link, 1 doubly-indirect link, 1 triply-indirect link.What
links of an i-node are used for a file which is only 14 KB in size?
A
a. The 12 direct links and the singly-indirect link.
b. 2 direct links.
c. 14 direct links.
d. The 12 direct links, the singly-indirect link and the doubly-indirect link.
10 Assuming that a file system uses:- file blocks of 1024 B each;- block addresses of 4 B each;- i-
nodes with 12 direct links, 1 singly-indirect link, 1 doubly-indirect link, 1 triply-indirect link.Which
of the following statements are true?
Ace
a. The maximum size allowed by the singly-indirect link alone is 256 * 1024 = 256 KB.
b. The maximum size allowed by the singly-indirect link alone is 1024 * 4 KB = 4MB.
c. The maximum size allowed by 12 direct links alone is 12 * 1024 = 12 KB.
d. The maximum size allowed by the singly-indirect link alone is 256 * 1024 + 12 * 1024 = 268
KB.
e. The maximum size allowed by the doubly-indirect link alone is 256 * 256 * 1024 = 64 MB.
11 Assuming that filename cat does not exist in the current directory and that you have permissions
to create it, how many links exist to the i-node of filename leopard after the following commands?
touch cat ...> 1
ln cat tiger ...>2
ln tiger lion ...>3
ln lion leopard ...>4
C
a. 3
b. 1
c. 4
d. 2
12 Assuming that file food.txt has 32 lines and cannot be read by you, what do you expect to see on
your screen when command cat < food.txt | head -12 is executed?
A
a. The error message: "bash: food.txt: Permission denied".
b. 12.
c. Nothing, because of the piping with the head command.
d. The first twelve lines of the file.
13 Assuming file food.txt exists and you have all sorts of permissions, upon execution of command
head -6 < food.txt >> essentials.txt
A,c
a. If file essentials.txt did not exist, it is created and the first 6 lines of food.txt are stored into it.
b. If file essentials.txt existed, its content is deleted before execution of command head.
c. The first 6 lines of food.txt are appended at the end of file essentials.txt, if it existed.
d. If file essentials.txt did not exist, the first 6 lines of food.txt are displayed on the screen.
15 Given the alphabet {a, b, c, d, 1, 2, 3}, the following are languages over it:
(a c)
a. This set of strings (comma is the separator): {a, ab, abb, abba}.
b. This set of strings (comma is the separator): {a, az, za, z}.
c. This set of strings (comma is the separator): {a, b, 1}.
d. The empty set.
19 If file test.txt in the current directory is readable by you and has the following content:
abd
d
aaaaabbbdddddd
aaaddddddddddd
aaaaaaaaaaaaaab
cccaaaacd
command egrep '[ab]+d' test.txt outputs the following lines only:
C(b
a. Lines:
d
abd
aaaaabbbdddddd
aaaddddddddddd
b. Lines:
abd
c. Lines:
abd
aaaaabbbdddddd
aaaddddddddddd
20 Which of the following statements about the grep command are true?
B,c
a. Command grep with option -F interprets regular expressions.
b. Command grep with option -l prints names of argument files where matches have occurred.
c. Command: grep abc food.txt prints all the lines of food.txt containing string abc at least once.
d. Command: grep -c abc food.txt will give an error message as not enough files have been
specified.
==============================
1 Which of the following are examples of absolute pathnames?
A,b,e
a. /usr/local/bin
b. /home/massimo/.login
c. ./myscript
d. ..
e. /
2 Assuming you have the right to change permissions for existing file food.txt, after which of the
following commands you can be sure that its permissions are:
- for the owner: readable, writable, executable
- for the group: readable, non writable, non executable
- for the others: readable, non writable, executable
a,b
a. chmod 745 food.txt
b. chmod u+rwx,g+r,g-wx,o+rx,o-w food.txt
c. chmod u+rwx,g+r,o+r food.txt
d. chmod 640 food.txt
3 Assuming file food.txt exists and you can read it, the output of which of the following commands
contains the string food.txt?
B,c
a. wc < food.txt
b. wc -c food.txt
c. wc food.txt
d. cat < food.txt | wc
e. cat food.txt | wc
4 When you request the execution of a command on the command line by its filename, where does
the system certainly look for it?
C,d
a. In extreme cases, searching the whole hard disk might be deemed necessary. Fortunately for
performance, this does not occur very often.
b. In your current directory.
c. In the list of directories specified in the environment variable PATH.
d. In system directories such as /bin, /usr/bin and /usr/local/bin.
5. Assuming shell variable MY_VAR is currently assigned with value BBA, which of the following
commands assign it with value ABBA?
A,b,c
a. MY_VAR=A`echo $MY_VAR`
b. MY_VAR=ABBA
c. MY_VAR=`echo ABBA`
d. MY_VAR=A + $MY_VAR
11 How many links exist to filename g700 after the following commands?
> g700
ln g700 g800
ln g800 g900
rm g800
Assume that you have all the necessary permissions and file g700 does not previously exist.
D (c)
a. 0
b. 1
c. 3
d. 2
12 Assuming file food.txt has 32 lines and cannot be read by you, what do you expect to see on
your screen when command
cat < food.txt | head -12
is executed?
C
a. Nothing, because of the piping with the head command.
b. 12.
c. The error message: "bash: food.txt: Permission denied".
d. The first twelve lines of the file.
13 Assuming file food.txt exists and you have all sorts of permissions, upon execution of command
head -6 < food.txt >> essentials.txt
b,d
a. If file essentials.txt existed, its content is deleted before execution of command head.
b. The first 6 lines of food.txt are appended at the end of file essentials.txt, if it existed.
c. If file essentials.txt did not exist, the first 6 lines of food.txt are displayed on the screen.
d. If file essentials.txt did not exist, it is created and the first 6 lines of food.txt are stored into it.
14 Command
echo $(($((5 + 5 - 2)) * 100 - 50))
outputs:
D
a. 400
b. 8 * 100 - 50
c. (5 + 5 - 2) * 100 - 50
d. 750
15 Given the alphabet {a, b, c, d, 1, 2, 3}, the following are languages over it:
A
a. This set of strings (comma is the separator): {a, b, c, d}.
b. This set of strings (comma is the separator): {a, aA, aaA}.
c. This set of strings (comma is the separator): {a, bb, ccc}.
d. This set of strings (comma is the separator): {a1, 1a, aa1, 1aa}.
e. The empty set.
19 Which of the following statements about the grep command are true?
D c?
a. Command: grep ?f abc food.txt is generally slower than command: grep abc food.txt.
b. Command grep with option ?f interprets regular expressions.
c. Command grep with option ?l prints names of argument files where matches have occurred.
d. Command: grep abc food.txt prints all the lines of food.txt containing string abc at least once.
2 Assuming you have the right to change permissions for existing file food.txt, after which of the
following commands you can be sure that its permissions are:
- for the owner: readable, writable, non executable
- for the group: readable, non writable, non executable
- for the others: non readable, non writable, non executable
b
a. chmod u+rw g+r food.txt
b. chmod 640 food.txt
c. chmod food.txt 640
d. chmod 755 food.txt
3 Assuming file food.txt exists and you can read it, which of the following commands includes
string food.txt as part of its output?
ac
a. wc –c food.txt
b. cat food.txt | wc
c. wc food.txt
d. wc < food.txt
4 When you request the execution of a command on the command line by its filename, where does
the system certainly look for it?
ac
a. In the list of directories specified in the environment variable PATH.
b. In extreme cases, searching the whole hard disk might be deemed necessary. Fortunately for
performance, this does not occur very often.
c. In system directories such as /bin, /usr/bin and /usr/local/bin.
d. In your current directory.
5 Which of the following bash commands add the current directory to the command path?
d
a. PATH=.:PATH
b. PATH+='.'
c. PATH=.:$PATH
d. PATH=$PATH:.
12 Assuming file food.txt has 32 lines and cannot be read by you, what do you expect to see on
your screen when command
cat < food.txt | head -6
is executed?
d
a. Nothing, because of the piping with the head command.
b. 6.
c. The first six lines of the file.
d. The error message: "bash: food.txt: Permission denied"
13 Assuming file food.txt exists and you have all sorts of permissions, upon execution of command
head -6 < food.txt >> essentials.txt
ab
a. If file essentials.txt did not exist, it is created and the first 6 lines of food.txt are stored into it.
b. The first 6 lines of food.txt are appended at the end of file essentials.txt, if it existed.
c. If file essentials.txt did not exist, the first 6 lines of food.txt are displayed on the screen.
d. If file essentials.txt existed, its content is deleted before execution of command head.
14 Command
echo $(($((3 + 21)) * 100 - 50))
outputs:
a
a. 2350
b. 1200
c. 24 * 100 - 50
d. (3 + 21) * 100 - 50
15 Given the alphabet {a, b, c, d, 1, 2, 3}, the following are languages over it:
abcd
a. {abba, cab, bad}
b. {a, b, c, d, 1, 2, 3}.
c. {a, b, c, d, 1, 2}.
d. The empty set.
18 Choose which of the following is the language generated by the regular expression
a(b U c)d
b
a. {ab, ac, bd, cd}
b. {abd, acd}
c. {a, ab, ac, bd, cd, d}
d. {ab, cd}
19 Which of the following statements about the grep command are true?
abd
a. Command grep with option –f interprets regular expressions.
b. Command grep with option –l prints names of argument files where matches have occurred.
c. Command: grep –f abc food.txt is generally slower than command: grep abc food.txt.
d. Command: grep abc food.txt prints all the lines of food.txt containing string abc at least once.