Advertisements
Advertisements
Give the output of the following Math functions:
(i) Math.ceil(4.2)
(ii) Math.abs(-4)
Concept: Introduction of Mathematical Library Methods
System.out.print("BEST ");
System.out.println("OF LUCK");
Choose the correct option for the output of the above statements.
Concept: Introduction to Object Oriented Programming (OOP)
Write the return type of the following library functions:
- isLetterOrDigit(char)
- replace(char, char)
Concept: Introduction of Mathematical Library Methods
Give the output of the following :
(i) Math.floor (- 4.7)
(ii) Math.ceil(3.4) + Math.pow(2,3)
Concept: Introduction of Mathematical Library Methods
Name the mathematical function which is used to find sine of an angle given in radians.
Concept: Introduction of Mathematical Library Methods
Name a string function which removes the blank spaces provided in the prefix and suffix of a string.
Concept: Introduction of Mathematical Library Methods
Define a class named ParkingLot with the following description :
Instance variables/data members:
int vno — To store the vehicle number
int hours — To store the number of hours the vehicle is parked in the parking lot
double bill — Tb store the bill amount
Member methods:
void input( ) — To input and store the vno and hours.
void calculate( ) — To compute the parking charge at the rate of Rs.3 for the first hours or part thereof, and Rs. 1.50 for each additional hour or part thereof.
void display ( ) — To display the detail
Write a main method to create an object of the class and call the above methods.
Concept: Different Types of Methods
Identify the statement given below as assignment, increment, method invocation or object creation statement.
System.out.println(“Java”);
Concept: Different Types of Methods
What value will Math.sqrt (Math.ceil (15.3)) return?
Concept: Introduction of Mathematical Library Methods
Design a class with the following specifications:
| Class name: | Student |
| Member variables: | name - name of student age - age of student mks - marks obtained stream - stream allocated (Declare,the, variables using appropriate data types) |
Member methods:
| void accept() - | Accept name, age and marks using methods of Scanner class. |
| void allocation() - | Allocate the stream as per following criteria: |
| " mks | stream |
| >=300 | Science and Computer |
| >=200 and <300 | Commerce and Computer |
| >=75 and 200 | Arts and Animation |
| <75 | Try Again |
void print() Display student name, age, mks and stream allocated.
Call all the above methods in main method using an object.
Concept: Different Types of Methods
What is the output of Math.ceil(5.4) + Math.ceil(4.5)?
Concept: Introduction of Mathematical Library Methods
Which of the following mathematical methods returns only an integer?
Concept: Introduction of Mathematical Library Methods
Write Java expression for:
`(|a + b|)/(sqrt(a^2 + b^2))`
Concept: Methods of Math Class
Write the java expression for `root3x + sqrty`
Concept: Introduction of Mathematical Library Methods
Differentiate between constructor and function.
Concept: Invoking a Constructor
What is a parameterized constructor?
Concept: Features of a Constructor
Name the two types of constructors.
Concept: Features of a Constructor
Write two characteristics of a constructor.
Concept: Need of using a Constructor
Write the output of the following program code:
char ch ;
int x=97;
do
{
ch=(char) x;
System.out.print(ch + “ ” );
if(x%10 == 0)
break;
++x;
}while(x<=100);
Concept: Features of a Constructor
when is a constructor invoked?
Concept: Concept of Constructor
