0% found this document useful (0 votes)
16 views3 pages

Class Test

Uploaded by

Study Success
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

Class Test

Uploaded by

Study Success
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

CLASS TEST-X COMPUTER APPLICATIONS ANSWERS

Answer 1.The output will be:

The value of c is 20

Answer 2.The output will be:

Terminal

Answer 3.

a. The size of the array is 8.

b. The position of 12 is 3rd and 7th .

Answer 4.The output will be:

False

PUR

Answer 5.

a.The value of p is 5.

b. 7+10*3=37

The value of q =37

Answer 6.The input statements are as follows:

1. Integer- sc.nextInt();
2. Double- sc.nextDouble();
3. String- sc.next(); or sc.nextLine();
Answer 7.

System.out.print System.out.println
1. The cursor remains on the same line of the 1. The cursor moves to the next line of the
screen after producing the result. screen after producing the result.
2. The result is printed on the same line. 2. The result is printed on multiple lines.
Syntax: Syntax:
System.out.print(“HELLO”); System.out.println(“HELLO”);
System.out.print(“COMPUTER”); System.out.println(“COMPUTER”);

Output: Output:
HELLO COMPUTER HELLO
COMPUTER

Answer 8.

If statement Switch case statement


1. It is a conditional statement used to check 1. It is a multi-branching conditional
the condition and give appropriate results. statement used when we have multiple
conditions for one variable.

Syntax: Syntax:
if(condition) switch(variable)
{ {
expression 1; case 1:
} {
else expression;
{ break;
expression 2; }
} case 2:
{
expression;
break;
}
case 3:
{
expression;
break;
}
}

Answer 9:

//store 5 names
import java.util.Scanner;

class name

public static void main()

String s[]=new String[5];

int i;

Scanner sc=new Scanner(System.in);

for(i=0;i<5;i++)

System,.out.println(“Enter any name”);

s[i]=sc.next();

System.out.println(“The names you had entered are”);

for(i=0;i<5;i++)

System.out.println(s[i]);

You might also like