Skip to content
Computer ScienceISC Class 12 · Chapter 4

Programming in Java: Review of Class XI for ISC Class 12 Computer Science

Updated 15 October 2026 · Fact-checked

The Class 12 syllabus begins by reviewing the Java covered in Class XI: program structure, data types, operators, decisions, loops, methods, arrays and strings. The aim is not to relearn syntax but to solve harder problems with these tools, as Section B of the board paper expects complete, well-documented Java classes.

What Programming in Java (Review of Class XI Sections B and C) is about

The syllabus line is: 'Programming in Java (Review of Class XI Sections B and C). Note that items 4 to 13 should be introduced almost simultaneously along with classes and their definitions. While reviewing, ensure that new higher order problems are solved using these constructs.'

So this chapter is a bridge: it revises the building blocks and then uses them on problems of board difficulty. The detailed treatment of each construct follows in the next chapters: Objects; Primitive Values, Wrapper Classes, Types and Casting; Variables, Expressions; Statements, Scope; Methods; Arrays, Strings; Recursion.

What to revise:
1. How a Java program is compiled and run (source → bytecode → JVM).
2. Structure of a class with data members, constructors, methods and main( ).
3. Operators, precedence and output-prediction questions.
4. Control flow: if, switch, loops, break and continue.
5. Number-based algorithms (digits, primes, special numbers), series and patterns.

The syllabus says the Java version should be 5.0 or later and strongly recommends BlueJ. All programs on this page were compiled and run, and the outputs shown are the actual outputs.

Weightage: CISCE publishes no chapter or unit weightage for ISC Computer Science. Programming in Java (Review of Class XI Sections B and C) is part of Section B, 4 of the 2027 syllabus and can be asked anywhere in the 70-mark Paper 1 (Part I compulsory: ten 1-mark items and a 10-mark short-answer question; Part II: two of three 10-mark questions in each of Sections A and B, and two of three 5-mark questions in Section C).Source: CISCE ISC Computer Science (868) syllabus, examination year 2027; latest Paper 1 specimen (2025) and the 2025 board paper

Key concepts

How Java runs: source, bytecode and the JVM

1. Source code is written in a .java file.
2. The compiler (javac) translates it into bytecode (.class file), an intermediate code that is not specific to any processor.
3. The Java Virtual Machine (JVM) on each computer interprets (and just-in-time compiles) the bytecode into machine instructions.

This gives platform independence ('write once, run anywhere'): the same .class file runs on any system with a JVM.

Other features of Java: object-oriented; robust (strong type checking, exception handling, automatic garbage collection); secure; supports multithreading; a large standard library (java.lang, java.util, java.io).

The JDK (Java Development Kit) contains the compiler and tools; the JRE (Java Runtime Environment) contains the JVM and libraries needed to run programs. BlueJ is an IDE that lets you create objects interactively and call methods without writing main( ), which is useful for learning, but board answers must still include main( ).

Worked example

[2] What is bytecode, and why does it make Java platform independent? (Understand)

Try it first, then show the solutionSolution
  1. Bytecode: the intermediate code produced by the Java compiler in a .class file - 1 mark.
  2. Any machine with a JVM can run the same bytecode, so the program need not be recompiled for each platform - 1 mark.

Answer: Bytecode is the machine-independent intermediate code the Java compiler produces. Because every platform has its own JVM that executes bytecode, the same compiled program runs on any system: Java is platform independent.

Structure of a Java class

A typical ISC program:

import java.util.Scanner;        // library import

public class Name                // class header
{
    int a;                        // data members (instance variables)
    static int count;             // class variable

    Name()                        // constructor
    {
        a = 0;
    }

    void accept() { }             // methods
    int compute(int x) { return x * 2; }

    public static void main(String[] args)
    {
        Name ob = new Name();     // create an object
        ob.accept();              // call methods
    }
}

Key points:
1. Only one public class per file, and the file name must match it.
2. main( ) is public, static, void and takes String[] args; execution starts there.
3. Statements end with semicolons; blocks are enclosed in braces.
4. Comments: // single line, /* multi-line */, /** documentation */.
5. Identifiers: letters, digits, _ and the currency sign; cannot start with a digit; cannot be a keyword; Java is case-sensitive.
6. Naming conventions: classes in PascalCase (KaprekarRange), methods and variables in camelCase (isKaprekar), constants in UPPER_CASE.

Worked example

[2] Why is main( ) declared static, and what is the role of String[] args? (Understand)

Try it first, then show the solutionSolution
  1. static: the JVM can call main( ) without first creating an object of the class - 1 mark.
  2. String[] args receives command-line arguments as an array of strings - 1 mark.

Answer: main( ) is static so that the JVM can call it using the class name before any object exists; String[] args holds any command-line arguments passed to the program.

Operators and output prediction

Arithmetic: + - * / % (integer division truncates: 7 / 2 = 3; % gives the remainder: 7 % 2 = 1).
Relational: < <= > >= == != (result boolean).
Logical: && (and), || (or), ! (not), with short-circuit evaluation.
Increment and decrement: x++ (use then increase), ++x (increase then use).
Assignment: = and compound += -= *= /= %=.
Ternary: condition ? a : b.

The + operator with strings: once a String operand appears (scanning left to right), + means concatenation. "ISC" + 1 + 2 gives ISC12, but 1 + 2 + "ISC" gives 3ISC.

Outputs of a review program:

// Short review fragments used on the page: operators, casting, conditional and loop outputs.
public class Review
{
    public static void main(String[] args)
    {
        int a = 7, b = 2;
        System.out.println(a / b + " " + a % b + " " + (double) a / b);
        int x = 5;
        int y = x++ + ++x;            // 5 + 7
        System.out.println(x + " " + y);
        char ch = 'A';
        ch += 2;
        System.out.println(ch + " " + (int) ch);
        String s = "ISC";
        System.out.println(s + 1 + 2);
        System.out.println(1 + 2 + s);
        int sum = 0;
        for (int i = 1; i <= 10; i += 3)
            sum += i;                 // 1 + 4 + 7 + 10
        System.out.println(sum);
        int k = 10;
        do
        {
            k -= 4;
        } while (k > 0);
        System.out.println(k);
    }
}

Output:

3 1 3.5
7 12
C 67
ISC12
3ISC
22
-2

Working: 7 / 2 = 3, 7 % 2 = 1, (double) 7 / 2 = 3.5; y = x++ + ++x = 5 + 7 = 12 and x ends at 7; 'A' + 2 = 'C' (code 67); the for loop adds 1, 4, 7, 10 = 22; the do-while subtracts 4 from 10 until k is not positive: 6, 2, -2.

Worked example

[2] Give the output: int x = 5; int y = x++ + ++x; System.out.println(x + " " + y); (Apply)

Try it first, then show the solutionSolution
  1. x++ uses 5, then x becomes 6; ++x makes x 7 and uses 7 - 1 mark.
  2. y = 5 + 7 = 12; prints 7 12 - 1 mark.

Answer: 7 12

Control flow review: decisions and loops

Decisions: if, if-else, if-else-if ladder, nested if, switch-case (with break to prevent fall-through; default for other values), ternary operator.
Loops:

  • for: when the number of iterations is known (counter-controlled).
  • while: entry-controlled; may run zero times.
  • do-while: exit-controlled; runs at least once.

Jumps: break exits the nearest loop or switch; continue skips to the next iteration.

Nested loops are used for patterns and 2D arrays. Pascal's triangle shows a useful idea: each entry can be calculated from the previous one in the same row.

// Prints the first n rows of Pascal's triangle using nested loops.
// Each entry is found from the previous one: c = c * (r - k) / (k + 1).
public class Pascal
{
    public static void main(String[] args)
    {
        int n = 5;
        for (int r = 0; r < n; r++)
        {
            int c = 1;
            for (int k = 0; k <= r; k++)
            {
                System.out.print(c + " ");
                c = c * (r - k) / (k + 1);
            }
            System.out.println();
        }
    }
}

Output:

1 
1 1 
1 2 1 
1 3 3 1 
1 4 6 4 1

Worked example

[2] How many times does the body of do { k -= 4; } while (k > 0); run when k starts at 10, and what is the final k? (Apply)

Try it first, then show the solutionSolution
  1. k: 10 → 6 (6 > 0, repeat) → 2 (repeat) → -2 (stop) - 1 mark.
  2. The body runs 3 times; final k = -2 - 1 mark.

Answer: Three times; k ends at -2.

Higher-order problem solving: special numbers

ISC programs often test a number against a definition. Build them from reusable steps: count digits, extract digits, reverse, sum of digits, divisors, prime test, square and split.

Kaprekar number: a positive integer n with d digits such that when n² is split into a right part with d digits and a left part with the remaining digits, the two parts add up to n (the right part must not be 0). Examples: 9 (81 → 8 + 1), 45 (2025 → 20 + 25), 297 (88209 → 88 + 209).

import java.util.Scanner;

// Lists the Kaprekar numbers between p and q.
// n (with d digits) is a Kaprekar number if n*n split into a right part of d digits
// and a left part (the remaining digits) gives parts whose sum is n. Example: 45*45 = 2025, 20 + 25 = 45.
public class KaprekarRange
{
    int p, q;

    KaprekarRange()
    {
        p = 0;
        q = 0;
    }

    void accept()
    {
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter the lower and upper limits:");
        p = sc.nextInt();
        q = sc.nextInt();
    }

    // number of digits in n
    int digits(int n)
    {
        int c = 0;
        while (n > 0)
        {
            c++;
            n = n / 10;
        }
        return c;
    }

    boolean isKaprekar(int n)
    {
        long sq = (long) n * n;
        long div = 1;
        for (int i = 1; i <= digits(n); i++)
            div = div * 10;              // 10 raised to the number of digits
        long right = sq % div;
        long left = sq / div;
        return right > 0 && left + right == n;
    }

    void display()
    {
        int count = 0;
        System.out.print("Kaprekar numbers:");
        for (int n = p; n <= q; n++)
        {
            if (isKaprekar(n))
            {
                System.out.print(" " + n);
                count++;
            }
        }
        System.out.println();
        System.out.println("Frequency: " + count);
    }

    public static void main(String[] args)
    {
        KaprekarRange ob = new KaprekarRange();
        ob.accept();
        ob.display();
    }
}

Input: 1 1000

Enter the lower and upper limits:
Kaprekar numbers: 1 9 45 55 99 297 703 999
Frequency: 8

Points to note: n * n is stored in a long to avoid int overflow for larger n; div = 10^d is built with a loop (or (long) Math.pow(10, d)); the right part must be positive.

Worked example

[2] Show that 703 is a Kaprekar number. (Apply)

Try it first, then show the solutionSolution
  1. 703² = 494209; 703 has 3 digits, so split as 494 | 209 - 1 mark.
  2. 494 + 209 = 703, and the right part is not zero, so 703 is a Kaprekar number - 1 mark.

Answer: 703² = 494209 → 494 + 209 = 703, so 703 is a Kaprekar number.

Programming in Java (Review of Class XI Sections B and C) in real life

Each concept, met in an everyday situation. Read the situation, answer the question in your own words, then compare with the model answer. The one-line hook is what to remember.

Platform independence

Imagine sending a recipe written in a universal shorthand that every kitchen has a translator for, instead of rewriting it for each chef's language.

Which parts of Java correspond to the shorthand and the translator?

Try it first, then show the solutionSolution
  1. The universal shorthand is bytecode, produced once by the compiler.
  2. Each kitchen's translator is the JVM installed on each computer.

Answer: Bytecode is the shared shorthand and the JVM is each machine's translator, which is why one compiled Java program runs anywhere.

Memory hook: Compile once, run anywhere.

Integer division

Suppose 7 friends share pizzas that come in boxes of 2 slices each, and a program computes boxes = 7 / 2.

What will the program store, and how should it be fixed if a part box counts as a full box?

Try it first, then show the solutionSolution
  1. 7 / 2 with ints gives 3 (the fraction is discarded); 7 % 2 = 1 slice is left over.
  2. Use (7 + 1) / 2 = 4, or 7 / 2 + (7 % 2 == 0 ? 0 : 1).

Answer: It stores 3, losing the remainder; rounding up needs (n + 1) / 2 or a check on n % 2.

Memory hook: int division chops, % keeps what is chopped.

do-while for menus

Imagine an ATM that must show its menu at least once and then repeat until the user chooses Exit.

Which loop fits and why?

Try it first, then show the solutionSolution
  1. The menu must appear at least once before any condition is tested.
  2. do-while tests its condition after the body.

Answer: A do-while loop, because it always runs the body (shows the menu) once and repeats while the choice is not Exit.

Memory hook: Do first, ask later.

Topics in this chapter

Programming in Java (Review of Class XI Sections B and C): syntax and key facts

Integer division and remainder
a / b truncates; a % b remainder; a == (a / b) * b + a % b
7 / 2 = 3, 7 % 2 = 1.
Increment
x++ uses then adds; ++x adds then uses
x = 5: x++ + ++x = 5 + 7.
String + number
"ISC" + 1 + 2 = ISC12; 1 + 2 + "ISC" = 3ISC
Left to right.
Pascal entry
next = current × (r - k) / (k + 1)
Row r, position k.
Kaprekar test
n² = left × 10^d + right; left + right == n and right > 0
d = digits of n.

How the board asks Programming in Java (Review of Class XI Sections B and C)

The question patterns to expect, and the method that works for each.

Question typeHow it is askedMethod
Part I one-mark itemsOutput of a short expression; difference between while and do-while; meaning of bytecode or JVM.Trace precisely; apply precedence and integer division.
Section B programs [10]A class to test or list special numbers, series or patterns, using the constructs reviewed here.Break into methods; follow the given class specification exactly.
Output and fill-in questions [2]-[3]Trace loops and conditions; complete missing expressions.Trace table and a check with one example.
Practical paper problemsNumber, matrix and string problems requiring an algorithm, documented program and output.Test with the sample data given and with boundary values.

Tricks to remember Programming in Java (Review of Class XI Sections B and C)

Short memory aids. Say each one aloud once, then use it on a question the same day.

  • Source → Bytecode → JVM

    'Some Bears Jump': Source, Bytecode, JVM.

    Use it when: How Java runs.

  • Loop choice

    Know the count: for. Maybe zero times: while. At least once: do-while.

    Use it when: Choosing loops.

  • String takes over

    Once a String joins a +, everything after it is glued, not added.

    Use it when: Concatenation outputs.

Programming in Java (Review of Class XI Sections B and C): board-level solved questions

Ordered from board level to HOTS. Cover the solution, write your own, then compare step by step.

Example 1: Concatenation · 1 mark · MCQBoard level

What is printed by System.out.println(2 + 3 + "5" + 2 + 3); ?
(a) 10
(b) 5523
(c) 2355
(d) 555

Try it first, then show the solutionSolution
  1. 2 + 3 = 5 (numbers first); then "5" makes it a string: "55".
  2. Then + 2 → "552" and + 3 → "5523".

Answer: (b) 5523.

Example 2: Loop count · 1 mark · Very short answerBoard level

How many times does for (int i = 1; i <= 10; i += 3) execute its body, and what is the sum of the i values?

Try it first, then show the solutionSolution
  1. i = 1, 4, 7, 10, then 13 fails.
  2. Four times; sum 1 + 4 + 7 + 10 = 22 (confirmed by the Review program output).

Answer: Four times; sum = 22.

Example 3: Assertion-reason: switch · 1 mark · Assertion-reasonHarder board level

Assertion (A): Without break, a matching case in a switch also executes the statements of the following cases.
Reason (R): break transfers control out of the switch block.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.

Try it first, then show the solutionSolution
  1. A describes fall-through: true.
  2. R is true, and fall-through happens precisely because, without break, control is not transferred out: R explains A.

Answer: (a) Both A and R are true and R is the correct explanation of A.

Example 4: Kaprekar method · 5 marks · Long answerHarder board level

[5] Write a method boolean isKaprekar(int n) that returns true if n is a Kaprekar number, and test it for 45, 46 and 297. (Create)

Try it first, then show the solutionSolution
  1. Count the digits d of n; compute sq = n × n as long.
  2. div = 10^d; right = sq % div; left = sq / div.
  3. Return right > 0 && left + right == n (code as in KaprekarRange above).
  4. 45: 2025 → 20 + 25 = 45 → true. 46: 2116 → 21 + 16 = 37 → false.
  5. 297: 88209 → 88 + 209 = 297 → true (297 is listed in the program output).

Answer: Method as in the KaprekarRange program; isKaprekar(45) = true, isKaprekar(46) = false, isKaprekar(297) = true.

Example 5: Kaprekar class · 10 marks · Long answerHOTS / competency

[10] Design a class KaprekarRange with data members p and q; a constructor; void accept( ) to read p and q; int digits(int n); boolean isKaprekar(int n) which uses digits( ); and void display( ) to print all Kaprekar numbers from p to q and their frequency. Write main( ). (Create)

Try it first, then show the solutionSolution
  1. Data members int p, q; constructor sets both to 0.
  2. accept( ): Scanner reads p and q.
  3. digits(int n): count by repeated division by 10.
  4. isKaprekar(int n): long square, divisor 10^digits(n), right and left parts, test right > 0 and sum = n.
  5. display( ): loop n from p to q, print each Kaprekar number, count them, print the frequency.
  6. main( ): create the object, call accept( ) and display( ). For input 1 1000 the program prints 1 9 45 55 99 297 703 999 and frequency 8.

Answer: See the compiled KaprekarRange program above; for 1 to 1000 it prints: Kaprekar numbers: 1 9 45 55 99 297 703 999, Frequency: 8.

Example 6: Pattern from a formula · 5 marks · Long answerHOTS / competency

[5] Using nested loops and the rule c = c × (r - k) / (k + 1), print the first five rows of Pascal's triangle. Explain why the order of operations in this rule matters. (Analyse)

Try it first, then show the solutionSolution
  1. Outer loop r from 0 to 4; inner loop k from 0 to r; start each row with c = 1.
  2. Print c, then update c = c * (r - k) / (k + 1).
  3. Output: 1 / 1 1 / 1 2 1 / 1 3 3 1 / 1 4 6 4 1 (as produced by the Pascal program).
  4. Multiplication must happen before division: c * (r - k) is always divisible by (k + 1), so the integer result is exact.
  5. Writing c * ((r - k) / (k + 1)) would truncate the fraction first and give wrong values (for example 0 in row 4).

Answer: Program Pascal above prints the five rows; multiplying before dividing keeps the integer arithmetic exact, whereas dividing first truncates and corrupts the entries.

Case-study practice (Section D style)

Read the situation, then answer every part. In the board paper this is a 6-mark question split into 2 + 1 + 2 + 1 marks.

Output prediction set (case-based)

Consider: int a = 7, b = 2; char ch = 'A'; ch += 2; String s = "ISC";

  1. (i) · 2 marks

    What do a / b, a % b and (double) a / b give?

    Answer

    Answer: 3, 1 and 3.5.

    1 mark for the integer results, 1 for 3.5.

  2. (ii) · 1 mark

    What is printed by System.out.println(ch + " " + (int) ch);?

    Answer

    Answer: C 67

    1 mark.

  3. (iii) · 2 marks

    What are s + 1 + 2 and 1 + 2 + s?

    Answer

    Answer: ISC12 and 3ISC.

    1 mark each.

  4. (iv) · 1 mark

    Why does ch += 2 compile though ch = ch + 2 would not?

    Answer

    Answer: Compound assignment includes an automatic cast back to char; ch + 2 alone is an int.

    1 mark.

Where the marks are

How a typical answer is split into step marks. Show every step: a right final answer alone rarely earns full marks.

[2] Output of x++ + ++x. (2 marks)

StepMarks
Correct order of use and increment.1
Correct printed values.1

[5] Method isKaprekar with tests. (5 marks)

StepMarks
Digit count and square as long.1
Split into left and right parts.2
Correct return condition.1
Test values worked.1

[10] Class KaprekarRange. (10 marks)

StepMarks
Data members and constructor.1
accept( ).1
digits(int).1
isKaprekar(int) using digits( ).3
display( ) with list and frequency.2
main( ).1
Documentation.1

Where students lose marks in Programming in Java (Review of Class XI Sections B and C)

The slips examiners see most often, and what to write instead.

  • Mistake: Forgetting integer division truncates

    Output questions often hinge on 7 / 2 being 3 in int arithmetic.

    Wrong working

    int avg = (7 + 8) / 2; // expecting 7.5

    Right working

    double avg = (7 + 8) / 2.0; // 7.5

    Do this: Make one operand double (2.0 or a cast) before dividing when a fraction is needed.

    Usually costs: 1 mark.

  • Mistake: Missing main( ) or object creation

    CISCE examiners' comments, 2025: in Section B, 'Object creation and method invocation in main( ) wrong, or main( ) omitted; no documentation'. The same report asks teachers to 'Emphasise the importance of writing a main method and commenting the code properly'.

    Do this: Finish every program with main( ) that creates the object and calls the methods; comment each method.

    Usually costs: 1-2 marks.

  • Mistake: Confusing break's role in switch and loops

    CISCE examiners' comments, 2025: on an assertion about break preventing fall-through, candidates 'Confused between options A and B because of the word loop in the Reason'.

    Do this: break exits the nearest switch or loop; in a switch it prevents fall-through. Decide whether the Reason actually explains the Assertion.

    Usually costs: 1 mark.

  • Mistake: Overflow in squares and products

    int holds values up to about 2.1 × 10^9; squaring a 5-digit number can overflow.

    Do this: Store large products in long: long sq = (long) n * n;

    Usually costs: Wrong output for large inputs.

Practice questions on Programming in Java (Review of Class XI Sections B and C)

Write each answer on paper first. Open the hint only if you are stuck, and the answer only when you have finished.

  1. Q1 · 1 mark · Very short answerBoard level

    What is the JVM?

    Hint

    Runs bytecode.

    Answer

    The Java Virtual Machine: software that executes Java bytecode on a particular computer.

  2. Q2 · 1 mark · Very short answerBoard level

    Give the output of System.out.println(17 % 5 * 2);

    Hint

    Left to right, same precedence.

    Answer

    4 (17 % 5 = 2, then 2 * 2).

  3. Q3 · 1 mark · Very short answerBoard level

    State one difference between while and do-while.

    Hint

    When is the condition tested?

    Answer

    while tests the condition before the body (may run zero times); do-while tests after (runs at least once).

  4. Q4 · 1 mark · Very short answerHarder board level

    What is printed by int i = 0; while (i < 5) { if (i == 3) break; i++; } System.out.println(i);?

    Hint

    break when i is 3.

    Answer

    3

  5. Q5 · 2 marks · Short answerHarder board level

    [2] Write a loop to print the first eight terms of 1, 1, 2, 3, 5, 8, ...

    Hint

    Keep two previous terms.

    Answer

    int a = 1, b = 1; for (int i = 1; i <= 8; i++) { System.out.print(a + " "); int c = a + b; a = b; b = c; } prints 1 1 2 3 5 8 13 21.

  6. Q6 · 3 marks · Short answerHarder board level

    [3] Fill in ?1?-?3? so that the method returns the sum of the digits of n raised to the power of their position from the left (for 135: 1¹ + 3² + 5³ = 135). int disarium(int n) { String s = ?1?; int sum = 0; for (int i = 0; i < s.length(); i++) sum += (int) Math.pow(?2?, ?3?); return sum; }

    Hint

    Digit at i, power i + 1.

    Answer

    ?1? = String.valueOf(n) (or "" + n); ?2? = s.charAt(i) - '0'; ?3? = i + 1. For 135 the sum is 1 + 9 + 125 = 135.

  7. Q7 · 5 marks · Long answerHOTS / competency

    [5] Write a method that prints all numbers from 100 to 999 that are equal to the sum of the cubes of their digits.

    Hint

    Armstrong numbers.

    Answer

    for (int n = 100; n <= 999; n++) { int t = n, s = 0; while (t > 0) { int d = t % 10; s += d * d * d; t /= 10; } if (s == n) System.out.print(n + " "); } prints 153 370 371 407.

  8. Q8 · 10 marks · Long answerHOTS / competency

    [10] Design a class Fibo with data members n (number of terms) and an int array f; a constructor; void accept( ); void generate( ) that fills f with the first n Fibonacci terms (1, 1, 2, ...); and void showPrimes( ) that prints the terms that are prime. Write main( ).

    Hint

    Fill the array, then test each term.

    Answer

    Constructor sets n = 0; accept( ) reads n and creates f = new int[n]; generate( ) sets f[0] = f[1] = 1 (if n ≥ 2) and f[i] = f[i - 1] + f[i - 2]; showPrimes( ) prints f[i] if it has no divisor from 2 up to its square root and is at least 2; main( ) calls accept( ), generate( ), showPrimes( ). For n = 10 the terms are 1 1 2 3 5 8 13 21 34 55 and the primes printed are 2 3 5 13.

Test your recall

Answer in your head or on paper first, then open the card. Pulling an answer out of memory makes it stick far better than re-reading.

  1. 1.What does javac produce?Show answer

    Bytecode in a .class file.

  2. 2.7 % 3?Show answer

    1.

  3. 3.Loop that always runs at least once?Show answer

    do-while.

  4. 4.1 + 2 + "A"?Show answer

    "3A".

  5. 5.Kaprekar numbers up to 100?Show answer

    1, 9, 45, 55, 99.

Best order to study it

  1. Compilation, bytecode and JVM.
  2. Class structure and naming rules.
  3. Operators and output prediction.
  4. Decisions, loops, break and continue.
  5. Special-number and pattern programs as full classes.

Quick revision checklist

The night before the exam: can you do each of these without looking?

  • Source (.java) → javac → bytecode (.class) → JVM.
  • main( ): public static void main(String[] args).
  • Integer division truncates; % gives remainder.
  • x++ uses then increments; ++x increments then uses.
  • String + anything = concatenation (left to right).
  • for (known count), while (0+ times), do-while (1+ times); break, continue.
  • Use long for large squares; build methods for digits, primes, reverse.

Programming in Java (Review of Class XI Sections B and C): frequently asked questions

Is Class XI content examined in the ISC board paper?

Class XI is examined by the school, but the Class 12 syllabus reviews its Java because the Class 12 programs use the same constructs. Questions are set on the Class 12 syllabus, which includes this review.

Do I need to write import statements?

Yes, when you use Scanner or other classes outside java.lang: import java.util.Scanner; (or java.util.*).

Which Java version should I assume?

The syllabus says Java 5.0 or later. Avoid very new features (such as var or records) in answers so that your code matches what examiners expect.

Based on: CISCE ISC 2027 Computer Science (868) syllabus; CISCE ISC Computer Science (868) Paper 1 specimen question paper and answer key (latest specimen, 2025); CISCE Analysis of Pupil Performance, ISC Computer Science (868), 2025; CISCE Analysis of Pupil Performance, ISC Computer Science (868), 2024