Pageviews

Thursday 29 August 2019

+1] 4. Getting Started With C++/Introduction to C++ Programming - Previous Questions chapter wise



               PLUS ONE COMPUTER APPLICATION/COMPUTER SCIENCE

            First Year Computer Application(Commerce) Previous Questions Chapter wise ..


                                         Chapter  4. Getting Started With  C++(For CA)

                                          Chapter 5 Introduction to C++ programming (for CS)



1.  Which header file is responsible for cout and cin objects ? 

    <iostream>

2.  C++ uses the ..........  language processor for translation. 

      Ans. IDE

3.  .. …..  ..are tokens that never change their values while execution takes place.

     Ans. Constants/ Literals

4.  IDE stands for  … …. …. … … 

    Ans. Integrated Development Environment

5.  Identify and classify the different tokens in the following C++ statement.  Age = 18;

Ans:  age : identifier      =:  operator    18 : Literal    ; : Punctuator 

6. Explain the rules for naming identifiers
  • Identifier is an arbitrary long sequence of letters, digits and underscores( _ )
  • The first character must be a letter or underscore ( _ ).
  • White space and special characters are not allowed. 
  •  Keywords cannot be used as identifiers. 
  •  Upper and lower case letters are treated differently, i.e. C++ is case sensitive


7. The following are invalid identifiers in C++. Write a reason for each


  a) Id#

 b) void

c) 2ab

 d) avg hgt

8.  Define tokens in C++. List ant four types of tokens

         The term ‘token’ in the C++ language is similar to the term ‘word’ in natural languages. Tokens are the fundamental building blocks of the program. They are also known as lexical units. C++ has five types of tokens as listed below:

 1. Keywords 2. Identifiers 3. Literals 4. Punctuators 5. Operators

9. a). What is a token in C++ ?     

   b). Distinguish between keywords and identifiers

Ans. The term ‘token’ in the C++ language is similar to the term ‘word’ in natural languages. Tokens are the fundamental building blocks of the program.

b.  Identifiers are the user-defined words that are used to name different program elements such as memory locations, statements, functions, objects, classes etc. The identifiers of memory locations are called variables. The identifiers assigned to statements are called labels. The identifiers used to refer a set of statements are called function names.

      The words (tokens) that convey a specific meaning to the language compiler are called keywords. These are also known as reserved words as they are reserved by the language for special purposes and cannot be redefined for any other purposes. The set of 48 keywords