Skip to content
← Information Technology

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.

13

Q&A

6

Concepts

Not available

Exam weightage

Start learning — read this chapter →

Key concepts

Hover a concept to preview it and jump to its most relevant Q&A.

Chapter contents

The NCERT structure, section by section. Open a section to see its questions, then read the concept-first solution.

1

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…

2

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.

3

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.

4

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.

5

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.

6

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 questions13 questions
  1. Q1What is a program? Explain how Java source code becomes a running program, naming the roles of the compiler, bytecode and the JVM.Free
  2. Q2What is an IDE? List four facilities an IDE provides to a programmer.Free
  3. 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
  4. Q4Differentiate between a variable and a constant in Java, giving one example of each declaration.Preview
  5. 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
  6. Q6What is the difference between the `=` operator and the `==` operator? Give an example where confusing them causes a bug.Preview
  7. 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
  8. 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
  9. Q9Explain the difference between a `while` loop and a `do...while` loop. Write a `while` loop that prints the numbers 1 to 5.Preview
  10. 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
  11. Q11What is the modular approach to programming? Write a Java method `factorial(int n)` that returns n!, and call it from `main`.Preview
  12. 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
  13. Q13List the steps of a good problem-solving procedure in programming, and write an algorithm to find the larger of two numbers.Preview