0% found this document useful (0 votes)
2 views12 pages

Day 04 Java Task

NA
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)
2 views12 pages

Day 04 Java Task

NA
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

Courses Java/Selenium/Python/Javascript

Offered here: Full-Stack Developer/API/Appium

For Enquiry Call Us: 8939982246


Trainers – Ramsarath,Xavier,Palanivel
Day-4 Control Statements
DAY-4:
1. if/else if
2. Loopings(for,while,do-while)
3. Switch case
4. break/continue
QUESTIONS (Theory)
1. What is difference between break and continue?
2. Whether we can use continue statement in switch?
3. What is mean by control statement’s and types?
4. What is mean by for loop?
5. Can you explain about for loop execution process?
6. What is difference between while and do-while?
7. What is the use of default keyword in switch?
8. Difference between for and while loop?

Location : 51-A, 2nd floor, Velachery Rd, Dhadeswaram Nagar, Velachery, Chennai, Tamil Nadu 600042
Follow us On: greens_technologies_chennai Scan Here
greens_technologies_chennai To Reach Us
Courses Java/Selenium/Python/Javascript
Offered here: Full-Stack Developer/API/Appium

For Enquiry Call Us: 8939982246


Trainers – Ramsarath,Xavier,Palanivel
QUESTIONS (Find the output)
QUESTION 1:
package [Link];
public class Hello {
public static void main(String[] args) {
for (int i = 1; i <= 100; i++) {
if (i == 5) {
}
[Link](i);
}
}
}
QUESTION 2:
package [Link];
public class Hello {
public static void main(String[] args) {
for (int i = 1; i <= 10; i++) {
if (i == 5) {
break;
}
[Link](i);
}
}
}

Location : 51-A, 2nd floor, Velachery Rd, Dhadeswaram Nagar, Velachery, Chennai, Tamil Nadu 600042
Follow us On: greens_technologies_chennai Scan Here
greens_technologies_chennai To Reach Us
Courses Java/Selenium/Python/Javascript
Offered here: Full-Stack Developer/API/Appium

For Enquiry Call Us: 8939982246


Trainers – Ramsarath,Xavier,Palanivel
QUESTION 3:
package [Link];
public class Hello {
public static void main(String[] args) {
for (int i = 1; i <= 10; i++) {
if (i == 5) {
continue;
}
[Link](i);
}
}
}

QUESTION 4:
package [Link];

public class Hello {


public static void main(String[] args) {
for (int i = 1; i <= 3; i++) {
for (int j = 1; j <= 3; j++) {
[Link](j);
}
}
}
}

Location : 51-A, 2nd floor, Velachery Rd, Dhadeswaram Nagar, Velachery, Chennai, Tamil Nadu 600042
Follow us On: greens_technologies_chennai Scan Here
greens_technologies_chennai To Reach Us
Courses Java/Selenium/Python/Javascript
Offered here: Full-Stack Developer/API/Appium

For Enquiry Call Us: 8939982246


Trainers – Ramsarath,Xavier,Palanivel

QUESTION 5:
package [Link];
public class Hello {
public static void main(String[] args) {
for (int i = 1; i <= 3; i++) {
for (int j = 1; j <= 3; j++) {
[Link](i);
}
}
}
}
QUESTION 6:
package [Link];
public class Hello {
public static void main(String[] args) {
for (int i = 1; i <= 3; i++) {
for (int j = 1; j <= i; j++) {
[Link](j);
}

}
}
}

Location : 51-A, 2nd floor, Velachery Rd, Dhadeswaram Nagar, Velachery, Chennai, Tamil Nadu 600042
Follow us On: greens_technologies_chennai Scan Here
greens_technologies_chennai To Reach Us
Courses Java/Selenium/Python/Javascript
Offered here: Full-Stack Developer/API/Appium

For Enquiry Call Us: 8939982246


Trainers – Ramsarath,Xavier,Palanivel
QUESTION 7:
package [Link];
public class Hello {
public static void main(String[] args) {
for (int i = 1; i <= 3; i++) {
for (int j = i + 1; j <= 3; j++) {
[Link](j);
}
}
}
}
QUESTION 8:
package [Link];
public class Hello {
public static void main(String[] args) {
for (int i = 1; i <= 3; i++) {
for (int j = i + 1; j <= i; j++) {
[Link](j);
}

Location : 51-A, 2nd floor, Velachery Rd, Dhadeswaram Nagar, Velachery, Chennai, Tamil Nadu 600042
Follow us On: greens_technologies_chennai Scan Here
greens_technologies_chennai To Reach Us
Courses Java/Selenium/Python/Javascript
Offered here: Full-Stack Developer/API/Appium

For Enquiry Call Us: 8939982246


Trainers – Ramsarath,Xavier,Palanivel
QUESTION 9:
package [Link];
public class Hello {
public static void main(String[] args) {
int i=5;
if (i == 5) {
break;
}
[Link](i);
}
}

QUESTION 10:
package [Link];

public class Hello {


public static void main(String[] args) {
int i=5;
if (i == 5) {
continue;
}
[Link](i);
}

Location : 51-A, 2nd floor, Velachery Rd, Dhadeswaram Nagar, Velachery, Chennai, Tamil Nadu 600042
Follow us On: greens_technologies_chennai Scan Here
greens_technologies_chennai To Reach Us
Courses Java/Selenium/Python/Javascript
Offered here: Full-Stack Developer/API/Appium

For Enquiry Call Us: 8939982246


Trainers – Ramsarath,Xavier,Palanivel
QUESTIONS (Programs)
QUESTION 1:
Description: Write Java program to allow the user to input his/her age.
Then the program will show if the person is eligible to vote.
A person who is eligible to vote must be older than or equal 1 to
18 years old.
Example:
--------
Input = 10
Output = print not eligible.

QUESTION 2:
Description: Write a program to find even or odd number
Example:
---------
Input = 10
Output = Even

QUESTION 3:
Description: Write a program to print even number from 1 to 100
Example:
---------
Output = 2,4,....100

Location : 51-A, 2nd floor, Velachery Rd, Dhadeswaram Nagar, Velachery, Chennai, Tamil Nadu 600042
Follow us On: greens_technologies_chennai Scan Here
greens_technologies_chennai To Reach Us
Courses Java/Selenium/Python/Javascript
Offered here: Full-Stack Developer/API/Appium

For Enquiry Call Us: 8939982246


Trainers – Ramsarath,Xavier,Palanivel
QUESTION 4:
Description: Find the sum of odd number 1 to 100
Example:
--------
Output = 2500
QUESTION 5:
Description: Count of even number 1 to 100
Example:
--------
Output = 50
QUESTION 6:
Description: Write a program to find the factorial of a number.
Example:
--------
Input = 5
Output = 120
QUESTION 7:
Description: Write a program to print the fibonacci series of a number 1
to 100.

Example:
--------
Output = 0,1,1,2,3,5.....

Location : 51-A, 2nd floor, Velachery Rd, Dhadeswaram Nagar, Velachery, Chennai, Tamil Nadu 600042
Follow us On: greens_technologies_chennai Scan Here
greens_technologies_chennai To Reach Us
Courses Java/Selenium/Python/Javascript
Offered here: Full-Stack Developer/API/Appium

For Enquiry Call Us: 8939982246


Trainers – Ramsarath,Xavier,Palanivel
QUESTION 8:
Description: Find prime number or not.

Example:
--------
Input = 11
Output = prime number
QUESTION 9:
Description: Print the below patterns using for loop
Output:
-------
1
12
123
1234
12345
123456
1234567
-----------------------
*
* *
* * *
* * * *
* * * * *
--------------------------

Location : 51-A, 2nd floor, Velachery Rd, Dhadeswaram Nagar, Velachery, Chennai, Tamil Nadu 600042
Follow us On: greens_technologies_chennai Scan Here
greens_technologies_chennai To Reach Us
Courses Java/Selenium/Python/Javascript
Offered here: Full-Stack Developer/API/Appium

For Enquiry Call Us: 8939982246


Trainers – Ramsarath,Xavier,Palanivel

*
**
***
****
*****
-----------------------------

QUESTION 10:
Description: Find Armstrong number or not
Example:
--------
Input = 153
Output = Armstrong number

QUESTION 11:
Description: Reverse the number

Example:
--------
Input = 123
Output = 321

Location : 51-A, 2nd floor, Velachery Rd, Dhadeswaram Nagar, Velachery, Chennai, Tamil Nadu 600042
Follow us On: greens_technologies_chennai Scan Here
greens_technologies_chennai To Reach Us
Courses Java/Selenium/Python/Javascript
Offered here: Full-Stack Developer/API/Appium

For Enquiry Call Us: 8939982246


Trainers – Ramsarath,Xavier,Palanivel

QUESTION 12:
Description: Count of the number

Example:
--------
Input = 123
Output = 3

QUESTION 13:
Description: Sum of the number

Example:
--------
Input = 123
Output = 6
QUESTION 14:
Description: Verify the number is palindrome number not

Example:
--------
Input = 141
Output = Palindrome

Location : 51-A, 2nd floor, Velachery Rd, Dhadeswaram Nagar, Velachery, Chennai, Tamil Nadu 600042
Follow us On: greens_technologies_chennai Scan Here
greens_technologies_chennai To Reach Us
Courses Java/Selenium/Python/Javascript
Offered here: Full-Stack Developer/API/Appium

For Enquiry Call Us: 8939982246


Trainers – Ramsarath,Xavier,Palanivel

Location : 51-A, 2nd floor, Velachery Rd, Dhadeswaram Nagar, Velachery, Chennai, Tamil Nadu 600042
Follow us On: greens_technologies_chennai Scan Here
greens_technologies_chennai To Reach Us

You might also like