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

Students can Download Chapter 4 Getting Started with C++ Questions and Answers, Plus One Computer Application Chapter Wise Questions and Answers helps you to revise the complete Kerala State Syllabus and score more marks in your examinations.

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

Plus One Computer Application Getting Started with C++ 1 Mark Questions and Answers

Question 1.
IDE means _______.
Answer:
Integrated Development Environment

Question 2.
We know that C++ is a high level language. From the following which statement is true.
a) C++ contains English like statements.
b) C++ contains mnemonics
c) C++ contains only 0 and 1
d) None of these
Answer:
a) C++ contains English like statements.

Question 3.
C++ is a language ______.
a) High level
b) Low level
c) Middle level
d) None of these
Answer:
a) High level

Question 4.
C++ was developed at ______.
a) AT & T Bell Laboratory
b) Sanjose Laboratory
c) Kansas University Lab
d) None of these
Answer:
a) At & T Bell Laboratory

Question 5.
C ++ is a successor of ______ language.
a) C#
b) C c
c) Java
d) None of these
Answer:
b) C c

Question 6.
The most adopted and popular approach to write programs is ______.
Answer:
Structured programming

Question 7.
From the following which uses OOP concept _____.
a) C
b) C++
c) Pascal
d) Fortran
Answer:
b) C++

Question 8.
______ is the smallest individual unit
Answer:
Token

Question 9.
Pick the odd one out:
a) float
b) void
c) break
d) Alvis
Answer:
d) Alvis, the others are keywords.

Question 10.
Reserved words for the compiler is _______.
a) Literals
b) Identifier
c) Key words
d) None of these
Answer:
c) Key words

Question 11.
Pick an identifier from the following
a) auto
b) age
c) float
d) double
Answer:
b) age

Question 12.
Pick the invalid identifier
a) name
b) Date of birth
c) age
d) joining time
Answer:
b) Date of birth, because it contains space.

Question 13.
Pick the octal integer from the following
a) 217
b) 0x217
c) 0217
d) None of these
Answer:
c) 0217, an octal integer precedes

Question 14.
Pick the hexa decimal integer from the following
a) 217
b) 0x217
c)0217
d) None of these
Answer:
b) 0x217, an hexa decimal integer precedes Ox

Question 15.
From the following pick a character constant
a)’A’
b)’ALL’
c)’AIM’
d) None of these
Answer:
a) ‘A’, a character enclosed between single quote

Question 16.
Non graphic symbol can be represented by using ______.
Answer:
Escape Sequence

Question 17.
Manish wants to write a program to produce a beep sound. Which escape sequence is used to get an alert (sound)
a) \a
b) \d
c) \s
d)None of these
Answer:
a)\a

Question 18.
Ajo wants to print a matter in a new line. Which escape sequence is used for this?
a) \a
b) \n
c) \s
d)None of these
Answer:
b)\n

Question 19.
To represent null character ____ is used.
a) \n
b) \0
c) \f
d) \s
Answer:
b)\0

Question 20.
State True/ False a string is automatically appended by a null-character.
Answer:
True

Question 21.
From the following pick a string constant .
a) ‘a’
b) “abc”
c) ‘abc’
d) None of these
Answer:
“abc”, a character constant must be enclosed between double quotes.

Question 22.
C++ was developed by ______.
a) Bjarne stroustrup
b) James Gosling
c) Pascal
d) None of these
Answer:
a) Bjarne stroustrup

Question 23.
From the following which is not a character constant.
а) ‘c’
b) ‘e’
c) ‘d’
d) “c”
Answer:
d) “c”, It is a string constant the others are character constant.

Question 24.
From the following which is a valid declaration.
а) int 91;
b) int x;
c) int 9x;
d) int “x”;
Answer:
b) intx

Question 25.
Symbols used to perform an operation is called _____.
a) Operand
b) Operator
c) Variable
d) None of these
Answer:
b) Operator

Question 26.
Consider the following
C = A + B. Here A and B are called ______.
a) Operand
b) Operator
c) Variable
d) None of these
Answer:
b) Operand

Question 27.
The execution of a program starts at ______ function.
Answer:
main( )

Question 28.
The execution of a program ends with ______ function.
Answer:
main( )

Question 29.
______ is used to write single line comment.
a) //
b) P
c) */
d) None of these
Answer:
a) //

Question 30.
const k=100 means
a) const float k=100
b) const double k=100
c) const int k=100
d)const char k=100
Answer:
c) const int k=100

Question 31.
Qn. 31 ,
Each and every statement in C++ must be end with ______.
a) Semi colon
b) Colon
c) full stop
d) None of these
Answer:
a) Semi colon

Question 32.
From the following select the input operator.
a)>>
b)<< c) >
d) <
Answer:
a)>>

Question 33.
From the following select the output operator.
a)>>
b)<<
c) >
d) <
Answer:
b)<<

Question 34.
From the following which is known as string terminator.
a) ‘\0’
b) ‘\a’
c) ‘\s’
d) ‘\t’
Answer:
a) ‘\0’

Question 35.
Adeline wrote a C++ program namely sum.cpp and she compiled the program successfully with no error. Some files are generated. From the following which file is a must to run the program .
a) sum.exe
b) sum.obj
c) sum.vbp
d) sum.htm
Answer:
a) sum.exe

Question 36.
Adeline wrote a C++ program namely sum.cpp and she compiled the program successfully with no error. Some files are generated namely sum.obj and sum.exe. From this which file is not needed to run the program.
Answer:
sum.obj is not needed and can be deleted.

Question 37.
From the following which is ignored by the compiler.
а) statement
b) comments
c) loops
d) None of these
Answer:
b) comments

Question 38.
To write a C++ program, from the following which statement is a must _____.
a) sum( )
b) main( )
c) #include
d) #include
Answer:
b) main( ).
A C++ program must contains at least one main( ) function.

Question 39.
State True / False .
Comment statements are ignored by the compiler.
Answer:
True .

Question 40
More-than one input / output operator in a single statement is called ________.
Answer:
Cascading of I/O operator

Question 41.
Is 0x85B a valid integer constant in C++? If yes why ?
Answer:
Yes. It is a hexa decimal number

Plus One Computer Application Getting Started with C++ 2 Marks Questions and Answers

Question 1.
Mr. Dixon declared a variable as follows int 9age. Is it a valid identifier. If not briefly explain the rules for naming an identifier.
Answer:
It is not a valid identifier because it violates the rule
1. The rules for naming an identifier is as follows.
1) It must be start with a letter(alphabet)
2) Under score can be considered as a letter
3) White spaces and-special characters cannot be used.
4) Key words cannot be considered as an identi-fier

Question 2.
How many bytes used to store ‘\a’.
Answer:
To store ‘\a’ one byte is used because it is an escape sequence. An escape sequence is treated as one character. To store one character one byte is used.

Question 3.
How many bytes used to store “\abc”.
Answer:
A string is automatically appended by a null character.
Here one byte for \a (escape sequence).
One byte for character b.
One byte for character c.
And one byte for null character.
So a total of 4 bytes needed to store this string.

Question 4.
How many bytes used to store “abc”.
Answer:
A string is automatically appended by a null character.
Here one byte for a.
One byte for character b.
One byte for character c.
And one byte for null character.
So a total of 4 bytes needed to store this string.

Question 5.
Consider the following code
{
cout<<“welcome to C++”;
}
After you compile this program there is an error called prototype error. Why it is happened? Explain
Answer:
Here we used the output operator cout<<. It is used to display a message “welcome to C++” to use this operator the corresponding header file must be included. We didn’t included the header file hence the error. .

Question 6.
In C++ the size of the string “book” is 5 and that of “book\n” is 6. Check the validity of the above statement. Justify your answer.
Answer:
A string is automatically added by a null character). The null character is treated as one character. So the size of string “book” is 5. Similarly a null character (\0) is also added to “book\n”. \n and \0 is treated as single characters. Hence the size of the string “book\n” is 6.

Question 7.
Pick the odd man out. Justify
TOTSAL, TOT_SAL, totsal5, Tot5_sal, SALTOT, tot.sal,
Answer:
tot.sal. Because it contains a special character dot(,). An identifier cannot contain a special character. So it is not an identifier. The remaining satisfies the rules of naming identifier. So they are valid identifier.

Question 8.
Write a C++ statement to print the following sentence. Justify.
“\ is a special character”
Answer:
cout<<“\\ is a special character” \\ is treated as an escape sequence.

Question 9.
A student type a C++ program and saves it in his personal folder as Sample.cpp. After getting the output of the program, he checks the folder and finds three files namely Sample.cpp, Sample.obj and Sample.exe. Write the reasons for the generation of the two files in the folder.
Answer:
After the compilation of the program sample.cpp, the operating system creates two files if there is no error. The files are one object file (sample.obj) and one executable file(sample.exe). Now the source file(sample.cpp) and object file(sample.obj) are hot needed and can be deleted. To run the program sample.exe is only needed.

Question 10. Mention the purpose of tokens in C++. Write names of any four tokens in C++.
Answer:
Token : It is the smallest individual units similar to a word in English orMalayalam language. C++ has 5 tokens.
1) Keywords
2) Identifier
3) Literals (Constants)
4) Punctuators
5) Operators

Question 11. The following are some invalid identifiers. Specify its reason.
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 12.
Some of the literals in C++ are given below. How do they differ? (5, ‘5’, 5.0, “5”)
Answer:
5 – integer literal
‘5’ – Character literal
5.0- floating point literal
“5”- string literal

Question 13.
Identify the invalid literals from the following and write reason for each:
a) 2E3.5
b) “9”
c) ‘hello’
d) 55450
Answer:
a) 2 C 3.5 – The mantissa part (3.5) will not be a floating point number. Hence it is invalid
c) ‘hello’ -> It is a string hence it must be enclosed in double quotes instead of single quotes. It is invalid.

Question 14.
Which one of the following is a user-defined name?
a) Key-word
b) Identifier
c) Escape sequences
d) All of these
Answer:
b) Identifier

Question 15.
Identify whether the following are valid identifiers or not? If not give the reason.
a) Break
b) Simple.interest
Answer:
a) Break – It is valid( break is the keyword, not Break);
b) Simple.interest – It is not valid, because dot(.) is used.

Question 16.
Identify the invalid literals from the following and write a reason for each:
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 Getting Started with C++ 3 Marks Questions and Answers

Question 1.
Rose wants to print as follows
\n is used for New Line
Write down the C++ statement for the same.
Answer:
#include
using namespace std;
int main( )
{
cout<<“\\n is used for New Line”;
}

Question 2.
Alvis wants to give some space using escape sequence as follows
Welcome to C++
Write down the C++ statement for the same .
Answer:
#include
using namespace std;
int main( )
{
cout<<“Welcome to \t C++”;
}

Question 3.
We know that the value of pi=3.14157, a constant (literal). What is a constant? Explain it?
Answer:
A constant or a literal is a data item its value doe not change during execution.
1) Integer literals Whole numbers without fractional parts are known as integer literals, its value does not change during execution. There are 3 types decimal, octal and hexadecimal.
Eg. For decimal 100,150,etc
For octal 0100,(5240, etc
For hexadecimal 0x100, 0x1A,etc
2) Float literals A number with fractional parts and its value does not change during execution is called floating point literals.
Eg. 3,14157,79.78,etc
3) Character literal: A valid C++ character enclosed in single

Question 4.
Write a program to print the message “TOBACCO CAUSES CANCER” on screen,
Answer:
#include using namespace std; int main( )
{
cout<<” TOBACCO CAUSES CANCER”;
}

Question 5.
You are supplied with a list of tokens in C++ pro-gram, Classify and Categorise them under proper headings.
Explain each category with its features. tot_mark, age, M5,. …, break,( ), int, _pay, ; , cin
Answer:
Plus One Computer Application Chapter Wise Questions Chapter 4 Getting Started with C++ 1

Question 6.
Write a program to print the message “SMOKING IS INJURIOUS TO HEALTH” on screen. “SMOKING IS INJURIOUS TO HEALTH”
Answer:
#include
using namespace std;
int main( )
{
cout<<“SMOKING IS INJURIOUS TO HEALTH”;
}

Plus One Computer Application Getting Started with C++ 5 Marks Questions and Answers

Question 1.
Consider the following code
The new line character is \n.
The output of the following code does not contain the \n. Why it is happened? Explain.
Answer:
\n is a character constant and it is also known as escape sequence. This is used to represent the non graphic symbols such as carriage return key(enter key), tab key, back space, space bar etc. It consists of a back slash symbol and one more characters.
Plus One Computer Application Chapter Wise Questions Chapter 4 Getting Started with C++ 2

Question 2.
You are about to study the fundamentals of C++ programming Language. Do a comparative study of the basics of the new language with that of a formal language like English or Malayalam to familiarize C++?. Provide sufficient explanations for the compared items in C++ Language,
Answer:
Character set: To study a language first we have to familiarize the character set. For example to study English language first we have to study the alphabets. Similarly here the character set includes letters(A to Z & a to z), digits(0 to 9), special characters+,-,?,*,/, ) white spaces(non printable)
etc..
Token: It is the smallest individual units similar to a word in English or Malayalam language. C++ has 5 tokens
1) Keywords
Eg: float is used to declare variable to store numbers with decimal point. We can’t use this for any other purpose

2) identifier: These are user defined words. Eg: variable name, function name, class name, object name etc…

3) Literals (Constants): Its value does not change during execution
Eg: In maths π = 3.14157 and boiling point of water is 100.

4) Punctuators: In English or Malayalam language punctuation mark are used to increase the read-ability but here it is used to separate the tokens. Eg:{,},(,)……….

5) Operators: These are symbols used to perform an operation(Arithmetic, relational, logical, etc…)
These are reserved words for the compiler. We can’t use for any other purposes.