Page 1 :
VXL TUTORIAL by VINOD KHARE Ph:9336061496, Assignment -1, Topic : Increment & Decrement operator, Write the output of following questions:, Question 1:, int a = 34;, int b = 21;, int c = a++ + ++b;, int d = --a + --b + c--;, int e = a + +b + +c + d--;, int f = -a + b-- + -c - d++;, int sum = a + b + c + d + e + f;, System.out.println("sum = " + sum);, , Question 2:, int i = 4;, int j = 21;, int k = ++i * 7 + 2 - j--;, System.out.println("k = " + k);, Question 3:, int a = 1;, int b = 2;, int c;, int d;, c = ++b;, d = a++;, c++;, System.out.println("a = " + a);, System.out.println("b = " + b);, System.out.println("c = " + c);, System.out.println("d = " + d);, Question 4:, , 1
Page 2 :
VXL TUTORIAL by VINOD KHARE Ph:9336061496, int input = 7;, int output = ++input + ++input + ++input;, System.out.println(output);, , int i, j, k, l = 0;, k = l++;, j = ++k;, i = j++;, System.out.println(i);, Question 5:, int dailywage = 4;, int number_of_days = 5;, int salary = number_of_days++ * --dailywage * dailywage++ * number_of_days--;, salary =- dailywage;, System.out.println(dailywage + " " + number_of_days + " " + salary);, , Question 6:, int i = 34.0;, int j = 7;, int k = i % j;, System.out.println("k = " + k );, Question 7:, int x = 42;, double y = 42.25;, System.out.println("x mod 10 = " + x % 10 );, System.out.println("y mod 10 = " + y % 10 );, Question 8:, Which of the following statements is true?, , , 1. When a = 5 the value of a % 2 is same as a - 4, 2