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)
Write the memory capacity (storage size) of short and float data type in bytes.
Concept: Methods of Wrapper Class
Differentiate between if else if and switch-case statements.
Concept: Methods of Wrapper Class
Give the output of the following code:
String P = “20”, Q = “19”,
int a = Integer .parselnt(P);
int b = Integer. valueOf(Q);
System.out.println(a+””+b);
Concept: Methods of Wrapper Class
State the data type and value of res after the following is executed :
char ch = ‘9’;
res = Character. isDigit(ch)
Concept: Methods of Wrapper Class
State the number of bytes occupied by char and int data types.
Concept: Methods of Wrapper Class
State the data type and value of res after the following is executed:
char ch = ‘t’;
res=Character. toUpperCase(ch);
Concept: Methods of Wrapper Class
Why is an object called an instance of a class?
Concept: Introduction of Elementary Concept of Objects and Classes
