KEMBAR78
Icse Theory Notes | PDF | Control Flow | Method (Computer Programming)
0% found this document useful (0 votes)
11 views9 pages

Icse Theory Notes

The document provides an overview of key concepts in computer theory, including compilers, interpreters, and various loop structures. It also covers object-oriented programming principles such as abstraction, encapsulation, inheritance, polymorphism, and method overloading. Additionally, it discusses error types, comments, escape sequences, and ASCII encoding.
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)
11 views9 pages

Icse Theory Notes

The document provides an overview of key concepts in computer theory, including compilers, interpreters, and various loop structures. It also covers object-oriented programming principles such as abstraction, encapsulation, inheritance, polymorphism, and method overloading. Additionally, it discusses error types, comments, escape sequences, and ASCII encoding.
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
You are on page 1/ 9

computer theory.

Compiler

⦁ The compiler saves the Machine Language in form of Machine Code on disks.

⦁ Compiled codes run faster than Interpreter.

⦁ Any change in the source program after the compilation requires recompiling the entire
code.

Interpreter

⦁ The Interpreter does not save the Machine Language.

⦁ Interpreted codes run slower than Compiler.

⦁ The interpreter does not generate any output.

break

The break keyword in Java is used to terminate the execution of a loop or switch statement
prematurely. When a break statement is encountered, control is transferred to the statement
immediately following the enclosing loop or switch.

continue

The continue keyword is used to skip the current iteration of a loop (for, while, or do-while) and
proceed to the next iteration. It is particularly useful for controlling the flow of loops when
certain conditions are met, allowing for more readable and efficient code.

Pass by value

A copy of the variable's value is passed to the method

The method uses the copy, not the original variable

1
Changes to the variable in the method do not affect the original variable

Pass by reference

A reference to the variable is passed to the method

The method accesses the original variable

Changes to the variable in the method also affect the original variable

For loops

Used when you know how many times to run a code block

Also known as entry-controlled loops

Can iterate over arrays, strings, and other sequences

A concise way to write loop structure

Easy to debug

While loops

Used to execute a set of statements while a condition is true

Also known as entry-controlled loops

Evaluates the condition before executing the loop body

Repeats until the condition is no longer true

Do-while loops

Similar to while loops, but the condition is checked at the end of the loop

Also known as exit-controlled loops

The code block runs once if the condition is not true

2
Abstraction

Data Abstraction is the property by virtue of which only the essential details are displayed to
the user. The trivial or non-essential units are not displayed to the user. Ex: A car is viewed as a
car rather than its individual components.

Encapsulation

It is defined as the wrapping up of data under a single unit. It is the mechanism that binds
together the code and the data it manipulates.

Inheritance

Inheritance is an important pillar of OOP (Object Oriented Programming). It is the mechanism in


Java by which one class is allowed to inherit the features (fields and methods) of another class.
We are achieving inheritance by using extends keyword.

Polymorphism

It refers to the ability of object-oriented programming languages to differentiate between


entities with the same name efficiently. This is done by Java with the help of the signature and
declaration of these entities. The ability to appear in many forms is called polymorphism.

Method Overloading

Also, known as compile-time polymorphism, is the concept of Polymorphism where more than
one method share the same name with different signature(Parameters) in a class. The return
type of these methods can or cannot be same.

Advantage of OOPs over Procedure-Oriented Programming Language

⦁ OOP promotes code reusability

⦁ OOP enhances code organization

3
⦁ OOP enables faster development

Data hiding

Data hiding is the practice of concealing information so that it is inaccessible to unauthorized


users.

Autoboxing refers to the conversion of a primitive value into an object of the corresponding
wrapper class is called autoboxing. For example, converting int to Integer class. The Java
compiler applies autoboxing when a primitive value is:

⦁ Passed as a parameter to a method that expects an object of the corresponding


wrapper class.

⦁ Assigned to a variable of the corresponding wrapper class.

4
Unboxing refers to converting an object of a wrapper type to its corresponding primitive value.
For example conversion of Integer to int. The Java compiler applies to unbox when an object of
a wrapper class is:

⦁ Passed as a parameter to a method that expects a value of the corresponding primitive


type.

⦁ Assigned to a variable of the corresponding primitive type.

Object

⦁ An object is a basic unit of Object-Oriented Programming

5
⦁ An object represents a real-world entity

⦁ An object has attributes and methods that it inherits from its class

Class

⦁ A class is a template for creating objects

⦁ A class defines the attributes and behaviors of objects of a certain type

Token

⦁ A token is a sequence of characters that has meaning to the compiler

⦁ Tokens are the basic building blocks of a program

⦁ Tokens represent elements of a program, such as keywords, operators, identifiers, and


literals

⦁ Tokens are separated from other tokens by delimiters

Actual parameters are those parameters that are specified in the calling function. While on the
other hand, formal parameters are those parameters that are declared in the called function.

Three Types of Errors

Syntax error

When we run a program with a syntax error, the computer immediately reports an error in the
console. It doesn't even try to execute the first line of the program. Because syntax errors deal
with the structure of the code, the linter can often catch these errors upfront.

Logical error

Logical error occur when there is a fault in the logic or structure of the problem. Logic errors do
not usually cause a program to crash. However, logic errors can cause a program to produce
unexpected results.

Runtime error

A runtime error occurs when a program you're using or writing crashes or produces a wrong
output. There are several types of runtime errors, such as a logic error, a memory leak, a

6
division by zero error, an undefined object error, an I/O device error, and an encoding error.

Two Types of Comments

// single line comment

/*

multiline comment

*/

escape sequence

A character with a backslash (\) just before it is an escape sequence or escape character. We
use escape characters to perform some specific task.

7
ASCII (American Standard Code for Information Interchange) is a standard character encoding
used in telecommunication.It is an 8-bit code.

A-Z (65-90) a-z(97-122) 0-9 (48-57)

8
9

You might also like