Advertisements
Advertisements
Evaluate the expression when x is 4:
x + = x + + * + + x %2;
Concept: Types of Operators
The keyword used to call package in the program:
Concept: Java Compiler and Interpreter
The extension of a Java source code file is ______.
Concept: Introduction to Java
What is the output of the Java code given below?
String color [ J = {"Blue", "Red", "Violet"}; System.out.println(color[2].length();
Concept: Output Statement in Java Programming
Rewrite the following do while program segment using for:
x = 10; y = 20;
do
{
x++;
y++;
}while (x<=20);
System.out.println(x*y);
Concept: Output Statement in Java Programming
"Java compiled code (byte code) can run on all operating systems" - Name the feature.
Concept: Introduction to Java
Assertion (A): Integer class can be used in the program without calling a package.
Reason (R): It belongs to the default package java lang.
Concept: Basic Elements of Java Programming
Write a Java expression for the following : |x2+2xy|
Concept: Introduction of Input in Java
Write a program to input a number and check and print whether it is a Pronic number or not. (Pronic number is the number which is the product of two consecutive integers).
Examples: 12 = 3 × 4
20 = 4 × 5
42 = 6 × 7
Concept: Introduction of Input in Java
Write a program to input twenty names in an array. Arrange these names in descending order of alphabets, using the bubble sort technique.
Concept: Introduction of Input in Java
Using the switch statement, write a menu driven program to calculate the maturity amount of a Bank Deposit.
The user is given the following options :
(i) Term Deposit
(ii) Recurring Deposit
For option (i) accept principal (P), rate of interest(r) and time period m years(n). Calculate and output the maturity amount (A) receivable using the formula
For option (ii) accept Monthly Installment (P), rate of interest (r) and time period in months (n). Calculate and output the maturity amount (A) receivable using the formula
For an incorrect option, an appropriate error message should be displayed.
Concept: Introduction of Input in Java
Write a program to accept the year of graduation from school as an integer value from, the user. Using the Binary Search technique on the sorted array of integers given below.
Output the message “Record exists” If the value input is located in the array. If not, output the message “Record does not exist”.
{1982, 1987, 1993, 1996. 1999, 2003, 2006, 2007, 2009, 2010}.
Concept: Introduction of Input in Java
The Scanner class method used to accept words with space:
Concept: Introduction of Input in Java
Missing a semicolon in a statement is what type of error?
Concept: Types of Errors
DTDC, a courier company, charges for the courier based on the weight of the parcel. Define a class with the following specifications:
class name: | courier | |
Member variables: | name - name of the customer | |
weight - weight of the parcel in kilograms | ||
address - address of the recipient | ||
bill - amount to be paid | ||
type - 'D'- domestic, 'I'- international | ||
Member methods: | ||
void accept ( )- | to accept the details using the methods of the Scanner class only. | |
void calculate ( )- | to calculate the bill as per the following criteria: | |
Weight in Kgs | Rate per Kg | |
First 5 Kgs | Rs.800 | |
Next 5 Kgs | Rs.700 | |
Above 10 Kgs | Rs.500 | |
An additional amount of Rs.1500 is charged if the type of the courier is I (International) | ||
void print )- | To print the details | |
void main ()- | to create an object of the class and invoke the methods |
Concept: Using Function Argument
Define a class to accept a number from user and check if it is an EvenPal number or not. (The number is said to be EvenPal number when number is palindrome number (a number is palindrome if it is equal to its reverse) and sum of its digits is an even number.)
Example: 121 - is a palindrome number
Sum of the digits - 1 + 2 + 1 = 4 which is an even number
Concept: Using Function Argument
Define a class to accept values into an integer array of order 4 x 4 and check whether it is a DIAGONAL array or not An array is DIAGONAL if the sum of the left diagonal elements equals the sum of the right diagonal elements. Print the appropriate message.
Example:
3 4 2 5 Sum of the left diagonal elements =
2 5 2 3 3 + 5 + 2 + 1 = 11
5 3 2 7 Sum of the right diagonal elements =
1 3 7 1 5 + 2 + 3 + 1 = 11
Concept: Using Function Argument
Define a class to accept the gmail id and check for its validity.
A gmail id is valid only if it has:
→ @
→ . (dot)
→ gmail
→ com
Example: icse2024@gmail.com is a valid gmail id.
Concept: Using Function Argument
Name any two library packages.
Concept: Introduction of Mathematical Library Methods
Give the output of the following Math functions:
(i) Math.ceil(4.2)
(ii) Math.abs(-4)
Concept: Introduction of Mathematical Library Methods