Problem Solving — predict the output — 257 questions
Play ▸- #1 · What is the output? console.log(2 + 3);
- #2 · What is printed? print("Hello" + " " + "World")
- #3 · What is printed? print(10 - 4 * 2)
- #4 · What is the output? console.log(10 % 3);
- #5 · What is the output? const x: number = 4; console.log(x * x);
- #6 · What is printed? print(7 > 3)
- #7 · What is the output? const ok: boolean = 5 > 2; console.log(ok);
- #8 · What is printed? print(len("apple"))
- #9 · What is the output? console.log("JS".length);
- #10 · What is the output? const arr = [1, 2, 3]; console.log(arr.length);
- #11 · What is printed? print(2 ** 3)
- #12 · What is the output? const biggest: number = Math.max(1, 9, 4); console
- #13 · What is printed? print(True and False)
- #14 · What is the output? console.log("5" + 3);
- #15 · What is the output? console.log(5 + "3");
- #16 · What is the output? const r = ("5" as any) - 3; console.log(r);
- #17 · What is printed? print("ab" * 3)
- #18 · What is printed? print(7 / 2)
- #19 · What is printed? print(7 // 2)
- #20 · What is the output? console.log(typeof 42);
- #21 · What is the output? console.log(typeof "hi");
- #22 · What is printed? print(10 % 4)
- #23 · What is the output? const s = "hello"; console.log(s.toUpperCase());
- #24 · What is printed? print(bool(0))
- #25 · What is the output? const b: boolean = Boolean(""); console.log(b);
- #26 · What is the output? console.log([1, 2, 3].join("-"));
- #27 · What is printed? print(0.1 + 0.2)
- #28 · What is the output? console.log(0.1 + 0.2 === 0.3);
- #29 · What is the output? console.log([] + []);
- #30 · What is the output? console.log(typeof null);
- #31 · What is printed? print(True + True)
- #32 · What is printed? a = [1, 2, 3] b = a b.append(4) print(a)
- #33 · What is printed? nums = [0, 1, 2, 3, 4] print(nums[1:4])
- #34 · What is printed? name = "Sam" print(f"Hi {name}, {2 + 2}")
- #35 · What is the output? const nums: number[] = [1, 2, 3]; console.log(nums
- #36 · What is the output? console.log("abc".indexOf("b"));
- #37 · What is the output? const n = 7; console.log(n % 2 === 0 ? "even" : "o
- #38 · What is printed? print(2 == 2.0)
- #39 · What is logged? for (var i = 0; i < 3; i++) { setTimeout(() => con
- #40 · What is logged? for (let i = 0; i < 3; i++) { setTimeout(() => con
- #41 · What is printed after both calls? def add(x, lst=[]): lst.append(x) return lst print
- #42 · What is the output? const xs: number[] = [1, 2, 10, 3]; console.log(xs
- #43 · What is the output? console.log(1 + 2 + "3" + 4 + 5);
- #44 · What is the output? console.log(null == undefined, null === undefined)
- #45 · What is printed? print([1, 2, 3] * 2)
- #46 · What is printed? print("hello"[::-1])
- #47 · What is the output? console.log(0.1 + 0.2);
- #48 · What is printed? print(3 * "5" if False else 2 + 3)
- #49 · What is the output? const x = [10, 20, 30]; console.log(x.reduce((a, b
- #50 · What is the output? console.log(!!"false");
- #51 · What is the output? console.log([1, 2, 3].indexOf(4));
- #52 · What is the output? console.log('5' * '2');
- #53 · What is printed? print(len({"a": 1, "b": 2, "a": 3}))
- #54 · What is printed? print(list(range(2, 10, 3)))
- #55 · What is the output? console.log(Boolean([]));
- #56 · What is printed? print(bool([]))
- #57 · What is the output? console.log([...'abc']);
- #58 · What is printed? print("ab" in "cabd")
- #59 · What is the output? console.log('abc'.slice(-2));
- #60 · What is printed? print(sorted("banana"))
- #61 · What is the output? console.log([3, 1, 20, 10].sort());
- #62 · What is printed? print(-7 // 2)
- #63 · What is printed? print(-7 % 3)
- #64 · What is the output? console.log(-7 % 3);
- #65 · What is printed? print(round(2.5), round(3.5))
- #66 · What is the output? console.log(Math.round(-0.5), Math.round(0.5));
- #67 · What is the output? console.log([1, [2, [3, [4]]]].flat());
- #68 · What is the output? console.log(Object.keys(['a', 'b']));
- #69 · What is printed? print("%d" % 3.9)
- #70 · What is printed? print(f"{3.14159:.2f}")
- #71 · What is the output? console.log([1, 2, 3, 4].slice(1, -1));
- #72 · What is logged? console.log(typeof NaN, typeof []);
- #73 · What is printed? a = [1, 2, 3] print(a[::-1], a[0:0])
- #74 · What is the output? console.log([] + {});
- #75 · What is the output? console.log([1, 2] == '1,2');
- #76 · What is printed? print(0.1 + 0.2 == 0.3, round(0.1 + 0.2, 2) == 0.3
- #77 · What is printed? print([x for x in range(5) if x % 2][-1])
- #78 · What is logged? const a = { n: 1 }; const b = { ...a }; b.n = 2; c
- #79 · What is the output? const x = ['1', '2', '3'].map(parseInt); console.l
- #80 · What is printed? d = {} d[1] = 'int' d[1.0] = 'float' d[True] = 'bo
- #81 · What is the output? console.log([1, 2, 3].reduce((a, b) => a + b));
- #82 · What is the output? console.log([1, 2, 3].join(''));
- #83 · What is logged? console.log('abc'.at(-1), [1, 2, 3].at(-1));
- #84 · What is logged? console.log(+true, +'', +'3');
- #85 · What is logged? console.log('10' > '9', 10 > 9);
- #86 · What is logged? console.log(parseInt('08'), parseInt('0x1f'), pars
- #87 · What is the output? console.log('aaa'.replace('a', 'b'));
- #88 · What is printed? print(divmod(7, 2))
- #89 · What is printed? print(ord('A'), chr(66))
- #90 · What is printed? print('5' * 3, [1, 2] * 2)
- #91 · What is printed? print('abc'[::2])
- #92 · What is printed? print(sum([True, True, False]))
- #93 · What is printed? print(tuple('ab'), list({'a': 1}))
- #94 · What is printed? print(len(range(0, 10, 3)))
- #95 · What is the output? console.log(Math.max());
- #96 · What is logged? console.log([NaN].includes(NaN), [NaN].indexOf(NaN
- #97 · What is logged? console.log((0.1 * 3).toFixed(2), typeof (1).toFix
- #98 · What is the output? console.log(new Date(2026, 0, 15).getMonth());
- #99 · What is the output? console.log('a,b,,c'.split(',').length);
- #100 · What is the output? console.log(String([1, [2, 3]]));
- #101 · What is the output? console.log([10, 9, 8].findIndex((x) => x < 9));
- #102 · What is printed? print(list(zip([1, 2, 3], [4, 5])))
- #103 · What is printed? print('a-b-c'.split('-', 1))
- #104 · What is printed? print({1, 2} | {2, 3}, {1, 2} & {2, 3})
- #105 · What is printed? print(max('apple', 'banana'))
- #106 · What is printed? print('x'.join([]), len('x'.join([])))
- #107 · What is printed? print(bin(5), hex(255))
- #108 · What is the output? const o = Object.freeze({ n: 1 }); o.n = 2; consol
- #109 · What is the output? console.log(Object.entries({ a: 1 }).flat());
- #110 · What is the output? console.log([1, 2, 3].fill(0, 1));
- #111 · What is printed? d = {'a': 1} print(d.get('b'), d.get('b', 0))
- #112 · What is printed? print(sorted([3, 1, 2], reverse=True), [3, 1, 2].s
- #113 · What is logged? console.log([] == false, [] == 0, [0] == false);
- #114 · What is logged? const re = /a/g; console.log(re.test('a'), re.test
- #115 · What is the output? function f() { try { return 1; } finally { return
- #116 · What is the output? console.log(typeof typeof 1);
- #117 · What is the output? const a = [1, 2, 3]; a.length = 1; console.log(a);
- #118 · What is the output? console.log(0.1 + 0.2 + 0.3 === 0.3 + 0.2 + 0.1);
- #119 · What is printed? a = 256 b = int('256') c = 1000 d = int('1000') pr
- #120 · What is printed? x = [1, 2, 3] y = x[:] y[0] = 9 print(x[0], x is y
- #121 · What is printed? print([x for x in 'abc'], [x for x in ''])
- #122 · What is printed? def f(n, acc=0): if n == 0: return acc return f(n
- #123 · What is printed? s = {3, 1, 2} print(sorted(s) == [1, 2, 3], list(s
- #124 · What is logged? enum Dir { Up = 1, Down } console.log(Dir.Down, Di
- #125 · What is the output? console.log([1, 2, 3].map((x, i, arr) => arr.lengt
- #126 · What is logged? let x = 0; const y = x++ + ++x; console.log(x, y);
- #127 · What is printed? print(float('inf') > 10 ** 100, int(True) + int(Tr
- #128 · What is printed? print('ab' * 0, len('ab' * 0), [] * 5)
- #129 · What is the output? const s = new Set([1, '1', 1]); console.log(s.size
- #130 · What is logged? console.log(['a', 'b'].forEach(() => {}), ['a'].ma
- #131 · What is the output? console.log(!!'false');
- #132 · What is the output? console.log([1, 2] + [3]);
- #133 · What is the output? console.log([3, 1, 2].sort());
- #134 · What is the output? console.log([1, 2, 3].join('-'));
- #135 · What is the output? console.log('abc'.at(-1));
- #136 · What is the output? console.log('5' - 2, '5' + 2);
- #137 · What is the output? console.log(Boolean(''), Boolean('0'));
- #138 · What is the output? console.log([] == false, [] === false);
- #139 · What is the output? console.log(typeof NaN);
- #140 · What is the output? const a = {}; const b = {}; console.log(a == b);
- #141 · What is printed? print(3 / 2)
- #142 · What is printed? print(3 // 2)
- #143 · What is printed? print("Hi"[::2])
- #144 · What is printed? print(bool([]), bool([0]))
- #145 · What is printed? print('ab' * 2)
- #146 · What is printed? print(len({1, 1, 2}))
- #147 · What is printed? print(list(range(0, 5, 2)))
- #148 · What is printed? a = [1, 2] b = a b.append(3) print(len(a))
- #149 · What is printed? print([1, 2, 3][::-1])
- #150 · What is printed? print(sorted({'b': 1, 'a': 2}))
- #151 · What is the output? const xs: number[] = [1, 2]; console.log(xs.length
- #152 · What is the output? console.log([1, 2, 3].slice(-1));
- #153 · What is the output? enum E { A = 1, B } console.log(E.B, E[1]);
- #154 · What is the output? console.log([1, 2, 3] + [4]);
- #155 · What is the output? console.log(typeof function () {});
- #156 · What is the output? console.log((0.1 + 0.2).toFixed(2));
- #157 · What is the output? console.log([10, 1, 5].sort());
- #158 · What is the output? print(bool('False'))
- #159 · What is the output? print(3 / 2, 3 // 2)
- #160 · What is the output? print('ab' * 3)
- #161 · What is the output? console.log([1, 2, 3].map(parseInt));
- #162 · What is the output? console.log(1 < 2 < 3, 3 > 2 > 1);
- #163 · What is the output? setTimeout(() => console.log('a'), 0); Promise.res
- #164 · What is the output? const o = { a: 1 }; const p = o; p.a = 2; console.
- #165 · What is the output? console.log([] + {}, typeof ([] + {}));
- #166 · What is the output? a = [1, 2] b = a + [3] print(a)
- #167 · What is the output? print([n * n for n in range(4)][1:3])
- #168 · What is the output? print({'a': 1} | {'a': 2, 'b': 3})
- #169 · What is the output? print(list(zip([1, 2, 3], 'ab')))
- #170 · What is the output? const arr = [1, 2, 3] as const; console.log(arr.le
- #171 · What is the output? console.log(('b' + 'a' + +'a' + 'a').toLowerCase()
- #172 · What is the output? const a = { x: 1 }; const b = { x: 1 }; console.lo
- #173 · What is the output? def f(n, acc=[]): acc.append(n) return acc f(1) pr
- #174 · What is the output? console.log('b' > 'a', 'B' > 'a');
- #175 · What is the output? console.log(1 + '1' - 1);
- #176 · What is the output? console.log('5' - 3, '5' + 3);
- #177 · What is the output? console.log(['a', 'b'].join('-'));
- #178 · What is the output? print(len('héllo'))
- #179 · What is the output? print('-'.join('abc'))
- #180 · What is the output? print(2 ** 3 ** 2)
- #181 · What is the output? print('a' in ['ab', 'a'])
- #182 · What is the output? const [a, , b] = [1, 2, 3]; console.log(a, b);
- #183 · What is the output? const o = {}; console.log(o.a?.b);
- #184 · What is the output? const s = new Set([1, 1, 2]); console.log(s.size);
- #185 · What is the output? console.log([...'abc'].length);
- #186 · What is the output? print({1, True, 1.0})
- #187 · What is the output? a = (1,) b = (1) print(type(a) is type(b))
- #188 · What is the output? print(sorted(['b', 'A', 'a']))
- #189 · What is the output? const t: [number, string] = [1, 'a']; console.log(
- #190 · What is the output? console.log([] == ![]);
- #191 · What is the output? console.log((function () { return arguments.length
- #192 · What is the output? const o = { valueOf: () => 2 }; console.log(o + 1)
- #193 · What is the output? print(sum([0.1] * 10) == 1.0)
- #194 · What is the output? x = [[0] * 2] * 2 x[0][0] = 9 print(x)
- #195 · What is the output? print(-7 // 2, -7 % 2)
- #196 · What is the output? print(list(range(10, 0, -3)))
- #197 · What is the output? console.log(Number.isInteger(5.0), Number.isIntege
- #198 · What is the output? print('a,b,c'.count(','))
- #199 · What is the output? console.log('abc'.toUpperCase().charAt(1));
- #200 · What is the output? print(abs(-3) + max(1, 4))
- #201 · What is the output? console.log([5, 10, 15].includes(10));
- #202 · What is the output? print('Py' + str(3) * 2)
- #203 · What is the output? const word: string = 'stack'; console.log(word.sli
- #204 · What is the output? print(*[1, 2, 3], sep='-')
- #205 · What is the output? console.log('a-b-c-d'.split('-', 2));
- #206 · What is the output? print(list(enumerate('ab', 1)))
- #207 · What is the output? console.log([1, 2, 3].indexOf('2'));
- #208 · What is the output? print(min([3, -5, 2], key=abs))
- #209 · What is the output? const m = new Map<string, number>([['a', 1]]); m.s
- #210 · What is the output? print(any([]), all([]))
- #211 · What is the output? function f(x?: number) { return x ?? -1; } console
- #212 · What is the output? x = 5 def f(): print(x) x = 3 f()
- #213 · What is the output? console.log([0, 1, 2].map(String).filter(Boolean))
- #214 · What is the output? let a = 1; { console.log(typeof a); let a = 2; }
- #215 · What is the output? a = [1, 2, 3] for x in a: a.remove(x) print(a)
- #216 · What is the output? g = (i * i for i in range(3)) print(sum(g), sum(g)
- #217 · What is the output? console.log(typeof class {}, typeof Symbol());
- #218 · What is the output? m := map[string]int{} m["a"]++ fmt.Println(m["a"],
- #219 · What is the output? char c = 'A'; c += 2; System.out.println(c);
- #220 · What does the query return? SELECT COALESCE(NULL, 0, 5);
- #221 · What is the output? print('banana'.replace('a', 'o', 2))
- #222 · What is the output? console.log('abc'.repeat(2).length);
- #223 · What is the output? function twice(x: number | string) { return typeof
- #224 · What is the output? for i := 0; i < 3; i++ { defer fmt.Print(i) }
- #225 · What is the output? System.out.println('a' + 'b' + "c");
- #226 · What does the final query return? CREATE TABLE t (x INT); INSERT INTO t VALUES (1),
- #227 · What is the output? d = {} d.setdefault('k', []).append(1) d.setdefaul
- #228 · What is the output? x = [1, 2, 3] x[1:2] = [7, 8, 9] print(x)
- #229 · What is the output? a = [1, 2, 3] print(a[10:], a[-10:2])
- #230 · What is the output? const m = new Map([[1, 'a']]); console.log(m.get('
- #231 · What is the output? console.log(Number(' 12 '), Number('1_000'), Numbe
- #232 · What is the output? s := []int{1, 2, 3} t := s[:2] t = append(t, 9) fm
- #233 · What is the output? Integer a = 127, b = 127; Integer c = 128, d = 128
- #234 · What is the output? int x = 5; x = x++; System.out.println(x);
- #235 · What does the final query return? CREATE TABLE t (x INT); INSERT INTO t VALUES (2),
- #236 · What is the output? console.log([...'héllo'].length, '😀'.length);
- #237 · What is the output? let s = 0; for (const k in [5, 6]) s += k; console
- #238 · What is the output? a, *b, c = [1, 2, 3, 4, 5] print(b)
- #239 · What is the output? x = 5 print(1 < x < 3, 1 < x > 3)
- #240 · What is the output? const o = { n: 1, get d() { return this.n * 2; } }
- #241 · What is the output? String s = "ab"; s.toUpperCase(); System.out.print
- #242 · What is the output? SELECT 7 / 2, 7 / 2.0;
- #243 · What is the output? function f(a: number, b = a * 2): number { return
- #244 · What is the output? nums = [1, 5, 8, 3] print([y for x in nums if (y :
- #245 · What is the output? print(len('a b'.split()), len('a b'.split(' ')))
- #246 · What is the output? d = {'a': 1, 'b': 2} del d['a'] d['a'] = 3 print(l
- #247 · What is the output? const { a = 1, b = 2 } = { a: null, b: undefined }
- #248 · What is the output? let out = ''; outer: for (let i = 0; i < 3; i++) {
- #249 · What is the output? fmt.Println(-7/2, -7%2)
- #250 · What is the output? int x = 2; String r = ""; switch (x) { case 1: r +
- #251 · What is the output? CREATE TABLE t (x INT); INSERT INTO t VALUES (2),
- #252 · What is the output? def g(): x = yield 1 yield x * 10 it = g() print(n
- #253 · What is the output? async function f() { console.log(1); await null; c
- #254 · What is the output? let n = 0; const p = null; p?.f(n++); console.log(
- #255 · What is the output? for i := range "hé!" { fmt.Print(i) }
- #256 · What is the output? List<Integer> l = new ArrayList<>(List.of(10, 20,
- #257 · What is the output? CREATE TABLE t (x INT); INSERT INTO t VALUES (1),