**Q8. What will be the value of P=P* ++J where J is 22 and P=3 initially?**

**Ans. **69

Skip to content
# World Full of Questions

## What is value of P=P* ++J where J is 22 and P=3.

## What is the value of j=–k+2k if k is 20.

## Print Output for cout<

## What will be the result of a=5/3 if a is float, int?

## What does the modulus operator % do?

## Binary Operators.

## How is ‘unary+’ operator different from ‘+’ operator? How is ‘unary-‘ operator different from ‘-‘ operator?

## What is the function of operators? What are arithmetic operators?

## C program to compute simple interest and compound interest.

## C program to ASCII code for digit and backspace.

This world is full of questions and we will try to answer a few of them.

**Q8. What will be the value of P=P* ++J where J is 22 and P=3 initially?**

**Ans. **69

**Q7. What will be the value of j=–k+2k if k is 20 initially?**

**Ans. **57

**Q6. Assuming the res starts with the value 25, what will the following code fragment print out?**

**cout<<res–;**

**cout<<++res;**

**Ans. **

25

25

**Q5. What will be the result of a=5/3 if a is **

**float****int?**

**Ans.(i). **2

**Ans.(ii). **2

**Q4. What does the modulus operator % do? What will be the result of 7.2%2.1 and 8%3?**

**Ans. **The % operator finds the modulus of its operand relative to the second. That is, it produces the remainder of dividing the first by the second operand.

While using modulus operator both operands must be integer types.

So, 7.2%2.1 will produce an error “Illegal use of floating type”.

8%3 will produce 2 as result.

**Q3. What are binary operators? Give examples of arithmetic binary operators.**

**Ans. **Operators that act upon two operands are referred to as Binary Operators.

Examples of arithmetic binary operators are:

- Addition operator +
- Subtraction operator –
- Multiplication operator *
- Division operator /
- Modulus operator %

**Q2. How is ‘unary+’ operator different from ‘+’ operator? How is ‘unary-‘ operator different from ‘-‘ operator?**

**Ans. **The operator unary ‘+’ precedes an operand. The operand (the value on which the operator operates) of the unary + operator must have arithmetic or pointer type and the result is the value of the argument.

For example:

If a=5 then +a means 5.

The arithmetic binary operator + adds values of its operands and the result is the sum of the values of its two operands. Read More …

**Q1. What is the function of operators? What are arithmetic operators? Give their examples.**

**Ans. **The operations being carried out on data, are represented by operators.

C++ provides operators for five basic arithmetic calculations: addition, subtraction, multiplication, division and remainder which are +,-,*,and %.

**Q48. Write a C program to compute simple interest and compound interest.**

**Ans.**

#include<stdio.h> //for standard input and output

#include<math.h> //for pow()

#include<conio.h> //for clrscr()

//Main Function

void main()

{

float principle,rate,time,n,SI,CI,f; Read More …

**Q48. Write a C program to **

**print ASCII code for a given digit.****print ASCII code for backspace.**

**(Hint: Store escape sequence for backspace in an integer variable). **

**Ans(i).**

#include<stdio.h> //for standard input and output

#include<conio.h> //for clrscr()

//Main Function

void main()

{

int num;

clrscr(); //for clear screen

printf(“\n Enter a digit you want to print the ASCII value of: “); Read More …