Python Programming — C20 DCME Fifth Semester (Board Exam Scope): 35 flashcards

All 35 flashcards from this kit, free and with no sign-up.

1. What is a variable in Python?

Show the answer

A name that refers to a value stored in memory; no explicit type declaration is needed.

2. What is dynamic typing in Python?

Show the answer

The type of a variable is determined at runtime, so the same name can later refer to a value of a different type.

3. How do declaration and initialization usually happen in Python?

Show the answer

Together, in a single assignment statement such as `x = 10`.

4. What is an operator?

Show the answer

A symbol that performs an operation on one or more operands.

5. Name the six families of Python operators.

Show the answer

Arithmetic, comparison, logical, assignment, membership, and identity.

6. What is the difference between `=` and `==`?

Show the answer

`=` assigns a value to a name; `==` compares two values for equality.

7. What does a `for` loop do?

Show the answer

It iterates over a sequence such as a list, string, or the output of `range()`.

8. What does a `while` loop do?

Show the answer

It repeats a block as long as its condition remains true.

9. What does `range(5)` produce?

Show the answer

The numbers 0, 1, 2, 3, 4 — it stops before the end value.

10. What does `range(1, 10, 2)` produce?

Show the answer

1, 3, 5, 7, 9 — the third argument is the step.

11. What does `break` do inside a loop?

Show the answer

It exits the loop immediately.

12. What does `continue` do inside a loop?

Show the answer

It skips the rest of the current iteration and jumps to the next one.

13. What does `assert` do?

Show the answer

It checks a condition and raises an error if the condition is false.

14. What is a positional argument?

Show the answer

An argument matched to a parameter by its order in the call.

15. What is a keyword argument?

Show the answer

An argument matched to a parameter by name, e.g. `greet(name="Ravi")`.

16. What is a default argument?

Show the answer

A parameter value used when the caller omits that argument.

17. What does `*args` collect?

Show the answer

Extra positional arguments, gathered into a tuple.

18. What does `**kwargs` collect?

Show the answer

Extra keyword arguments, gathered into a dictionary.

19. What is a string in Python?

Show the answer

An immutable sequence of characters.

20. Name four built-in string methods.

Show the answer

`upper()`, `lower()`, `split()`, and `join()` are four of them.

21. What does the `string` module provide?

Show the answer

Constants such as `string.ascii_letters` and `string.digits`.

22. How do lists and tuples differ?

Show the answer

Lists are mutable; tuples are ordered but immutable.

23. What is a dictionary?

Show the answer

A collection of key-value pairs in which keys are unique.

24. What is a set?

Show the answer

An unordered collection that stores no duplicates.

25. What does mutability mean?

Show the answer

An object can be changed after it is created; lists, dicts, and sets are mutable.

26. How do you clone a list?

Show the answer

Use `b = a[:]` or `b = list(a)` to create an independent copy.

27. Why does `b = a` not clone a list?

Show the answer

It only creates a second name for the same list, so changes through `b` also appear in `a`.

28. What is a class?

Show the answer

A blueprint for creating objects.

29. What is an object?

Show the answer

A specific instance of a class, with its own attributes and methods.

30. What is data hiding in Python?

Show the answer

Restricting direct access to an object's internal data, using `_name` or `__name` conventions.

31. What is the structure of exception handling?

Show the answer

`try`, `except`, `else`, and `finally` respond to runtime errors gracefully.

32. What is Python IDLE?

Show the answer

The built-in editor and shell that ships with Python.

33. How do you run a saved Python program in IDLE?

Show the answer

Save the file as `.py` and press F5.

34. What are the three parts of this exam paper?

Show the answer

Part A (3-mark short answers), Part B (8-mark explanations and programs), and Part C (one 10-mark program).

35. Which string methods help count letters and digits?

Show the answer

`.isalpha()` and `.isdigit()`, used inside a loop.

Make your own

Your notes can be a kit like these

Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free, in 42 languages.

  • Chapter notes
  • Flashcards
  • Practice MCQs
  • Scored tests
  • Exam prep

Get Veda free See what students get

Free to start · No ads · Works in 42 languages