Professional Documents
Culture Documents
Assignment 3 - Vibuddha Vidarshana
Assignment 3 - Vibuddha Vidarshana
2.
3.
4. 60
10+20+30
10+2030
102030
102030
3030
102030
5. a, c, d
6. 6 (arithmatic addition)
7.
8. import java.util.*;
class Example{
public static void main(String args[]){
Scanner input=new Scanner(System.in);
System.out.print("Input your age : ");
int age=input.nextInt();
System.out.println("Your current age is : "+age);
//--------------Do not modify before this line----
age = age + 10;
//---------------------Do not modify after this line---
System.out.println("Your age after 10 years is : " + age);
}
}
9.import java.util.*;
class Example{
public static void main(String args[]){
Scanner input=new Scanner(System.in);
System.out.print("Input number 1 : ");
int num1=input.nextInt();
System.out.print("Input number 2 : ");
int num2=input.nextInt();
System.out.println(num1+" "+num2);
//-----------Do not modify before this line--------
int a = num1;
num1 = num2;
num2 = a;
//------Do not modify after this line------------
System.out.println(num1+" "+num2);
}
}
10. a)
b) narrow conversion
narrow casting
c) wider conversion
wider casting
11. B, E
12. a, c, e
13. a, b
14. b
15. a, c, d
16. a, b, c, d
17. a, c, g
18. a. 3
b. -3
c. 3
d. -3
e. 3
f. -3
g. 3
19. a, b, c, d, e
20. a, c, d
21. a,b,c,d
22. a. 17
b. -10
c. -17
d. -3
e. 7
f. -3
23. -100
100
-100
-200
400
24. 100101
104
104
25. 101 100
102 101
103 102
102 102
103 103
27. 100
100
100
101
102
103
28. a. 3
b. 0
c. 10
d. 0.0
e. 0.0
e. 31 (11 + 20)
f.30 (10 + 20) a & b post incriment
30. 12 - 4*2 : 4
(12-4)*2 : 16
12 - (4*2) : 4
32. a. 106
b. 12
c. 11
d. 44
33. a. 21
b. 22
c. 26
d. 27
e. 31
f. 33
g. 38
h. 42