Plus One Computer Application Chapter Wise Previous Questions Chapter 4 Getting Started with C++

Kerala Plus One Computer Application Chapter Wise Previous Questions Chapter 4 Getting Started with C++

Question 1.

Mention the purpose of tokens in C++. Write names of any four tokens in C++. (March – 2015)

Answer:

Token : It is the smallest individual units similar to a word in English or Malayalam language. C++ has 5 tokens.

  • Keywords
  • Identifier
  • Literals (Constants)
  • Punctuators
  • Operators

Question 2.

The following are some invalid identifiers. Specify its reason. (Say – 2015)

a) Sum of digits

b) 1 year

c) First jan

d) For

Answer:

a) Sum of digits → space not allowed hence it is invalid

b) 1 year → First character must be an alphabet hence it is invalid

c) First. jan → special characters such as dot (.) not allowed hence it is invalid.

d) For – It is valid. That is it is not the key word for

Question 3.

Some of the literals in C++ are given below. How do they differ? (5, ‘5’, 5.0, “5”) (Say – 2015)

Answer:

5 – integer literal

‘5’ – Character literal

5.0 – floating point literal

“5” – string literal

Question 4.

Which one of the following is a user-defined name? (Say – 2016)

a) Key-word

b) Identifier

c) Escape sequences

d) All of these

Answer:

b) Identifier

Question 5.

Identify whether the following are valid identifiers or not? If not give the reason. (Say – 2016)

a) Break

b) Simple.interest

a) Break – It is valid( break is the keyword, not Break);

b) Simple. interest – It is not valid, because dot(.) is used.

Question 6.

Identify the invalid literals from the following and write a reason for each: (March – 2017)

a) 2E3.5

b) “9”

c) ‘hello’

d) 55450

Answer:

a) Invalid, because exponent part should not be a floating-point number

b) valid

Plus One Computer Application Chapter Wise Previous Questions

You might also like

Comments are closed.