0% found this document useful (0 votes)
2 views2 pages

Class 10 Java Programming Answers

The document provides answers to common Class 10 Computer Science questions, including the use of flowcharts in programming, syntax and examples of 'if...else' statements in Java, and the Scanner class for user input. It also explains the difference between entry-controlled and exit-controlled loops and includes a Java program to check if a number is even or odd. Overall, it serves as a study guide for key programming concepts in Java.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Class 10 Java Programming Answers

The document provides answers to common Class 10 Computer Science questions, including the use of flowcharts in programming, syntax and examples of 'if...else' statements in Java, and the Scanner class for user input. It also explains the difference between entry-controlled and exit-controlled loops and includes a Java program to check if a number is even or odd. Overall, it serves as a study guide for key programming concepts in Java.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Sample Set 1 - Class 10 Computer Answers

1. What is the use of a flowchart in programming?

Flowcharts help in visually representing the logic of a program. They make it easier to understand,

analyze, and debug the flow of control in a program.

2. Write the syntax and example of 'if...else' statement in Java.

Syntax:

if (condition) {

// statements

} else {

// statements

Example:

if (a > b) {

[Link]("A is greater");

} else {

[Link]("B is greater");

3. What is the use of Scanner class? Give example.

Scanner class is used to take input from the user in Java. Example:

Scanner sc = new Scanner([Link]);

int num = [Link]();

4. What is the difference between entry-controlled and exit-controlled loop?

Entry-controlled loops check the condition before executing the loop (e.g., 'for', 'while').

Exit-controlled loops check the condition after executing the loop once (e.g., 'do-while').

5. Write a program in Java to check whether the number is even or odd.

import [Link].*;

class EvenOdd {
public static void main(String args[]) {

Scanner sc = new Scanner([Link]);

int n;

[Link]("Enter a number: ");

n = [Link]();

if (n % 2 == 0)

[Link]("Even number");

else

[Link]("Odd number");

You might also like