Questions
Questions
Questions
Unit -1: Important Java Questions:
1. Difference between procedure-oriented and object-oriented
programming.
answer
Procedural Programming
Procedural Programming can be defined as a programming model
which is derived from structured programming, based upon the
concept of calling procedure. Procedures, also known as routines,
subroutines or functions, simply consist of a series of computational
steps to be carried out. During a program’s execution, any given
procedure might be called at any point, including by other procedures
or itself.
Object-Oriented Programming
Object-oriented programming can be defined as a programming
model which is based upon the concept of objects. Objects contain
data in the form of attributes and code in the form of methods. In
object-oriented programming, computer programs are designed
using the concept of objects that interact with the real world. Object-
oriented programming languages are various but the most popular
ones are class-based, meaning that objects are instances of classes,
which also determine their types.
Languages used in Object-Oriented Programming:
1 of 33 12-12-2023, 18:52
Questions https://awaisahmed.notion.site/Questions-650d1a8c7efb4edc997c111aa...
• Access Modifier: Defines the access type of the method i.e. from
where it can be accessed in your application. In Java, there are 4
types of access specifiers:
• The return type: The data type of the value returned by the
method or void if it does not return a value.
• Method Name: The rules for field names apply to method names
as well, but the convention is a little different.
2 of 33 12-12-2023, 18:52
Questions https://awaisahmed.notion.site/Questions-650d1a8c7efb4edc997c111aa...
Application of OOPs
Now we have a basic idea of what object-oriented programming
3 of 33 12-12-2023, 18:52
Questions https://awaisahmed.notion.site/Questions-650d1a8c7efb4edc997c111aa...
4 of 33 12-12-2023, 18:52
Questions https://awaisahmed.notion.site/Questions-650d1a8c7efb4edc997c111aa...
clients will initiate requests for services and the servers will provide
that functionality. The client and server either reside in the same
system or communicate with each other through a computer network
or the internet.
• The Internet
5 of 33 12-12-2023, 18:52
Questions https://awaisahmed.notion.site/Questions-650d1a8c7efb4edc997c111aa...
Nowadays each and every data is being stored and processed, the
traditional model of storing data i.e the relational model stores each
and every piece of data in tables that consist of rows and columns.
However as complexity grows, storing in the form of tables becomes
quite cumbersome, here the need for storing in the form of real-world
objects comes into the picture. These databases try to maintain a
direct correspondence between the real-world and database objects
in order to let the object retain its identity and integrity. They can then
be identified and operated upon.
6 of 33 12-12-2023, 18:52
Questions https://awaisahmed.notion.site/Questions-650d1a8c7efb4edc997c111aa...
AI Expert Systems
7 of 33 12-12-2023, 18:52
Questions https://awaisahmed.notion.site/Questions-650d1a8c7efb4edc997c111aa...
8 of 33 12-12-2023, 18:52
Questions https://awaisahmed.notion.site/Questions-650d1a8c7efb4edc997c111aa...
1. Simple
2. Object-Oriented
3. Portable
4. Platform independent
5. Secured
6. Robust
7. Architecture neutral
8. Interpreted
9. High Performance
10. Multithreaded
11. Distributed
12. Dynamic
1. In detail explain the structure of the Java Program.
answer
9 of 33 12-12-2023, 18:52
Questions https://awaisahmed.notion.site/Questions-650d1a8c7efb4edc997c111aa...
program, easily.
• Documentation Section
• Package Declaration
• Import Statements
• Interface Section
10 of 33 12-12-2023, 18:52
Questions https://awaisahmed.notion.site/Questions-650d1a8c7efb4edc997c111aa...
• Class Definition
C Keywords
Keywords are predefined, reserved words used in programming that
have special meanings to the compiler. Keywords are part of the
syntax and they cannot be used as an identifier. For example:
int money;
Show All
Untitled
Title auto double
break else
case enum
char extern
continue for
default goto
const float
11 of 33 12-12-2023, 18:52
Questions https://awaisahmed.notion.site/Questions-650d1a8c7efb4edc997c111aa...
Untitled
C Identifiers
Identifier refers to name given to entities such as variables, functions,
structures etc.
You can choose any name as an identifier if you follow the above rule,
however, give meaningful names to identifiers that make sense
12 of 33 12-12-2023, 18:52
Questions https://awaisahmed.notion.site/Questions-650d1a8c7efb4edc997c111aa...
• *: Multiplication
• / : Division
• % : Modulo
• + : Addition
• – : Subtraction
13 of 33 12-12-2023, 18:52
Questions https://awaisahmed.notion.site/Questions-650d1a8c7efb4edc997c111aa...
variable= value;
• +=, for adding left operand with right operand and then
assigning it to the variable on the left.
• /=, for dividing left operand by right operand and then assigning
it to the variable on the left.
variablerelation_operator value
14 of 33 12-12-2023, 18:52
Questions https://awaisahmed.notion.site/Questions-650d1a8c7efb4edc997c111aa...
◦ !=, Not Equal to returns true if the left-hand side is not equal
to the right-hand side.
◦ <, less than: returns true if the left-hand side is less than the
right-hand side.
• &&, Logical AND: returns true when both conditions are true.
15 of 33 12-12-2023, 18:52
Questions https://awaisahmed.notion.site/Questions-650d1a8c7efb4edc997c111aa...
answer
Show All
Untitled
16 of 33 12-12-2023, 18:52
Questions https://awaisahmed.notion.site/Questions-650d1a8c7efb4edc997c111aa...
17 of 33 12-12-2023, 18:52