# Arithmetic Operation

 Question 1
What is printed by the following ANSI C program?
#include < stdio.h >
int main(int argc, char *argv[]){
char a = 'P';
char b = 'x';
char c = (a  &  b) + '*';
char d = (a | b) - '-';
char e = (a ^ b) + '+';
printf("%c %c %c \n", c, d, e);
return 0;
}


ASCII encoding for relevant characters is given below A z K S B 122 75 83 C * - + D P x +
GATE CSE 2022   C Programming
Question 1 Explanation:
 Question 2
Consider the following C program:

#include < stdio.h >
int main() {
float sum = 0.0, j = 1.0, i = 2.0;
while (i / j > 0.0625) {
j = j + j;
sum = sum + i/j;
printf("%f \n", sum);
}
return 0;
}
The number of times variable sum will be printed When the above program is executed is _________ .
 A 0 B 3 C 6 D 5
GATE CSE 2019   C programming
Question 2 Explanation:
 Question 3
Consider the following C program:
 main()
{
float sum= 0.0, j=1.0,i=2.0;
while(i/j>0.001){
j=j+1;
sum=sum+i/j;
printf("%f/n", sum);
}
}
 A 0 - 9 lines of output B 10 - 19 lines out output C 20 - 29 lines of output D More than 29 lines of output
ISRO CSE 2018   C Programming
Question 3 Explanation:
 Question 4
Consider the following C code segment:
 #include < stdio.h >
main()
{
int i, j, x;
scanf("%d", &x);
i=1; j=1;
while (i<10) {
j =j*i;
i= i+1;
if(i==x) break;
}
}
For the program fragment above, which of the following statements about the variables i and j must be true after execution of this program? [ !(exclamation) sign denotes factorial in the answer]
 A $(j=(x-1) !) \wedge(i \geq x)$ B $(j=9 !) \wedge(j=10)$ C $((j=10 !) \wedge(i=10)) \vee((j=(x-1) !) \wedge(i=x))$ D $(j=9 !) \wedge(i \geqslant 10)) \vee((j=(x-1) !) \wedge(i=x))$
ISRO CSE 2018   C Programming
Question 4 Explanation:
 Question 5
What does the following program do when the input is unsigned 16 bit integer?
 #include < stdio.h >
main(){
unsigned int num;
int i;
scanf("%u", &num);
for(i=0;i<16;i++){
printf("%d", (num < < i&1 < < 15)?1:0);
}
}
 A It prints all even bits from num B It prints all odd bits from num C It prints binary equivalent of num D None of above
ISRO CSE 2017   C Programming
Question 5 Explanation:
 Question 6
Consider the following C program.
 #include < stdio.h >
int main ( ) {
int m = 10;
int n, n1;
n = ++m;
n1 = m++;
n--;
--n1;
n-=n1;
printf ("%d", n) ;
return 0;
}
The output of the program is ______________.
 A 10 B 11 C 1 D 0
GATE CSE 2017 SET-2   C Programming
Question 6 Explanation:
 Question 7
The attributes of three arithmetic operators in some programming language are given below. The value of the expression 2-5+1-7*3 in this language is_______ .
 A -23 B 9 C -27 D 23
GATE CSE 2016 SET-1   C Programming
Question 7 Explanation:
 Question 8
Consider the following statements
 #define hypotenuse (a, b) sqrt (a*a+b*b);
The macro call hypotenuse(a+2,b+3);
 A Finds the hypotenuse of a triangle with sides a+2 and b+3 B Finds the square root of $(a+2)^{2}$ and $(b+3)^{2}$ C Is invalid D Find the square root of 3*a+4*b+5
ISRO CSE 2015   C Programming
Question 8 Explanation:
 Question 9
The for loop
 for (i=0; i<10; ++i)
printf("%d", i&1);
prints
 A $0101010101$ B $0111111111$ C $0000000000$ D $1111111111$
ISRO CSE 2015   C Programming
Question 9 Explanation:
 Question 10
Consider the following program fragment
 i=6720; j=4;
while (i%j)==0
{
i=i/j;
j=j+1;
}
On termination j will have the value
 A 4 B 8 C 9 D 6720
ISRO CSE 2015   C Programming
Question 10 Explanation:
There are 10 questions to complete.

### 3 thoughts on “Arithmetic Operation”

1. Dear Practise paper Team,

This website is extremely useful to solve PYQs.
But only if it had an option of bookmarking the question, We could completely depend on this website for PYQs.

As you know, How important it is to mark the important questions. so that we can solve it again later.
I humbly request the team to add this feature by making user accounts.

Thanks & Warm Regards

• • 