KPK Board 12th Class Computer Ch 3 Object Oriented Programming Using C++ Short Questions Answers

We are providing all Students from 5th class to master level all exams preparation in free of cost. Now we have another milestone achieved, providing all School level students to the point and exam oriented preparation question answers for all science and arts students.

After Online tests for all subjects now it’s time to prepare the next level for KPK board students to prepare their short question section here. We have a complete collection of all classes subject wise and chapter wise thousands questions with the right answer for easy understanding.

We provided 12th class Computer short questions answers on this page of all KPK boards. Students of KPK boards can prepare the Computer subject for annual examinations.

In this List we have included all KPK boards and both Arts and Science students. These Boards students can prepare their exam easily with these short question answer section

Malakand Board 12th classes short questions Answer

Mardan Board 12th classes short questions Answer

Peshawar Board 12th classes short questions Answer

Swat Board 12th classes short questions Answer

Dera Ismail Khan Board 12th classes short questions Answer

Kohat Board 12th classes short questions Answer

Abbottabad  Board 12th classes short questions Answer

Bannu Board 12th classes short questions Answer

All above mention KPK Boards students prepare their annual and classes test from these online test and Short question answer series. In coming days we have many other plans to provide all kinds of other preparation on our Gotest website.

How to Prepare KPK Board Classes Short Question Answer at Gotest

  • Just Open the desired Class and subject which you want to prepare.
  • You have Green bars which are Questions of that subject Chapter. Just click on Bar, it slides down and you can get the right answer to those questions.
What is meant by statement terminator (;)?

Each C++ statement is ended by a symbol called semicolon (;) which is known as statement terminator. The separation between statements is specified with this ending semicolon (;) at the end of each statement. It is not necessary to write more than one statement in a single line but it is necessary to separate them with semicolons.

What is comment? What are the two types of comment is C++?

A comment is text in a program that the compiler ignores but that is useful or programmers. Comments are normally used to explain purpose of code. The compiler considers them as white space.

C++ uses two types of comments.

1 Single-line Comments: Comments on single line are added by using // (two slashes). Anything written on the right side of // (two slash) is considered as comments.

  1. Multi-line Comments: Multi-line comments are added to the code by placing /* (slash, asterisk) at beginning of the comments. The */ character is used to end multi-line comments. The compiler ignore everything between /* and*/.
What is identifier? What are the grammatical rules naming variables in C++?

The name given to variables, constants and other programming elements such as functions is called identifiers.

1 Valid identifier is a sequence of one or more alphabets, digits or underscore (-).

  1. Reserved word cannot be used as an identifier.
  2. Neither blank spaces nor special characters can be used as an identifier.
  3. A variable cannot start with digit.
  4. Variable identifier always starts with alphabets or underscore (-).
  5. Identifier names should not be too long.
  6. Identifier names should be meaningful.
What is meant by constant qualifier?

Const keyword is used to define constant identifier whose values remain constant during whole life of the program .Const identifier must be assigned with a value when declared and then that value cannot be changed. Following is the example of a code used to define using const identifier keyword.

Const into Dollar Rate =86;

Declaring a variable as const prevents the programmers from unintentionally changing its value.

Consider the following lines of code to change the value of variable Dollar Rate.

Const into Dollar Rate = 86;

Dollar Rate = 110; //compiler error

By changing the constant value, a compiler error message will be displayed by the compiler because the code at line 2 tries to change the value of variable Dollar Rate from 86 to110, which is declared as constant.

Define type casting operator. Differentiate between Implicit and Explicit type casting?

The conversion of data from one type to another type is called type casting. It has two types.

  1. Implicit type casting.
  2. Explicit type casting.
  3. Implicit type casting:

In this type, the compiler automatically converts data from one type to another type when they are used in expressions. When a value of one type is assigned to another type, the compiler Implicitly converts that value into the value of new type.

For example:

Double a=3; // implicit casting to double value3.0

Into b =3.14156; // implicit casting to integer value3

  1. Explicit type casting:

In C++, there are many ways to convert one type to another but the simplest one is to precede the expression to be converted by the new type enclosed in parenthesis (). This type of conversion is known as explicit type conversion.

For example:

Into x;

Float pi = 3.14;

X = (into) pi;

In the above code, the float number 3.14 is converted to an integer value 3 and the reminder (0.14) is ignored. In this code the type casting operator is (into).

Discuss briefly I/O handing functions?

To write an effective program, we must be able to take input from the user and show result to the user. C++ gives us a variety of input and output functions which are used to handle different types of input and output statements.

Commonly used I/O handling functions are.

  1. Get char ()

B put char ()

1 Get char ()

Get character is an input function that is used to get a single character from keyboard get char () is defined in studio. h header file.

The general syntax for get char () function is:

Into get char ();

  1. Put char ()

Put char is an output function that is used to display a single character on the screen. Put char () is defined in studio. h header file.

The general syntax for put char () function is.

Put char (any character);

Write short note on expression?

An expression is the combination of operators and operands. The operands are the variables and constants while operators are different arithmetic operators e.g +, -, x, %.

Following are the different expressions.

X = a + b;

Z = 2 + x/ y;

Y > 4;

There are three categories of expressions:

1 Arithmetic Expressions consist of numeric operands and arithmetic operators and give numeric results. For example:

X = y + 25;

Sum = x = y;

  1. Relational Expressions consist of numeric operands and relational operators for comparison of data. For example:

x > y;

z > = 10;

  1. Logical Expression are used for testing of two or more Boolean expressions. For example:

(x > y) || (x = 10);

(n = 5) && (m > n);

Write is Compound Expression?

An expression that involves more than one sub-expression linked with operators is called Compound Expression. In compound expression, usually two or more relational expressions are linked with logical operators to from compound Boolean expression. For example:

X1 = (-B + sort (B*B – 4*A*C))/ (2*A);

((c*c) – 4* a* b)>0

(Age <=30) && (height >=5)

What are escape sequences in C++?

Escape sequences are special characters which perform some special function. These characters are not displayed in the output and are used with backslash “\” followed by an alphabetic character. The backslash is called escape character.

Type of Escape Sequences:

There are many escape sequences in C++. The most commonly used escape sequences are.

\a. Is used to generate signal to alert (alarm)

e.g cout << “My First \a program”; will display My First Program. After displaying “My First” the computer will make and alert signal and then will print “program”

\b. Is used to insert backspace in the output

e.g cout << “Hello\b World”; will display Hello World.

First of all Hello is printed but \b deletes ‘o’, then “World” is printed.

\n. Is use to insert new line in output.

e.g print f (“Hello\n World”); will display in two lines



\t. Is used to insert a TAB in output

e.g print f (“Hello\t World”); will display

Hello    World

You Can Learn and Gain more Knowledge through our Online Quiz and Testing system Just Search your desired Preparation subject at Gotest.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button