Dayrvia

Mixed practice

Try a selection from all five subjects and follow each explanation back to its lesson.

Practice questions

Choose an answer and move to the next question. Grade the last one to see explanations and review links.

10 questions
Q1 C What are old and *p in the next statement?
int a[] = {6, 10};
int *p = a;
int old = *p++;
Q2 C What are a and b at the end?
int a = 1, b = 4;
int *p = &a;
int **pp = &p;
*pp = &b;
**pp = 6;
Q3 C++ What value does n hold?
int n = 2;
int& r = n;
r += 4;
Q4 C++ Which pointer now owns the integer?
auto a = std::make_unique<int>(9);
auto b = std::move(a);
Q5 Java What does pick(v) return?
static String pick(Object v) { return "O"; }
static String pick(String v) { return "S"; }
// inside main
Object v = "book";
Q6 Java What is s after the blocks finish?
String s = "";
try {
    s += "1";
    Integer.parseInt("no");
    s += "2";
} catch (NumberFormatException e) {
    s += "3";
} finally {
    s += "4";
}
Q7 Python Which list is printed?
a = [3, 5, 7, 9]
print(a[:2])
Q8 Python What does a contain?
a = [[2]]
b = a.copy()
b[0].append(3)
Q9 Databases Member A has two applications and B has none. With members on the left, how many rows does a LEFT JOIN produce?
Q10 Databases How many rows satisfy WHERE score <> 0?
scores: NULL, 0, 5, 10
Original practice questions written for Dayrvia.