The greatest 4 digit number without repeating the digits is __________________________________
The greatest 4 digit number with repeating the digits is ___________________________
The smallest 4 digit number without repeating the digits is _____________________________
The smallest 4 digit number with repeating the digits is ________________________
The smallest 6 digit number made from digits 7,1,9,0 is ______________________________
The greatest 6 digit number made by 7,1,9,0 is ______________________________
1 less than the smallest 5 digit number is ____________________________
1 more than the greatest 5 digit number is ____________________________
1 less than greatest 6 digit number without repeating the digits is __________________________________
1 more than smallest 6 digit number without repeating the digits is __________________________________
Write the greatest and the smallest numbers using the digits 1, 0, 3, 5, 9
Greatest
Smallest
5 digit number
________________________
________________________
6 digit number
________________________
________________________
7 digit number
________________________
________________________
Please provide your answers in comment box. For any queries on the questions or right answers, reach out to us on contact us over email – contactus@abhyas.co.in
Object-oriented programming (OOP) is a programming paradigm based on the concept of “objects”, which can contain data and code: data in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods)
Object-oriented programming aims to implement real-world entities like inheritance, hiding, polymorphism etc in programming. The main aim of OOP is to bind together the data and the functions that operate on them so that no other part of the code can access this data except that function.
Java Classes/Objects
Java is an object-oriented programming language.
Everything in Java is associated with classes and objects, along with its attributes and methods. For example: in real life, a car is an object. The car has attributes, such as model and color, and methods, such as drive and brake.
A Class is like an object constructor, or a “blueprint” for creating objects.
What is a Class?
A class is a blueprint or prototype that defines the variables and the methods (functions) common to all objects of a certain kind.
Create a Java Class
To create a class, use the keyword class:
Create a class named “Car” with a variable model and colour:
public class Car{
string model;
string colour;
}
What is an Object?
An object is a representative or specimen of a class. Software objects are often used to model real-world objects you find in everyday life.
Create a JAVA Object
In Java, an object is created from a class. We have already created the class named Car, so now we can use this to create objects.
To create an object of Car, specify the class name, followed by the object name, and use the keyword new:
Car myCar = new Car();
Examples of class and objects
Class
Objects
Fruit
Apple Banana Mango
Car
Volvo Audi Toyota
Examples – Class and Objects
Features of OOPs :
Abstraction
Abstraction is the process of exposing the relevant things and hiding the irrelevant details. The easiest way to understand and appreciate this concept of handling complexity is by studying the example of Globe, a model/prototype of earth that is used by students to understand its geography. Globe provides only that information that is required and if too much of information is mentioned in it i.e. streets, lakes etc, it becomes too complex to comprehend. Hence Globe abstracts unwanted information and makes it easy to comprehend the complex earth.
JAVA Abstract Classes and Methods
Data abstraction is the process of hiding certain details and showing only essential information to the user. Abstraction can be achieved with either abstract classes or interfaces (which you will learn more about in the next chapter).
The abstract keyword is a non-access modifier, used for classes and methods:
Abstract class: is a restricted class that cannot be used to create objects (to access it, it must be inherited from another class).
Abstract method: can only be used in an abstract class, and it does not have a body. The body is provided by the subclass (inherited from).
An abstract class can have both abstract and regular methods:
abstract class Animal {
public abstract void animalSound();
public void sleep() {
System.out.println("Zzz");
}
}
From the example above, it is not possible to create an object of the Animal class:
Animal myObj = new Animal(); // will generate an error
To access the abstract class, it must be inherited from another class. Let’s convert the Animal class we used in the Polymorphism chapter to an abstract class:
Remember from the Inheritance chapter that we use the extends keyword to inherit from a class.
Example
// Abstract class
abstract class Animal {
// Abstract method (does not have a body)
public abstract void animalSound();
// Regular method
public void sleep() {
System.out.println("Zzz");
}
}
// Subclass (inherit from Animal)
class Pig extends Animal {
public void animalSound() {
// The body of animalSound() is provided here
System.out.println("The pig says: wee wee");
}
}
class Main {
public static void main(String[] args) {
Pig myPig = new Pig(); // Create a Pig object
myPig.animalSound();
myPig.sleep();
}
}
Encapsulation
Encapsulation is the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse. The data is not accessible to the outside world and only those functions that are wrapped in the class can access it. These functions provide the interface between the object’s data and the program. The insulation of the data from the direct access by the program is called data hiding. In OOP, code and data are merged into an object so that the user of an object can never peek inside the box. This is defined as encapsulation (Object is a capsule encapsulating data and behavior). All communication to it is through messages (function calls which we use to communicate to the object). Messages define the interface to the object. Everything an object can do is represented by its message interface. Therefore, we need not know anything about what is in the object when we use it.
JAVA Encapsulation
The meaning of Encapsulation, is to make sure that “sensitive” data is hidden from users. To achieve this, you must:
declare class variables/attributes as private
provide public get and set methods to access and update the value of a private variable
Get and Set
You learned from the previous chapter that private variables can only be accessed within the same class (an outside class has no access to it). However, it is possible to access them if we provide public get and set methods.
The get method returns the variable value, and the set method sets the value.
Syntax for both is that they start with either get or set, followed by the name of the variable, with the first letter in upper case:
Example
public class Person {
private String name; // private = restricted access
// Getter
public String getName() {
return name;
}
// Setter
public void setName(String newName) {
this.name = newName;
}
}
Example explained
The get method returns the value of the variable name.
The set method takes a parameter (newName) and assigns it to the name variable. The this keyword is used to refer to the current object.
However, as the name variable is declared as private, we cannot access it from outside this class:
Example
public class Main {
public static void main(String[] args) {
Person myObj = new Person();
myObj.name = "John"; // error
System.out.println(myObj.name); // error
}
}
Inheritance
Inheritance is the process by which one class acquires the properties and functionalities of another class. This is important because it supports the concept of hierarchical classification.. Inheritance provides the idea of reusability of code and each sub class defines only those features that are unique to it.
Java Inheritance (Subclass and Superclass)
In Java, it is possible to inherit attributes and methods from one class to another. We group the “inheritance concept” into two categories:
subclass (child) – the class that inherits from another class
superclass (parent) – the class being inherited from
To inherit from a class, use the extends keyword.
In the example below, the Car class (subclass) inherits the attributes and methods from the Vehicle class (superclass):
Example
class Vehicle {
protected String brand = "Ford"; // Vehicle attribute
public void honk() { // Vehicle method
System.out.println("Tuut, tuut!");
}
}
class Car extends Vehicle {
private String modelName = "Mustang"; // Car attribute
public static void main(String[] args) {
// Create a myCar object
Car myCar = new Car();
// Call the honk() method (from the Vehicle class) on the myCar object
myCar.honk();
// Display the value of the brand attribute (from the Vehicle class) and the value of the modelName from the Car class
System.out.println(myCar.brand + " " + myCar.modelName);
}
}
Did you notice the protected modifier in Vehicle?
We set the brand attribute in Vehicle to a protected access modifier. If it was set to private, the Car class would not be able to access it.
Why And When To Use “Inheritance”?
– It is useful for code reusability: reuse attributes and methods of an existing class when you create a new class.
Tip: Also take a look at the next chapter, Polymorphism, which uses inherited methods to perform different tasks.
The final Keyword
If you don’t want other classes to inherit from a class, use the final keyword:
If you try to access a final class, Java will generate an error:
final class Vehicle {
...
}
class Car extends Vehicle {
...
}
The output will be something like this:Main.java:9: error: cannot inherit from final Vehicle class Main extends Vehicle { ^ 1 error)
Polymorphism
Polymorphism is a feature that allows one interface to be used for a general class of actions. An operation may exhibit different behavior in different instances. The behavior depends on the types of data used in the operation. It plays an important role in allowing objects having different internal structures to share the same external interface. Polymorphism is extensively used in implementing inheritance. Ex: add(int a, int b) add(int a, float b, int c) add(int a, int b, float c, double d) Here different datatypes are being added using the same interface.
Java Polymorphism
Polymorphism means “many forms”, and it occurs when we have many classes that are related to each other by inheritance.
Like we specified in the previous chapter; Inheritance lets us inherit attributes and methods from another class. Polymorphism uses those methods to perform different tasks. This allows us to perform a single action in different ways.
For example, think of a superclass called Animal that has a method called animalSound(). Subclasses of Animals could be Pigs, Cats, Dogs, Birds – And they also have their own implementation of an animal sound (the pig oinks, and the cat meows, etc.):
Example
class Animal {
public void animalSound() {
System.out.println("The animal makes a sound");
}
}
class Pig extends Animal {
public void animalSound() {
System.out.println("The pig says: wee wee");
}
}
class Dog extends Animal {
public void animalSound() {
System.out.println("The dog says: bow wow");
}
}
Remember from the Inheritance chapter that we use the extends keyword to inherit from a class.
Now we can create Pig and Dog objects and call the animalSound() method on both of them:
Example
class Animal {
public void animalSound() {
System.out.println("The animal makes a sound");
}
}
class Pig extends Animal {
public void animalSound() {
System.out.println("The pig says: wee wee");
}
}
class Dog extends Animal {
public void animalSound() {
System.out.println("The dog says: bow wow");
}
}
class Main {
public static void main(String[] args) {
Animal myAnimal = new Animal(); // Create a Animal object
Animal myPig = new Pig(); // Create a Pig object
Animal myDog = new Dog(); // Create a Dog object
myAnimal.animalSound();
myPig.animalSound();
myDog.animalSound();
}
}
In procedural programming, program is divided into small parts called functions. Example code : #include <stdio.h> /*this function computes the absolute value of a whole number.*/ int abs(int x) { if (x>=0) return x; elsereturn -x; } /*this program calls the abs() function defined above twice.*/ int main() { int x, printf(” x=”); scanf(“%d”, &x); printf(“Absolute Value of x is %d. \n”, abs(x)); return 0; }
In object oriented programming, program is divided into small parts called objects. Example code :
class Parrot: # class attribute species = "bird" # instance attribute def __init__(self, name, age): self.name = name self.age = age instantiate the Parrot class blu = Parrot(“Blu”, 10) woo = Parrot(“Woo”, 15) access the class attributes print(“Blu is a {}”.format(blu.class.species)) print(“Woo is also a {}”.format(woo.class.species)) access the instance attributes print(“{} is {} years old”.format( blu.name, blu.age)) print(“{} is {} years old”.format( woo.name, woo.age))
Procedural programming follows top down approach. Note: A top-down approach is essentially the breaking down of a program to gain insight into its compositional small program (or module) in a reverse engineering fashion.
Object oriented programming follows bottom up approach. Note : A bottom-up approach is the piecing together of module (or small program) to give rise to more complex program, thus making the original modules of the emergent program.
There is no access specifier in procedural programming.
Object oriented programming have access specifiers like private, public, protected etc.
Adding new data and function is not easy.
Adding new data and function is easy.
Procedural programming does not have any proper way for hiding data so it is less secure.
Object oriented programming provides data hiding so it is more secure.
In procedural programming, overloading is not possible.
Overloading is possible in object oriented programming. Overloading methods lets you define the same method multiple times so that you can call them with different argument lists (a method’s argument list is called its signature)
In procedural programming, function is more important than data.
In object oriented programming, data is more important than function.
Procedural programming is based on unreal world.
Object oriented programming is based on real world.
Data can move freely from procedure to procedure in the system
Objects can move and communicate with each other through member functions
Examples: C, FORTRAN, Pascal, Basic etc.
Examples: C++, Java, Python, C# etc.
Difference between Procedural and Object Oriented Programming
Words which name only ONE person, place, animal or thing are called SINGULAR nouns. Words which name MANY persons, places, animals or things are called PLURAL nouns. Most singular nouns are made plural by simply putting an -s at the end
There are many plural noun rules
1 To make regular nouns plural, add ‑s to the end.
cat – cats
house – houses
2 If the singular noun ends in ‑s, -ss, -sh, -ch, -x, or -z, add ‑es to the end to make it plural.
truss – trusses
bus – buses
marsh – marshes
lunch – lunches
tax – taxes
blitz – blitzes
3 In some cases, singular nouns ending in -s or -z, require that you double the -s or -z prior to adding the -es for pluralization.
fez – fezzes
gas –gasses
4If the noun ends with ‑f or ‑fe, the f is often changed to ‑ve before adding the -s to form the plural version.
wife – wives
wolf – wolves
Exceptions:
roof – roofs
belief – beliefs
chef – chefs
chief – chiefs
5 If a singular noun ends in ‑y and the letter before the -y is a consonant, change the ending to ‑ies to make the noun plural.
city – cities
puppy – puppies
6If the singular noun ends in -y and the letter before the -y is a vowel, simply add an -s to make it plural.
ray – rays
boy – boys
7If the singular noun ends in ‑o, add ‑es to make it plural.
potato – potatoes
tomato – tomatoes
Exceptions:
photo – photos
piano – pianos
halo – halos
8If the singular noun ends in ‑us, the plural ending is frequently ‑i.
cactus – cacti
focus – foci
9If the singular noun ends in ‑is, the plural ending is ‑es.
analysis – analyses
ellipsis – ellipses
10If the singular noun ends in ‑on, the plural ending is ‑a.
phenomenon – phenomena
criterion – criteria
11Some nouns don’t change at all when they’re pluralized.
sheep – sheep
series – series
species – species
deer –deer
Plural Noun Rules for Irregular Nouns
Irregular nouns follow no specific rules, so it’s best to memorize these or look up the proper pluralization in the dictionary.
Weekly Current Affairs Quiz: 17 May to 23 May 2021 for Competitive Exams
Current Affairs
The World Hypertension Day (WHD) is celebrated on 17 May worldwide to promote public awareness of increasing high blood pressure (BP) and to encourage citizens of all countries to prevent and control this silent killer.
2. Amazon India has launched a free video streaming service named miniTV. Amazon now has two video streaming service- Prime Video and miniTV.
What is Amazon mini tv app?
Amazon announced the launch of miniTV for Android users. India is the first country to try out the miniTV feature. The miniTV is a free, ad-supported video streaming service available within the Amazon shopping app. This implies that anyone who has the Amazon’s shopping app, can access the miniTV.
Amazon mini tv download guide
Download the Amazon shopping app from PlayStore.
Open the app and below the search bar, you will see the “miniTV” icon.
Click on the “miniTV” icon.
Choose from various categories and videos and watch.
3. 2-deoxy-D-glucose (2-DG)
Defence Minister Rajnath Singh released on Monday the first batch of a keenly awaited, anti-Covid-19 drug called 2-deoxy-D-glucose (2-DG). It has been developed by the Defence Research and Development Organisation (DRDO), in partnership with a Hyderabad based private firm, Dr Reddy’s Laboratories.
The new drug is not a vaccination, or a preventive measure against being infected by the Covid-19 virus. Rather, the 2-DG molecule hastens the recovery of patients who are already suffering from the disease and are, in most cases, facing severe oxygen dependency. The drug is dispensed in powder form in a sachet, and taken orally after being dissolved in water.
Rajnath Singh handed over the first batch of the new 2-DG drug in Delhi to the Minister for Health & Family Welfare, Science & Technology and Earth Sciences, Harsh Vardhan.
4. US Pharmaceutical company Johnson and Johnson has partnered with a Telangana-based pharma company in India, Biological E Limited for manufacturing of its COVID-19 vaccine
5. Arjan Singh Bhullar Arjan ‘Singh’ Bhullar became the first Indian fighter to win the ONE Heavyweight World Title at the top-level (Mixed Martial Arts) MMA Championship event in Singapore on May 16, 2021, after defeating the longtime heavyweight king Brandon ‘The Truth’ Vera.
6. Institute for Development and Research in Banking Technology (IDRBT)
The Institute for Development and Research in Banking Technology (IDRBT) is building a next-generation Digital Financial Infrastructure named National Digital Financial Infrastructure (NADI). NADI would provide a roadmap and framework for future digital financial services growth in India.
About the NADI:
NADI will consist of modern network infrastructure which includes 5G/Edge Cloud with SDNs (software-defined networking) for connecting to the critical data centre infrastructure at the back-end.
IDRBT is an arm of the Reserve Bank of India (RBI).
It will also have the middleware infrastructure for supporting both digital identity verification, digital identity assessment and digital asset management with the support of efficient digital ledger technologies and AI/ML technologies.”
7. Tianwen-1, China
Tianwen-1, China’s uncrewed spacecraft successfully landed on the surface of Mars on May 15, 2021. The landing of the spacecraft has made the country only the second in the world to send a rover for exploring the Red Planet. China’s ‘Zhurong’ Rover was onboard the lander and the rover will soon be deployed to study the Martian geology and atmosphere.
Current Affairs Quiz
1. World Hypertension Day (WHD) is observed on which day of the year? A) 17 May B) 14 May C) 15 May D) 16 May
2. miniTV is a newly launched free video streaming service. The service has been launched by which entity? A) Amazon India B) Star India C) Reliance D) Zee Entertainment
3. Who has developed the new anti-Covid drug 2-DG? a) DRDO b) Bharat Biotech c) ISRO d) ICMR
4. Johnson and Johnson has partnered with which Indian pharma company for manufacturing its COVID-19 vaccine? a) Biological E b) Bharat Biotech c) Zydus Cadila d) Serum Institute
5. Who has become the first Indian fighter to become MMA World Champion? a) Chaitanya Gavali b) Sunny Khatri c) Mohammed Farhad d) Arjan Singh Bhullar
6. Institute for Development and Research in Banking Technology (IDRBT) is arm of which organization ?
a) ISRO b) RBI c) DRDO d) BARC
7. Which country has become the second one in the world to send a rover to Mars? a) Russia b) France c) China d) India
Question 1. Forming Words Using The Letter Given. (4 letter or more than 4 letter words. Kids will have to tell as many words as possible starting with the letter given in 1 minute and spell it.)
Question 2. Forming Words Using The Letter Given. (4 letter or more than 4 letter words. Kids will have to tell as many words as possible starting with the letter given in 1 minute and spell it.)