{ "@context": "https://schema.org", "@type": "Organization", "name": "Brainscape", "url": "https://www.brainscape.com/", "logo": "https://www.brainscape.com/pks/images/cms/public-views/shared/Brainscape-logo-c4e172b280b4616f7fda.svg", "sameAs": [ "https://www.facebook.com/Brainscape", "https://x.com/brainscape", "https://www.linkedin.com/company/brainscape", "https://www.instagram.com/brainscape/", "https://www.tiktok.com/@brainscapeu", "https://www.pinterest.com/brainscape/", "https://www.youtube.com/@BrainscapeNY" ], "contactPoint": { "@type": "ContactPoint", "telephone": "(929) 334-4005", "contactType": "customer service", "availableLanguage": ["English"] }, "founder": { "@type": "Person", "name": "Andrew Cohen" }, "description": "Brainscape’s spaced repetition system is proven to DOUBLE learning results! Find, make, and study flashcards online or in our mobile app. Serious learners only.", "address": { "@type": "PostalAddress", "streetAddress": "159 W 25th St, Ste 517", "addressLocality": "New York", "addressRegion": "NY", "postalCode": "10001", "addressCountry": "USA" } }

Tokens in C Flashcards

(17 cards)

1
Q

What are the types of tokens in C?

A

CSIOKS:

Constants
String literal
Identifiers
Operators
Keywords
Separators
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Constants can also be called as?

A

Literals

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the types of constants?

A

Numeric constants

Character constants

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the types of a numeric constant?

A
  1. Integers

2. Floating - point numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the rules for defining a numeric constant?

A

No commas
No spaces between the unary sign (+ and -) and the digits
Must begin and end with a digit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a character constant?

A

A single letter or number enclosed with single quotations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
Define the escape character:
'\n'
'\a'
'\b'
'\t'
'\0'
'\''
'\"'
%%
A
Newline
alert
backspace
tab
null
single quotes
double quotes
percent symbol
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a string literal?

A

A sentence or lines of texts enclosed with double quotations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are identifiers?

A

Descriptive names given to variables and constants

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a variable?

A

They store literals and can be changed during the execution of the program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the rules on creating an identifier?

A
  • It must consist of letters, numbers, and underscores
  • Cannot begin with a digit
  • An identifier defined in the C library is invalid
  • They are case sensitive
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are operators?

A

Math symbols in C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Operators follow a hierarchy like pemdas. Label the arithmetic expressions from highest to lowest and evaluate its associativity:

  • Addition and subtraction
  • Parenthesis
  • Unary signs (Positive and negative signs)
  • Multiplication, division, and modulo
A

Parenthesis - left to right
Unary signs (Positive and negative signs) - right to left
Multiplication, division, and modulo - left to right
Addition and subtraction - left to right

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What do you call a statement that stores a computation result and perform arithmetic operations in a program?

A

Arithmetic operators

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a keyword and a reserve word?

A

Keywords are reserved by the language and has a meaning to the compiler.

Reserved words are for special use and cannot be used as an identifier.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are separators?

A

They are used to separate tokens

17
Q

Identify which is not considered as a separator:

  1. comma
  2. tabs
  3. spaces
  4. colon
  5. newlines
  6. semicolon
A

Newline, spaces, and tabs