Advertisements
Advertisements
What is meant by a package?
Concept: Introduction of Operators in Java
Name any two basic principles of Object-oriented Programming.
Concept: Introduction of Object-oriented Programming
Name any two OOP’s principles.
Concept: Introduction of Object-oriented Programming
What are identifiers?
Concept: Introduction of Object-oriented Programming
What are keywords ? Give an example.
Concept: Introduction of Object-oriented Programming
Name the type of error ( syntax, runtime or logical error) in each case given below:
(i) Math.sqrt (36 – 45)
(ii) int a;b;c;
Concept: Introduction of Object-oriented Programming
Write a function prototype of the following:
A function PosChar which takes a string argument and a character argument and returns an integer value.
Concept: Introduction of Object-oriented Programming
Give the output of the following expression:
a+= a++ + ++a + -- a + a--; when a = 7;
Concept: Introduction of Object-oriented Programming
Using the switch statement, write a menu-driven program for the following:
(i) To print Floyd’s triangle [Given below]
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
(ii) To display the following pattern:
I
I C
I C S
I C S E
For an incorrect option, an appropriate error message should be displayed.
Concept: Introduction of Object-oriented Programming
Which of the following are valid comments ?
(i) /* comment */
(ii) /* comment
(iii) / / comment
(iv) */ comment */
Concept: Introduction of Object-oriented Programming
Give two differences between the switch statement and the If-else statement.
Concept: Introduction of Object-oriented Programming
A mechanism where one class acquires the properties of another class:
Concept: Principles of Object Oriented Programming (OOP)
Consider the given program and answer the questions given below:
class temp
{
int a;
temp()
{
a=10
}
temp(int z)
a=z;
}
void print()
{
System.out.println(a);
}
void main()
{
temp t = new temp();
temp x = new temp(30);
t.print();
x.print();
}
}
- What concept of OOPs is depicted in the above program with two constructors?
- What is the output of the method main()?
Concept: Principles of Object Oriented Programming (OOP)
Why is an object called an instance of a class?
Concept: Introduction of Elementary Concept of Objects and Classes
Consider the above picture and choose the correct statement from the following:
Concept: Creating an Object of a Class
Write the return data type of the following function: startsWith( )
Concept: Introduction of Values and Data Types
Write the return data type of the following function: random( )
Concept: Introduction of Values and Data Types
If the value of basic=1500, what will be the value of tax after the following statement is executed?
tax = basic > 1200 ? 200 : 100
Concept: Introduction of Values and Data Types
What is the value of xl if x=5?
x1 = + +x – X+ + + –x
Concept: Introduction of Values and Data Types
What is the type of casting shown by the following example:
char c = (char) 120;
Concept: Introduction of Values and Data Types