43 solutions available
Question 1What is sequential flow of control? Explain with an example.
Question 2What is conditional flow of control? Explain with an example.
Question 3Explain the significance of break statement in the switch statement.
Question 4What is a fall through? Give an example.
Question 5Explain the significance of the default label in the switch statement.
Question 6Explain the use of System.exit(n) method in Java.
Question 7Format the following if statements with indentation:i. if (x == y) if (x == z) x = 1; else y = 1; else z = 1;
Question 8Rewrite the following if statement, using the switch statement:if (choice == 1) System.out.println("You selected One"); else if (choice...
Question 9Write the following switch statement by using nested if statements:switch (choice) { case 0: case 1: x = 111; y = 222; break; case 2:...
Question 10Write an if statement to find the smallest of the three given integers using the min() method of the Math class.
Question 11Find the error in the given statement:int x = (a => b) ? "a" : "b";
Question 12Find the error, if any, in the following code. Write the correct statement.int a=5, b=10; int x = (a>b)>true:false;
Question 13Rewrite the following statement using if else:int max=215, min=323; String str= (max>min) ? "Max is greater than Min" : "Min is Greater...
Question 14What will be the value of 'n' after the execution of the code given below?int x=2, m=1, c=-1; int n = x + c; n = n - c + x;...
Question 15What will be the output of the following code?int x=2,y=5,a=0; a=x; x=y; y=a; System.out.println("x=" + x + " y=" + y);
Question 16Find the errors in the following code and rewrite the correct version:char m="A"; Switch ("A"); { Case 'a'; System.out.println("A");...
Question 17Write a program to find the number of and sum of all integers greater than 500 and less than 1000 that are divisible by 17
Question 18Create a program to find out if the number entered by the user is a two, three or four digits number.Sample input: 1023Sample output: 1023...
Question 19Write a program in Java that reads a word and checks whether it begins with a vowel or not.
Question 20Write a program in Java to read three integers and display them in descending order.
Question 21Using the ternary operator, create a program to find the largest of three numbers.
Question 22Write a program that reads a month number and displays it in words.
Question 23Admission in a professional course is subject to the following criteria:Marks in Physics >= 70Marks in Chemistry >= 60Marks in...
Question 24Using the switch statement in Java, write a program to display the name of the city according to the user's choice.D — Delhi, M — Mumbai,...
Question 25Write a program that will read the value of x and compute the following function:y={7for x > 00for x=0−7for x < 0y = \begin{cases} 7...
Question 26Employees at Arkenstone Consulting earn the basic hourly wage of Rs.500. In addition to this, they also receive a commission on the sales...
Question 27Write a program in Java to compute the perimeter and area of a triangle, with its three sides given as a, b, and c using the following...
Question 28Mayur Transport Company charges for parcels as per the following tariff:WeightChargesUpto 10 Kg.Rs. 30 per Kg.For the next 20 Kg.Rs. 20...
Question 29Create a program in Java to find out if a number entered by the user is a Duck Number.A Duck Number is a number which has zeroes present...
Question 30The electricity board charges the bill according to the number of units consumed and the rate as given below:Units ConsumedRate Per...
Question 31Write a menu driven program to accept a number from the user and check whether it is a Buzz number or an Automorphic number.i. Automorphic...
Question 32Write a Java program in which you input students name, class, roll number, and marks in 5 subjects. Find out the total marks, percentage,...
Question 33Write a program in Java to accept three numbers and check whether they are Pythagorean Triplet or not. The program must display the...
Question 34Using switch case, write a program to convert temperature from Fahrenheit to Celsius and Celsius to Fahrenheit.Fahrenheit to Celsius...
Question 35Star mall is offering discount on various types of products purchased by its customers. Following table shows different type of products...
Question 36A cloth showroom has announced the following festival discounts on the purchase of items based on the total cost of the items...
Question 37A cloth manufacturing company offers discounts to the dealers and retailers. The discount is computed using the length of the cloth as per...
Question 38Using switch case statement in Java, create a program to convert rupee into dollar and dollar into rupee according to the user's choice....
Question 39A box of cookies can hold 24 cookies, and a container can hold 75 boxes of cookies. Write a program that prompts the user to enter the...
Question 40Write a menu driven program to display the following menu:Conversion Table============Milliseconds to SecondsMilliseconds to...
Question 41Using the switch statement, write a menu driven program:To check and display whether a number input by the user is a composite number or...
Question 42A new taxi service based on electric vehicles is offering services within a metro city. Following is the fare chart including the type of...
Question 43The City Library charges late fine from members if the books were not returned on time as per the following table:Number of days...