7/1/25 -------- Q)What is the output of the following piece of code? int a=10; a *=3;//compound assignment System.out.println(a); Ans:- 30 Q)What is the output of the following piece of code? int a=10,b; b=++a;//pre-incrementation System.out.println(b); Ans:- 11 Q)What is the output of the following piece of code? int a=10,b; b=a++;//post-incrementation System.out.println(b); Ans:- 10 Q)Explain about relational operators. =>relational operators are also known as comarision operators. =>They are used to compare two values and return a boolean value. =>As they act upon two operands, they are binary operators. =>The following are the relational operators. ==(equality operator) !=(inequality operator) > >= < <= Q)What is the output of the following piece of code? int a=10,b=20; System.out.println(a==b); Ans:- false Q)What is the output of the following piece of code? int a=10,b=20; System.out.println(a!=b); Ans:-true Q)What is the output of the following piece of code? int a=10,b=10; System.out.println(a<=b); Ans:- true Q)Explain about logical operators. =>There are 3 logical operators. 1)&&(logical and operator) 2)|| (logical or operator) 3)! (logical not operator) Q)Explain about "logical and" operator. =>It is a binary operator =>It is used to combine two relational expressions =>It acts upon 2 operands and returns a boolean value. =>It returns true if and only if both the operands are true. Result T && F F F && T F F && F F T && T T Q)What is the output of the following piece of code? int a=10,b=20,c=40; System.out.println(a>b && bIt is a binary operator || is the logical or oeprator =>It is used to combine two relational expressions =>It acts upon 2 operands and returns a boolean value. =>It returns true if atleast one operand is true. Result T || F T F || T T F || F F T || T T Q)What is the output of the following piece of code? int a=10,b=20,c=40; System.out.println(a>b || bIt is a unary operator =>It acts upon a boolean expression and complements it. Q)What is the output of the following piece of code? int a=10,b=20,c=40; System.out.println(!(a>b || bsequence is the feature of a program by which, its code is executed sequentially line by line(line after the line). Note:- By default, every Java program has sequence feature. Q)What is "selection" feature? =>selection is the ability of a program to select some portion of code for execution when some condition is satisfied. Note:- selection feature is not implicit(automatic) in a Java program Q)What is repetetion? =>repetetion is the ability of a program to execute some portion of code repeatedly. Note:- repetetion feature is not implicit(automatic) in a Java program Q)What is a flow control statement?How are flow control statements classified? =>A statement that controls the order of execution of the other statements of the program is nothing but a flow control statement. =>There are two types of flow control statements in Java. 1)Selection statements/branching statements 2)iteration statements/repetetion statements/looping statements Q)What are the branching statements in Java? =>There are 5 branching(selection/decision making) statements in Java. 1)simple if statement 2)if else statement 3)if else ladder statement 4)nested if statement 5)switch statement Note:- These statements provide "selection" feature to Java application. Q)What are the iteration statements in Java? 1)for statement 2)enhanced for statement(for each statement) 2)while statement 3)do while statement