Quiz.VideoQuiz.Video
Create free quiz
Quiz.VideoQuiz.Video
Browse all quiz and flashcard tools →

Tricky Python Interview Questions

Five medium-difficulty Python coding questions designed to test key habits, core behaviors, and reasoning — answers reveal after a short pause.

Loading preview...
5 questions
6 views

Try this quiz

Play through the questions and see your score instantly

Ready to test your knowledge?

5 questions · Quick play · Instant results

Quiz Questions & Answers

Review every prompt, the correct responses, and helpful context to prep for your own run-through.

Question 1: What prints when you run: x = [1,2,3]; y = x; y.append(4); print(x)?

Show correct answer & explanation

[1, 2, 3, 4]

Lists are mutable and assignment copies the reference, so mutating y changes x too.

Question 2: Which outcome occurs for: def f(a, L=[]): L.append(a); return L; f(1); f(2)?

Show correct answer & explanation

[1, 2]

Default parameter objects are created once at definition time and persist across calls.

Question 3: Given: a = (1,2); b = (1,2); a is b evaluates to what and why?

Show correct answer & explanation

False

'is' checks identity not equality; separate tuple objects can be equal but not identical.

Question 4: What does dict.fromkeys(['a','b'], []) produce if you then append to one key's list?

Show correct answer & explanation

{'a': [val], 'b': [val]} (same shared list for both keys)

fromkeys with a mutable value sets the same object for all keys, causing shared-state bugs.

Question 5: Which behavior is correct: iterating while modifying a list you're iterating over?

Show correct answer & explanation

It leads to unexpected behavior; avoid modifying the list during iteration

Modifying a sequence during iteration changes indices and can skip or repeat elements.

Kesava jella
Kesava jella
Published May 28, 2026

Make your own quiz videos

Turn any topic into a polished video quiz — with AI-powered questions, voiceover, and animations. No video editing skills needed.

Unlimited quizzes, free to start

Create as many quizzes as you want. Describe your topic and AI builds the questions, answers, and explanations for you.

Customise everything

Pick from stunning templates, tweak colours and fonts, add your branding, and choose between vertical or landscape formats.

Export-ready videos

Download HD videos optimised for TikTok, YouTube Shorts, Instagram Reels, or full-length YouTube — one click, no editing.

Start creating — it's free

No credit card required