Skip to content

Latest commit

 

History

History

README.md

Java Coding — 15 Marks & 35 Marks

Total weight: 50 marks. This is the highest-stakes section of TCS IPA. Crack the structure and every question becomes fill-in-the-blanks.

What's Inside

File / Folder Content
JAVA-35-MARKS-COMPLETE-GUIDE.md OOP class-design skeleton + 6 fully worked examples (Course, Employee, Player, Hotel, Medicine, Travel)
JAVA-15-MARKS-COMPLETE-GUIDE.md String/number manipulation patterns with solutions and expected output
Java-Foundations/ ✨ Topic-wise merged programs — learn the building blocks step by step

The 35-Mark Structure (Memorize Once, Apply Everywhere)

Every 35-mark question looks like this:

import java.util.*;

class EntityName {
    // 1. Private fields
    private int id;
    private String name;
    private double value;
    private String category;

    // 2. Parameterized constructor — always write this
    public EntityName(int id, String name, double value, String category) {
        this.id = id;  this.name = name;
        this.value = value;  this.category = category;
    }

    // 3. Getters + Setters for every field
    public int    getId()    { return id;    }
    public String getName()  { return name;  }
    // ... (pattern repeats)
}

public class Solution {

    // Method 1: usually filters / counts / finds average
    public static int countByCategory(EntityName[] arr, String cat) { ... }

    // Method 2: usually sorts ascending or finds extreme value
    public static EntityName[] sortByValue(EntityName[] arr, int threshold) { ... }

    public static void main(String[] args) {
        // Read n objects → call both methods → print results
    }
}

Domains seen in real exams: Course, Employee, Player, FootWear, Medicine, Travel Agency, Hotel, Vehicle, Book, Product.


15-Mark Patterns — Quick Reference

Pattern Key Technique
Reverse a string Two-pointer with StringBuilder
Check palindrome Compare with reversed version
Count vowels/consonants isVowel() helper + loop
First non-repeated char Two-pass with HashMap
Armstrong number Extract digits with % 10, cube and sum
Fibonacci series Iterative with prev + curr
Prime check Trial division up to √n

Back to root