CDCDAC Prep
PGCP-BDACMCE (CCE Modules Exam)•20 Questions

Python and R Programming Practice MCQs

Topic Covered in this Question Set

Python Syntax, Types, Input, Operators and Control Flow

Click on an option to check your answer immediately. Full solution & explanation provided for every question.

Interactive Practice Mode

Python and R Programming Free MCQs

Select an option to test your knowledge with real exam questions and instant explanations.

Total20
Correct0
Wrong0
Progress: 0 of 20 answered0% Accuracy
Q1 of 20

In Python, how is the body of an if, for or while statement marked?

Open topic in App →
Q2 of 20

What does this code print? ```python x = 10 x = "ten" print(type(x)) ```

Open topic in App →
Q3 of 20

What does print(-2

Open topic in App →
Q4 of 20

What does print(7 / 2, -7 // 2, -7 % 2) display?

Open topic in App →
Q5 of 20

What does this code print? ```python x = 5 print(1 < x < 10, 1 < x > 6) ```

Open topic in App →
Q6 of 20

What does print("" or "Guest", 0 and 5) display?

Open topic in App →
Q7 of 20

A program runs age = input("Age: ") and then print(age + 1). The user types 25. What happens?

Open topic in App →
Q8 of 20

What does print(int(-3.99), round(2.5)) display?

Open topic in App →
Q9 of 20

What does this code print? ```python a = [1, 2] b = a b.append(3) print(a, a is b) ```

Open topic in App →
Q10 of 20

What does print(type(2

Open topic in App →
Q11 of 20

What does print(list(range(10, 0, -3))) display?

Open topic in App →
Q12 of 20

What does this loop print? ```python for n in range(1, 8): if n == 5: break if n % 2 == 0: continue print(n, end=" ") ```

Open topic in App →
Q13 of 20

What does this code print? ```python for d in [3, 5, 7]: if d % 2 == 0: print("even") break else: print("none") ```

Open topic in App →
Q14 of 20

While sketching a program, a developer writes if total < 0: but has not yet decided what to do in that case. Which statement keeps the block valid and does nothing?

Open topic in App →
Q15 of 20

Which of these values is truthy when used as an if condition?

Open topic in App →
Q16 of 20

What do these two lines print? ```python print("A", "B", sep="-", end="!") print("C") ```

Open topic in App →
Q17 of 20

In the lab program that prints factorials with while f < 2_000_000_000 (starting from 0! = 1 and multiplying f by n after each print), which line is printed last?

Open topic in App →
Q18 of 20

A nested loop compares each of 1,000 customer records with each of 500 product records. How many times does the inner loop body run?

Open topic in App →
Q19 of 20

What does this code print? ```python marks = 72 if marks >= 40: print("Pass") elif marks >= 60: print("First class") else: print("Fail") ```

Open topic in App →
Q20 of 20

A cleaning script calls int("3.5") on a value read from a CSV file. What happens?

Open topic in App →
Need to review the concepts?

Read Python and R Programming Study Notes

Review complete topic notes, syntax guides, code examples, and summary tables.

Read Free Study Notes →