Thursday, September 18, 2014

Interview Preparations


Interview Preparation - Java Program for beginners 


1.       Write a program to accept two numbers from the user, calculate the sum and display the same.

Expected output:

Enter the num1 value:
10
Enter the num2 value:
20
Sum of 10 and 20 is 30

2.       Write a program to accept the weight of 3 persons, calculate the total weight, determine the average weight and display these details.

Expected output:

Enter the weight of the first person:
55.5
Enter the weight of the second person:
45.4
Enter the weight of the third person:
65.6
The sum of weight of the 3 persons is 166.5 Kgs and the average weight is 55.5 Kgs

3.       Write a program to accept the following details of an employee: empno, name and monthly salary; calculate the yearly salary and display the result.

Expected output:

Enter the empno:
1001
Enter the employee name:
Ramana
Enter the monthly salary:
25000
Hi Ramana! Your employee id is 1001, monthly salary is Rs 25,000 and yearly salary is Rs 300,000.

4.       Write a program to accept two numbers from the user, swap their values and display the result.

Expected output:

Enter the first number num1:
100
Enter the second number num2:
200
Before swap, the values of num1=100 and num2=200
After swap, the values of num1=200 and num2=100

5.       Write a program to accept the principal amount, rate of interest, time and calculate the simple interest.

Expected output:

Enter the principal amount:
20000
Enter the rate of interest
1.5
Enter the time (years)
2

Simple interest is 600

(Help: Simple Interest formula ((p*t*r)/100))


IF Statement

6.       Write a program to accept a number, if it is negative then covert it to a positive number.

Expected output:

Enter a number:
-10
The result is: 10

7.       Write a program to accept the billing amount, if it is > 6000 then give a discount of 10% and display the net amount.

Expected output:

Enter the billing amount:
6500
Your net billing amount: 5850

Enter the billing amount:
5500
Your net billing amount: 5500

8.       The Sports Club registration form has the following details: name, mobile number and age. Per the membership policy, the person should be at least 18 years old to become a member. Write a program to accept the details mentioned above; if the age is >18 years then display the entered details with a congratulatory message, else the following message should be displayed “Sorry! You need to be at least 18 years old to get membership.”

Expected output:

Enter the name:
Lakshman
Enter the mobile number:
989999999
Enter the age:
16

Sorry! You need to be at least 18 years old to get membership.”

Enter the name:
Lakshman
Enter the mobile number:
989999999
Enter the age:
30

“Congratulations Lakshman for your successful registration.”

Hint: Use return statement in if block after displaying the “Sorry…” message.



If – Else Statement

9.       Write a program to accept a number from the user and determine whether it is even or odd.

Expected output:

Enter a number:
15
The entered number 15 is odd

Enter a number
10
The entered number 10 is even

10.   Write a program to accept two numbers from the user and determine bigger of the two.

Expected output:

Enter the first number num1:
20
Enter the second number num2:
45

The bigger of the two numbers entered (20 and 45) is: 45

11.   Write a program to accept two numbers num1 and num2; when one is subtracted from the other, the result should always be a positive number.

Expected output:

Enter the first number num1:
35
Enter the second number num2:
45
The result (difference) is: 10

Enter the first number num1:
45
Enter the second number num2:
35
The result (difference) is: 15

12.   In a shopping mall, privileged customers (if they have a membership card) are being given a 10% discount on the billed amount, and the others are being given a 3% discount. Write a program to accept the billing amount and confirm the membership card from the customer; calculate and display the net amount to be paid by the customer.

Expected output:

Enter the bill amount:
5000
Do you have a membership card?
Y
Thank you! Your total bill amount is Rs 5000, discount is Rs 500 and net amount payable is Rs 4500.


Enter the bill amount:
5000
Do you have a membership card?
N
Thank you! Your total bill amount is Rs 5000, discount is Rs 150 and net amount payable is Rs 4850.

IF – ELSE – IF Statement

13.   Write a program to accept 3 numbers from the user and find the biggest of them.

Expected output:

Enter the 1st number num1:
45
Enter the 2nd number num2:
75
Enter the 3rd number num3:
45
The biggest of the 3 numbers entered is: 75

14.   Write a program to accept the marks scored in three subjects; determine the sum and average of the entered marks. Grade is awarded based on following criteria.

If average is < 35 -- “C”; >35 and <60 -- “B”; Otherwise -- “A”

Expected output:

Enter the marks scored in 1st subject:
40
Enter the marks scored in 2nd subject:
60
Enter the marks scored in 3rd subject:
80

Total marks: 180
Average is: 60.0
Grade: “B”

FOR Loop

15.   Write a program to generate the first 'N' natural numbers. Accept the value of 'N' from the user.

Expected output:

Enter the number of natural numbers to be generated:
5
First 5 natural numbers are : 1 2 3 4 5

16.   Write a program to accept a number and determine whether it is a prime number or not.

Expected output:

Enter any number:
9
The entered number 9 is not a prime number

Enter any number:
7
The entered number 7 is a prime number

17.   Write a program to generate the first 'N' natural numbers and print them in descending order.

Expected output:

Enter the number of natural numbers to be generated:
5
The first 5 natural numbers in descending order are: 5 4 3 2 1

18.    Write a program to accept the lower bound number and the upper bound number from the user and print the prime numbers between them.

Expected output:

Enter the lower bound value:
5
Enter the upper bound value:
15
The prime numbers between 5 and 15 are: 5 7 11 13

19.   Write a program to accept a number and print the Fibonacci series up to the entered number.

Expected output:

Enter the upper bound number to generate the Fibonacci numbers:
8
Fibonacci series up to the entered number is: 0 1 1 2 3 5 8

20.   Write a program to accept a number from the user and print its multiplication table (upto “times 10”).

Expected output:

Enter the number to generate its multiplication table:
19
Multiplication table for 19 is :
19 * 1 = 19
19 * 2 = 38
..............
..............
19* 10 = 190

21.   Write a program to accept a number and find its factorial.

Expected output:

Enter any number:
5
The factorial of 5 is 120
(Hint: 5! = 5 * 4 * 3 * 2 * 1)

22.   Write a program to accept a number “n” from the user; then display the sum of the series 1+1/2+1/3+……….+1/n.

23.   Write a program to accept a number “n” from the user; then display the series 1,3,5,7,9,…,n and find the sum of the numbers in this series.

24.   Write a program to accept a number “n” from the user; find the sum of the series 1/23+1/33+1/43……..+1/n3



Write a program to generate following patterns.

25.
1
2 3
4 5 6 7
8 9 10 11

26.
1 2 3
4 5 6
7 8 9

27.
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

28.
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

29.
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

30.
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1

31.
19 38 57
76 95 114
133 152 171

32.
A B C
D E F
G H I

33.
1 1
1 2 2 1
1 2 3 3 2 1
1 2 3 4 3 2 1

34.
19 0 0
0 19 0
0 0 19

35.
* * * * * * * * *
             *
             *
             *
             *
             *
* * * * * * * * *

36.
@ @ @ @
@           @
@ @ @ @
@           @
@           @

37.
* * * * * * *
    *              *
    *              *
    *              *
* * * * * * * * * * * *
*                 *
*                 *
*                 *
                   * * * * * * *

38.   Write a program to find the biggest, smallest and sum of the elements in the given 3 X 3 matrix.

5 6 7
4 5 6
5 6 7

39.
1 2 3 4 5
5 1 2 3 4
4 5 1 2 3
3 4 5 1 2
2 3 4 5 1

40.
1 2 3 4
5 6 7
8 9
10

While – loop

41.    Write a program to accept a number from the user and count the number of digits in the number.

Expected output:

Enter any number:
14567
The number of digits in the entered number is 5

42.   Write a program to accept a number from the user and find the sum of digits in the entered number.
Expected output:

Enter any number:
14567
The sum of digits of the entered number is 22

43.   Write a program to accept a number from the user and find the reverse of the entered number.

Expected output:

Enter any number:
45646
Reverse of the entered number is 64654

44.   Write a program to accept a number from the user and determine whether it is an Armstrong number or not.
(Example: 153 is an Armstrong number 1^3 + 5 ^3 +3 ^3 =153)

45.   Write a program to accept a number from the user and calculate the sum of digits of the number; repeat the operation till the sum gets to be a single digit number.

Expected output:

Enter any number:
9981
Single digit sum is: 9
(Hint: 9+9+8+1 = 27; 2+7 = 9)

46.   Write a program to accept a number from the user and count the number of prime digits.

Expected output:

Enter any number:
97512
Number of prime digits in the entered number is 3

47.   Write a program to accept a number and find the factorial of the number (using while loop).

48.   Write a program to accept a four digit number from the user and display its denomination.

Example: 5698
Output: 5*1000 =5000
6*100 =600
9*10 =90
8*1 =8

49.   Write a program to accept a five digit number from the user, increment each digit by one and display the number (digit 9 gets incremented to 0).

Example:
Input: 14385
Output: 25496

50.   Write a program to accept 2 numbers “m” and “n” from the user and determine m^n (without using predefined functions).

Switch statement

51.   Write a program to accept a character from the user and check whether it is a vowel or consonant using switch statement.

52.   Write a program to accept two numbers num1, num2 and an operator. Simulate the calculator using switch statement.

Enter the 1st Operand num1:
10
Enter the 2nd Operand num2:
20
1. add 2. mul 3. div 4. mod 5. div
Enter the operator
1
The sum of 10 and 20 is 30

53.   Write a program to generate the following output

1 2
1 3
2 1
2 3
3 1
3 2

(Hint: Use continue statement)

54.   Write a program to add the first 7 terms of the following series using a for loop:
1/1!+2/2!+3 /3!+....

55.   Write a program to fill the entire screen with a smiling face. The smiling face has an ASCII value 1.






Wednesday, August 20, 2014

Java Programming Interview Questions

WHILE Loop

1. What is the output of the following code snippet?
int i=1,sum=0;
while(true){
sum+=i;
if(sum>14)
break;
if(i==5)
break;
    i=sum+sum;
}
System.out.println("Sum is :"+sum);

A. 14
B. 15
C. 27
D. 5
E. 28

2. What is the output of the following code snippet?
int i=0,j=10;
while(i<j-i){
i++;
--j;
}
System.out.println(i+","+j);

A. 5,5
B. 6,5
C. 4,6
D. 5,5
E. 5,4

3. What is the output of the following code snippet?
int i=0,j=10;
do{
      i++;
--j;
}while(i<5);
System.out.println(i+","+j);

A. 5,7
B. 6,5
C. 4,6
D. 5,5
E. 5,4

4. What is the output of the following code snippet?
int num=9845;
while(num>9){
int sum=num%10+num/10;
num=sum;
}
System.out.println(num);

A. 9
B. 26
C. 0
D. 8
E. 7

5. What is the output of the following code snippet?
int num=98451;
while(num>9){
int sum=0;
while(num!=0){
sum+=num%10;
num=num/10;
}
num=sum;
}
System.out.println(num);

A. 10
B. 26
C. 8
D. 9
E. 7

6. What is the output of the following code snippet?
int i=1,sum=0;
while(i<10){
  int j=1;
  int count=0;
    while(j<=i){
if(i%j==0){
  count++;
}
 j++;
}
       if(count==2){
if(i%2!=0)
          sum+=i;
      }
i++;
}
System.out.println(sum);

A. 17
B. 10
C. 15
D. 16
E. 19

7. What is the output of the following code snippet?
int i = 2, sum = 0;
while (true) {
   if (i % 2 == 0) {
sum += i;
   }
     i++;
            if(sum>9)
          break;
}
System.out.println(sum);

A. 9
B. 10
C. 11
D. 12
E. 13

8. What is the output of the following code snippet?
int count=0,i=1;
do{
count++;
i++;
}while(i<10);
System.out.println(count);

A. 8
B. 7
C. 10
D. 11
E. 9

9. What is the output of the following code snippet?
int i=3;
while(2<3){
if(i<2)
break;
System.out.print(i--+" ");
}

A. 2 3
B. 3 3
C. 2 2
D. 3 1
E. 3 2

10. What is the output of the following code snippet?
int i=3;
do{
  if(i<2)
     break;
  System.out.print(i--+" ");
}while(2<3);

A. 2 3
B. 3 2
C. 2 2
D. 3 1
E. 3 1




Java Programming Interview Questions

SWITCH Statement

1. What is the output of the following code snippet?
public static void main(String[] args) {
int num=5;
 switch(num++){
     case 6:System.out.println("Num = "+6);
     case 5:System.out.println("Num = "+5);
     case 7:System.out.println("Num = "+7);
    break;
    default: System.out.println("Num = "+num);
}
}

A. Num = 6
B. Num = 5
C. Num = 5
Num = 6
D. Num = 5
Num = 7
E. Num = 5
Num = 6
Num = 7

2. What is the output of the following code snippet?
public static void main(String[] args) {
int num=6;
switch(++num){
case 6:System.out.println("Num = "+num);
      break;
case 5:System.out.println("Num = "+num);
      break;
case 7: System.out.println("Num = "+num);
default: System.out.println("Num = "+num);
}
}

A. Num = 5
B. Num = 7
C. Num = 6
D. Num = 6
Num = 6
E. Num = 7
Num = 7

3. What is the output of the following code snippet?
public static void main(String[] args) {
int num=9;
switch(++num){
default: System.out.println("Num = "+num);
case 4+3:System.out.println("Num = "+num);
        break;
case 4+5:System.out.println("Num = "+num);
break;
case 4+4: System.out.println("Num = "+num);
       break;
}
}

A. Num = 10
B. Num = 9
C. Num = 9
Num = 9
D. Num = 10
Num = 10
E. Num = 10
Num = 7

4. What is the output of the following code snippet?
public static void main(String[] args) {
for (int i = 3; i >= 0; --i) {
  switch (i) {
case 1:
System.out.println(i);
break;
case 2:
System.out.println(i);
break;
case 3:
System.out.println(i);
break;
default:System.out.println(i);
}

}
}

A. 1
2
3
B. 0
1
2
3
C. 3
D. 3
2
1
E. 3
2
1
0

5. What is the output of the following code snippet?
public static void main(String[] args) {
float num = 12.5f;

  switch (num++) {
case 12.5f:
System.out.println("12.5");
break;
case 13.5f:
System.out.println("13.5");
break;
case 14.5f:
System.out.println("14.5");
break;
default:
System.out.println("Default");
  }
}

A. 12.5
B. 13.5
C. 14.5
D. Default
E. None of the above

6. What is the output of the following code snippet?
public static void main(String[] args) {
int num = 12;
switch (++num) {
case 12:
System.out.println("12");
case 13:
System.out.println("13");
case 14:
System.out.println("14");
return;
default:
System.out.println("Default");
}
}

A. 12
13
B. 13
14
C. 14
D. Default
E. None of the above

7. What is the output of the following code snippet?
public static void main(String[] args) {
int a = 99;
switch (a) {
case 'a':
System.out.println("a");
break;
case 'b':
System.out.println("b");
break;
case 'c':
System.out.println("c");
break;
default:
System.out.println("Default");

}
}

A. Default
B. b
C. C
D. a
E. none of the above

8. What is the output of the following code snippet?
public static void main(String[] args) {
char message[]={'t','h','e','q','u','i','c','k'};
int count1=0;
int count2=0;
for(int i=0;i<message.length;i++)
switch (message[i]) {
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':count1++;
default: count2++;
}
System.out.println(count1+ " "+count2);
}

A. 3 5
B. b. 4 4
C. 3 6
D. 3 7
E. 3 8

9. What is the output of the following code snippet?
public static void main(String[] args) {
int num=10;
switch(num++){
case 5+5: System.out.println("Expression");
break;
case 10: System.out.println("Value-10");
break;
case 11:System.out.println("Value-11");
break;
default: System.out.println("Default");
}
}

A. Expression
B. Value-10
C. c. Value-11
D. Default
E. None of the above

10. What is the output of the following code snippet?
public static void main(String[] args) {
int num=10;
switch(num++){
default: System.out.println("Default");
case 5+7: System.out.println("Expression");
break;
case 10: System.out.println("Value-10");
break;
case 11:System.out.println("Value-11");
break;

}
}

A. Default
B. Default
Expression
C. Value-10
D. Value-11
E. None of the above



Java Programming Interview Questions

IF Statement
1. What is the output of the following code snippet?
void showResult() {
int a=10,b=20;
 if(a<b)
   System.out.println(a);
   System.out.println(b);
}

A. 10
B. 10
20
C. 20
D. 20
10
E. 10
10

2. What is the output of the following code snippet?
boolean a,b=false;
if(a=!(4==5)&&(b=true)){
 System.out.print(a +" ");
}
if(a=true && b){
 System.out.print(a);
}

A. true
B. true false
C. true true
D. false false
E. false true

3. What is the output of the following code snippet?
int sum=0;
for(int i=1;i<=20;i++){
if(i%4!=0)
        continue;
sum+=i;
}
System.out.println(sum);

A. 44
B. 56
C. 60
D. 64
E. 68
4. What is the output of the following code snippet?
void showResult() {
  boolean a=false,b=false,c=true;
if(a & (b=true) & (c=false));
System.out.println(a+" "+b+" "+c);
}

A. false false true
B. false false false
C. true true true
D. false true false
E. true true false

5. What is the output of the following code snippet?
void showResult() {
  boolean a=false,b=false,c=true;
if(a && (b=true) && (c=false));
System.out.println(a+" "+b+" "+c);
}

A. false false true
B. false false false
C. true true true
D. false true false
E. true true false

6. What is the output of the following code snippet?
int a=20,b=30,c=50;
 if(a<b && a<b)
System.out.println(a);
else if(b<c)
System.out.println(b);
else
System.out.println(c);

A. 50
B. 30
C. 20
D. No output
E. 0

7. What is the output of the following code snippet?
for(int i=1,j=5;i<=4;i++,j--){
if(i%j==0)
System.out.println(i+" "+j);
}

A. 2 3
4 4
B. 4 2
3 3
C. 3 3
4 2
D. 2 2
3 3
E. 4 4
3 3

8. What is the output of the following code snippet?
for(int i = 0; i < 2; i++) {
        for(int j = 2; j>= 0; j--) {
           if(i == j) break;
           System.out.print(i + " "+j+ " ");
        }
}

A. 0 2 0 1 1 1
B. 0 2 0 1 1 2
C. 1 2 0 1 1 2
D. 0 2 0 1 2 2
E. 0 2 1 0 0 2

9. What is the output of the following code snippet?
int count = 0;
for (int i = 0; i < 5; i++) {
for (int j = 2; j >= 0 ; j--, count++);
count++;
}
System.out.println(count);

A. 10
B. 15
C. 16
D. 20
E. 21

10. What is the output of the following code snippet?
int count = 0;
for (int i = 0; i < 5; i++) {
for (int j = 2; j >= 0 ; j--, count++){
count++;
}
}
System.out.println(count);

A. 25
B. 15
C. 16
D. 31
E. 30




Java Programming Interview Questions


FOR Loop
1. What is the output of the following code snippet?
for(int i=1;i<=3;i++){
System.out.print(i++);
}

A. 1
B. 1 2 3
C. 2 3
D. 1 3
E. 2 3 4 

2. What is the output of the following code snippet?
int i;
for(i=1;i<=3;i++);
System.out.print(i+" ");

A. 1 2 3 
B. 1 2 
C. 2 
D. 3 
E. 4

3. What is the output of the following code snippet?
int i;
for(i=1;i<=3;i++);
System.out.print(i+" ");

A. 1 2 3 
B. 1 2 
C. 2 
D. 3 
E. 4

4. What is the output of the following code snippet?
for(int i=1,j=2;i<=2;i++,j--){
System.out.println(i+" "+j--);
}

A. 1 2 
2 1  
B. 1 2
2 -1 
C. 1 1 
2 0
D. 1 2
2 0
E. 1 0
2 -1

5. What is the output of the following code snippet?
int n=10,i,j;
for(i=1;i<=n;i++){
  int count=0;
for( j=1;j<=i;j++){
if(i%j==0)
count++;
}
       if(count==2)
   if(i%2!=0)
System.out.print(i+" ");
}

A. 2 3 5 7 9 
B. 3 5 7 9 
C. 3 5 7
D. 1 3 5 7 9
E. 1 2 3 5 7 9

6. What is the output of the following code snippet?
int i=0,j=1;
System.out.print(i+" "+j);
for(int k=1;k<=3;k++){
int sum=i+j;
        System.out.print(" "+sum);
i=j;
j=sum;
}

A. 0 1 1 
B. 0 1 1 2
C. 0 1 1 2 5
D. 0 1 1 2 3
E. 0 1 1 1 3 

7. What is the output of the following code snippet?
int k=1;
for(int i=1;i<3;i++){
for(int j=1;j<=3;j++){
System.out.print(k+++" ");
}
System.out.println();
}

A. 1 2 3
1 2 3
B. 1 2 3 
3 2 1
C. 1 2 3
4 5 6
D. 1 2 3
2 3 4 
E. None of the above

8. What is the output of the following code snippet?
for(int i=1;i<=2;i++){
for(int j=1;j<=5;j++){
        if(i%2==0 && j%2==0)
System.out.println(i+" "+j);
}
}

A. 2 2
4 4
B. 1 2
2 2 
C. 2 2 
4 4 
D. 2 2
2 4 
E. 1 2 
3 4  

9. What is the output of the following code snippet?
int i, j, k, l;
for (i = 1; i <= 3; i++) {
for (j = 1; j <= 3 - i; j++)
System.out.print(" ");
for (k = 1; k <= i; k++)
System.out.print(k);
for (l = k - 2; l >= 1; l--)
System.out.print(l);
System.out.println();
}

A. 1 
123
1232
B. 1 
123
12345
C. 1
121
12321
D. 1
121
123321
E. None of the above

10. What is the output of the following code snippet?
int i, j, k, l, count = 0;
for (i = 1; i <= 3; i++) {
count++;
for (j = 1; j <= 3 - i; j++)
count++;
for (k = 1; k <= i; k++) {
count++;
break;
}
for (l = k - 2; l >= 1; l--)
count++;
}
System.out.println(count);

A. 8
B. 7
C. 9
D. 10
E. 11

11. What is the output of the following code snippet?
int i,j,count=0;
for(i=1;i<=3;i++){
  for(j=1;j<=3;j++,count++);
}
System.out.println(count);

A. 8
B. 7
C. 9
D. 10
E. 11

Java Programming Interview Questions


Basic Declarations
1. What is the output of the following code snippet?
public class Demo {
static int i=100;
public static void main(String[] args) {
final int i=1;
int j=999;
int k=i+j;
System.out.println(i+" "+ j+" "+k);
}
}

A. Compilation error
B. 100 999 1099
C. C. 1   999 1000
D. 1009991000
E. Final variables can't be declared in the method

2. What happens when the following code snippet is compiled and run?
protected class Demo {
public static void main(String[] args) {
System.out.println(1+2+" = "+2+1);
}
}

A. 3  = 3
B. 3  = 2+1
C. 12 = 21
D. 3 = 21
E. None of the above

3. What is the output of the following code snippet?
public class Demo {
public static void main(String[] args) {
int a;
System.out.println(a++ +" "+a++);
}
}

A. 0 1
B. 1 2
C. 2 2 
D. 1 1
E. None of the above

4. What is the output of the following code snippet?
public class Demo {
static int i=99;
static{
int i=100;
i++;
}
public static void main(String[] args) {
System.out.println(++i);
}
}

A. 99
B. 100
C. 101
D. 102
E. None of the above

5. Which of the following are valid declarations of the main method?

A. public static void Main(String args[])
B. public static void main(String args[])
C. public static void main(String... args)
D. public final static void main(String... args)
E. public static final void main(String args[])

6. What is the output of the following code snippet?
public class Demo {
public static int increment(int num){
System.out.println(num);
return num++;
}
public static void main(String[] args) {
int num=99;
increment(num);
System.out.println(num);
}
}

A. 99
100
B. 99
101
C. 100
101
D. 99
99
E. 100
100

7. What is the output of the following code snippet?
private class Demo {
public static void main(String[] args) {
int num=99;
num++;
++num;
System.out.println(num);
}
}

A. 100
B. 101
C. 102
D. 103
E. None of the above

8. What is the output of the following code snippet?
public class Demo {
public static void main(String[] args) {
final int num=99;
System.out.println(num+1);
System.out.println(num*2);
System.out.println(num);
}
}

A. Compilation error
B. 100
200
99
C. 100
200
200
D. 100
198
99
E. None of the above

9. What is the output of the following code snippet?
public class Demo {
public static void main(String[] args) {
final int num=99;
System.out.println(num+2);
num-2;
System.out.println(num);
}
}

A. 101 
99
B. 99
100
C. 100
101
D. 101
102
E. None of the above

10. What is the output of the following code snippet?
public class Demo {
public final static void main(String[] args) {
int j=10;
{
int i=10;
j++;
System.out.println(++i);
}
System.out.println(j);
}
}

A. 10
10
B. 11
11
C. 10
11
D. 11
10
E. None of the above

Spring Boot 3 : JWT with SecurityFilterChain, AuthorizeHttpRequests, RequestMatchers

pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0...