Skip to content
క
kagitha
/
quiz
/
python-for-java-basics
Subscribe
Index
⌘K
JAVA NOTEBOOK · QUIZ 24 · BEGINNER
Python for Java developers
QUESTION 01 / 04
What does a minimal runnable Python program need, compared with Java's class and public static void main?
A
A class with a main method, like Java
B
A def main() function, which Python calls automatically
C
Nothing extra: Python runs the file's lines from top to bottom
D
A module declaration at the top of the file
SCORE SO FAR · 0 / 0
Share this quiz ↗
What does a minimal runnable Python program need, compared with Java's class and public static void main?
— Nothing extra: Python runs the file's lines from top to bottom. Python runs a file top to bottom. print("Hello") on its own line is a complete program. No class or main method is required.
In Python, what marks the start and extent of an if block?
— A colon at the end of the line, then indented lines. A colon opens the block and the indented lines below it are the block. Indentation is part of the syntax, not just style.
Java uses overloading or a builder for optional settings. What does Python use instead?
— Default values and keyword arguments: f(text, style="bullets"). One function with default values can be called with only the arguments you want to change, passed by name. That's why SDK calls look like create(model=..., max_tokens=...).
How do you mark a field as private in a Python class?
— By convention, with a leading underscore: self._cache. Python has no access modifiers. A leading underscore tells other developers the name is internal. It's a promise, not a lock.
kagitha
Close
✕
Search everything — articles, videos, chapters, agents, books
01
AI
02
Java
03
System Design
04
Series
05
Manga
06
The Lab
07
Videos
08
Quizzes
09
Books
10
Resume