Programming Foundations Quiz
Editorial
16 questions across the Programming Foundations lessons and the section's problems: each language's traps, how recursion runs, and the warm-ups. Pick an answer to see whether it's right and why. Nothing is saved, so you can take it again.
If one trips you up, its lesson is Python for DSA, Java for DSA, C++ for DSA, JavaScript for DSA or Introduction to Recursion.
Quiz
1 / 16Multiple choice
In Python, what is
-9 // 4?Multiple choice
In Python,
grid = [[0] * 2] * 2, then grid[0][1] = 5. What is grid?Multiple choice
In Java,
Integer a = 200, b = 200;. What does a == b give?Multiple choice
In Java,
int n = 50000;. What does n * n give?Multiple choice
In C++,
string s = "";. What does s.size() - 2 print?Multiple choice
In C++, a
priority_queue<int> gets 3, 9 and 4. What is top()?Multiple choice
In JavaScript, what does
[5, 25, 100].sort() return?Multiple choice
In JavaScript,
o[1] = "a", then o["1"] = "b" on a plain object o. How many keys does o have?Multiple choice
both(n) prints n, calls both(n - 1), then prints n again; both(0) prints 0. What does both(2) print?Multiple choice
total(n) returns 0 for 0 and n + total(n - 1) otherwise. What does total(6) return?Multiple choice
down(n) calls down(n - 1) until n is 0. At its deepest, how many frames does down(5) have on the stack?Multiple choice
Is 2100 a leap year?
Multiple choice
What is 37 in binary?
Multiple choice
What is the least common multiple of 8 and 12?
Multiple choice
In a pyramid of stars with 6 rows, how many spaces start row 4?
Multiple choice
What is the fifth row of Floyd's triangle?