arrow
arrow
arrow
The number of tokens in the following line: for i in range (begin : end : step) : is:
Question



The number of tokens in the following line:
for i in range (begin : end : step) :
is:

A.

4

B.

7

C.

8

D.

12

Correct option is D


A token is a sequence of characters that are grouped together as a meaningful symbol in programming languages. Here is the breakdown of tokens in the given line:
for i in range (begin : end : step) :
1. for (keyword)
2. i (identifier)
3. in (keyword)
4. range (identifier)
5. ( (left parenthesis)
6. begin (identifier)
7. : (colon)
8. end (identifier)
9. : (colon)
10. step (identifier)
11. ) (right parenthesis)
12. : (colon)
Each of these is a separate token. Counting all these, we get a total of 12 tokens.

Free Tests

Free
Must Attempt

Basics of Education: Pedagogy, Andragogy, and Hutagogy

languageIcon English
  • pdpQsnIcon10 Questions
  • pdpsheetsIcon20 Marks
  • timerIcon12 Mins
languageIcon English
Free
Must Attempt

UGC NET Paper 1 Mock Test 1

languageIcon English
  • pdpQsnIcon50 Questions
  • pdpsheetsIcon100 Marks
  • timerIcon60 Mins
languageIcon English
Free
Must Attempt

Basics of Education: Pedagogy, Andragogy, and Hutagogy

languageIcon English
  • pdpQsnIcon10 Questions
  • pdpsheetsIcon20 Marks
  • timerIcon12 Mins
languageIcon English
test-prime-package

Access ‘UGC NET Computer Science’ Mock Tests with

  • 60000+ Mocks and Previous Year Papers
  • Unlimited Re-Attempts
  • Personalised Report Card
  • 500% Refund on Final Selection
  • Largest Community
students-icon
354k+ students have already unlocked exclusive benefits with Test Prime!
Our Plans
Monthsup-arrow