Information Technology · Class 11 Commerce
Ch 2Introduction to Programming — Class 11 Information Technology, concept-first.
A computer cannot think — it only carries out instructions given to it, exactly and in order. A program is an ordered set of such instructions written to make a computer perform a specific task, and programming is the activity of designing, writing, testing and correcting those instructions.
Key concepts
Hover a concept to preview it and jump to its most relevant Q&A.
Programming and the IDE
A program is an ordered set of instructions that makes a computer perform a task, written in a high-level language — here Java.
Most relevant Q&A
- What is a program? Explain how Java source code becomes a running program, naming the roles of the compiler, bytecode and the JVM.Free
- What is an IDE? List four facilities an IDE provides to a programmer.Free
- Write a complete Java program that prints your school's name on the screen, and briefly explain the purpose of the `main` method and `System…Free
Chapter contents
The NCERT structure, section by section. Open a section to see its questions, then read the concept-first solution.
Getting Started with Programming Using an IDE
A computer cannot think — it only carries out instructions given to it, exactly and in order. A program is an ordered set of such instructions written to make a computer perform a specific task, and p…
Programming Fundamentals — Data Types, Variables and Constants
Programs work with data — numbers, characters and true/false values. To store and use data, Java needs to know what kind of value it is dealing with, so every piece of data has a data type.
Operators and Expressions
An operator is a symbol that performs an operation on one or more values (operands); an expression combines operands and operators to produce a result, e.g. total = price quantity.
Control Structures — Decision Making
By default a program runs its statements sequentially, top to bottom. But real problems need the program to choose between actions depending on conditions.
Control Structures — Looping
A loop (iteration) repeats a block of statements as long as a condition remains true. Loops save us from writing the same code many times — printing 1 to 100 needs one loop, not a hundred statements.
Programming Guidelines — Modular Approach, Debugging and Problem Solving
Writing a working program is only half the job; writing one that is easy to read, test and correct is the other half. This is what programming guidelines are about.
Exercises
+−Show 13 questionsHide questions13 questions
- Q1What is a program? Explain how Java source code becomes a running program, naming the roles of the compiler, bytecode and the JVM.Free
- Q2What is an IDE? List four facilities an IDE provides to a programmer.Free
- Q3Write a complete Java program that prints your school's name on the screen, and briefly explain the purpose of the `main` method and `System…Free
- Q4Differentiate between a variable and a constant in Java, giving one example of each declaration.Preview
- Q5Predict the output of the following code and explain why: ```java int a = 17, b = 5; System.out.println(a / b); System.out.println(a % b); S…Preview
- Q6What is the difference between the `=` operator and the `==` operator? Give an example where confusing them causes a bug.Preview
- Q7Write a Java program using an `if...else if` ladder that reads a student's marks (0–100) and prints the division: 75 and above → "Distinctio…Preview
- Q8When is a `switch` statement preferable to an `if...else if` ladder? Rewrite the following as a `switch`: ```java if (choice == 1) System.ou…Preview
- Q9Explain the difference between a `while` loop and a `do...while` loop. Write a `while` loop that prints the numbers 1 to 5.Preview
- Q10Write a Java program using a `for` loop to calculate and print the sum of the first N natural numbers, where N is entered by the user.Preview
- Q11What is the modular approach to programming? Write a Java method `factorial(int n)` that returns n!, and call it from `main`.Preview
- Q12Describe the three types of programming errors — syntax, runtime and logical — with one example of each. Which is the hardest to find, and w…Preview
- Q13List the steps of a good problem-solving procedure in programming, and write an algorithm to find the larger of two numbers.Preview