Quiz #
To answer the quiz (and check your answers), click here or scan this code:
We reproduce below the questions, for readability.
Hierarchical file system #
On most modern computers, for a given user:
- the desktop is a directory
- the desktop is the home directory
- the desktop is a sub-directory of the home directory
- the desktop is the root of the hierarchical file system
- the home directory is the root of the hierarchical file system
- the home directory may contain hidden files
- files outside of the home directory are hidden
- every file has an absolute path
- a file may have multiple absolute paths
- two files may share an absolute path
- an absolute path can contain
..
Sets #
Which of these are sets?
\( \{a, b\}\)\( (a, b) \)
\( \{a, b, a\}\)
\(\{\}\)
\( \{\{a\}\} \)
\( \{\{\}\} \)
\((())\)
\(\{()\}\)
\(((a, b))\)
\(\{(a, b)\}\)
\(\{(a, b), (c, d)\}\)
\(\{(a, b), (a, b)\}\)
\(\{(a, b), (b, a)\}\)
\(\{\{a\}, \{\}\}\)
\((\{a\}, \{\})\)
\(\{\{a\}, \{a\}\}\)
\(\{\{a\}, \{a\}, \{b\}\}\)
\(\{\{a, b\}, \{a\}\}\)
\(\{\{a, b\}, \{b, a\}\}\)
\(\{\{a, b\}, \{b, a\}, \{c\}\}\)
If $S$ is a finite set of size $n$, then the set of all subsets of $S$ has size:
- $0$
- $n/2$
- $n$
- $n^2$
- $2^n$
- $n^n$
- infinite
- I do not know the answer
Trees #
How many nodes in this picture are the root of a tree?
- $0$
- $1$
- $2$
- $3$
- $4$
- $6$
- $10$
- infinitely many
Boolean expressions
The boolean expression
!( !( !(x = 5) & y <= 2) | z < 1)
is equivalent to:
x != 5 & y > 2 & z >= 1
x != 5 & y <= 2 & z >= 1
x != 5 | y > 2 | z >= 1
x != 5 | y <= 2 | z >= 1
x = 5 | y <= 2 | z >= 1
(x != 5 | y <= 2) & z >= 1
x != 5 | (y <= 2 & z >= 1)
(x != 5 & y <= 2) | z < 1
(x = 5 & y <= 2) | z < 1
x = 5 & (y <= 2 | z < 1)
- I do not know the answer
Java #
In order to be executed, a Java program must be:
- compiled
- interpreted
- either compiled or interpreted
- both compiled and interpreted
- neither compiled nor interpreted
- I do not know the answer
What does the following Java program print?
int a = 0;
int b = 1;
myMethod(a, b);
System.out.println(a);
System.out.println(b);
void myMethod(int firstInteger, int secondInteger) {
secondInteger = firstInteger;
firstInteger = secondInteger;
System.out.println(firstInteger);
System.out.println(secondInteger);
}
- a, b, 1, 0
- a, b, 0, 0
- 1, 0, a, b
- 0, 0, a, b
- 1, 0, 1, 0
- 1, 0, 0, 1
- 0, 0, 0, 1
- 0, 0, 0, 0
- 0, 1, 1, 0
- 0, 1, 0, 0
Algorithm #
Consider the following method (written in pseudocode).
boolean myMethod(int x){
if (x == 0){
return true
}
if (x < 0){
return false
}
return myMethod(x - 3)
}
This method:
- is recursive
- may not terminate
- returns true iff x is a positive multiple of 3
- returns true iff x is a positive power of 3
- returns true iff x is a Fibonacci number
- returns true iff x is a multiple of the third Fibonacci number
- returns true iff x is a power of the third Fibonacci number
- returns true iff x is smaller than 2^3
- returns true iff x is smaller than 9
- returns true iff x is smaller than 3!