0% found this document useful (0 votes)
2 views

ComputerNotes_2

The document provides exam-ready notes for Class VIII on programming with Java, covering key concepts such as operators, conditional statements, and logical operators. It includes multiple-choice questions, fill-in-the-blanks, true/false statements, and short answer questions with examples. The notes emphasize the importance of concatenation, decision-making, and the use of if-else constructs in programming.

Uploaded by

agrawalnaveen741
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

ComputerNotes_2

The document provides exam-ready notes for Class VIII on programming with Java, covering key concepts such as operators, conditional statements, and logical operators. It includes multiple-choice questions, fill-in-the-blanks, true/false statements, and short answer questions with examples. The notes emphasize the importance of concatenation, decision-making, and the use of if-else constructs in programming.

Uploaded by

agrawalnaveen741
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Class VIII

Exam Ready Notes


CHAPTER @ 6:Programming with java-2
A. Choose the correct answer
1. _____Operator creates an object of the specified class.
Ans) New
2. Which of the following is a valid concatenation operation?
Ans) 23 + “Hello”.
3. If a=3, then ____- operator will return true for the
condition(a==4)
Ans) !
4. ____ construct is most suitable to check a value by comparing it
with known values ?
Ans) if
5. Which of the following is a binary operator?
Ans) Both (&& and ||)

B. Fill in the blanks


1. Else block executes when condition with if block returns false.
2. Both && and || are binary operator and ! operator is unary .
3. In if-else and if construct, the condition is specified with
if block .
4. Ravi was born before Anu .His age compares with Anu’s by
‘>’ operator.
5. Multiple conditions are combined with logical operators &&
and ||.
C. True and False
1. + Operator is also used as concatenation operator. {TRUE}
2. In decision- making , using “else ” is compulsory. {FALSE}
3. Logical operators are used to evaluate multiple conditions. {TRUE}
4. If the first condition is true, || will still compare rest of the values.
{FALSE}
5. if construct is used to execute statements repeatedly. {FALSE}
D. Answer the following
1.What is concatenation? How + operator helps in it? Explain with an
example.
Ans) Concatenation is the process of combing two or more string,
variables etc into one single string.
Example: int sq=5*5;
System.out.println(“The sq of 5 is:”+sq);
2.What is the significance of logical operators in decision- making?
What does ! operator do?
Ans) A Logical operator helps in evaluating more then on condition and
return true or false, effectively controlling the flow of a program.
!(Not) operator checks the reverse of a condition, it is also known as
Unary operator.
3.Give a small example , to explain the use of if-else if ?
Ans) class Pos_Neg
{
public static void main()
{ int a=8;
if(a<0)
System.out.print(“Number is negative”);
else if (a>0)
System.out.print(“Number is positive.”);
else
System.out.print(“Number is Zero”);
}
}

You might also like