Java and Python Basics: MCQ questions with answers
CS Fundamentals (Placement), Unit 13. 60 Java and Python Basics questions with explanations (CS Fundamentals (Placement)). Topics: Java and Python Basics. Take a free test now.
Topics
- Java and Python Basics: python, java string, list range, java class, objects, arraylist, exceptions, import
Key terms: python, java string, list range, java class, objects, arraylist
Sample questions with answers
To use ArrayList in Java, import:
Options: A) java.io.* B) java.util.* C) java.net.* D) java.lang.Math
Answer: B) java.util.*. Collections are in java.util.
A Python dictionary stores:
Options: A) Only numbers B) Key–value pairs C) Ordered duplicates only D) Functions only
Answer: B) Key–value pairs. Mapping type.
Python: 3 in [1, 2, 3] gives:
Options: A) False B) True C) 3 D) Error
Answer: B) True. Membership test.