1. What is the difference between OOP and SOP?
4. What are the main features of OOP?
7. What is the difference between a class and a structure?
8. Can you call the base class method without creating an instance?
15. What are the limitations of inheritance?
34. What are virtual functions?
35. What are pure virtual functions?
39. What is a copy constructor?
40.What is the difference between an error and an exception?
41.Definition, structure, and examples demonstrating its use.
Potential pitfalls, complexity, performance issues, and examples.
Definition, importance, and examples demonstrating exception handling
53. What is the SOLID principle?
What is a singleton class?
What is composition in OOP?
54. What is the importance of design patterns in OOP?
55. What are static and instance methods?
1. Which kind of switch will be developing by the compiler while compiling the
following code?
class B
public static void main(String[] args)
int i = 5;
switch(i)
{
case 3:
System.out.println("from case3");
break;
case 5:
System.out.println("from case5");
break;
case 6:
System.out.println("from case6");
break;
case 8:
System.out.println("from case8");
break;
3. In which concept, we cant use inequality while evaluating?
4. What is the main difference between if-else and switch-cases?
6. class E
public static void main(String[] args)
{
int i = 0;
if(i++ == 1)
System.out.println(i);
i += 7;
else if(i++ == 1 && i++ == i++)
System.out.println(i);
i += 9;
else if(i++ == 2)
{
System.out.println(i);
i += 11;
System.out.println(i);
11. Which is the last executable in the for loop?
41. Develop the code for this pattern
543212345
654323456
765434567
876545678
987656789
Use only one outer and one inner loop. Don’t use any extra variables apart from loop
indexes
class A{
A(){
System.out.println("A()");
A(int i){
this();
System.out.println("A(int)");
class B extends A{
B(){
super(90);
System.out.println("B()");
B(int i) {
System.out.println("B(int)");
}
}
class I {
public static void main(String[] args) {
A a1 = new A();
System.out.println("---------------");
A a2 = new A(10);
System.out.println("---------------");
B b1 = new B();
System.out.println("---------------");
B b2 = new B(10);
System.out.println("---------------");
...................
class D
int a = 50;
D(int i)
a = j;
public static void main(String[] args)
D d1 = new D();
System.out.println(d1.a);
10. Which two spl characters are allowed in the identifier?
11. What is the compile time error while using local variable without initialization?
12. What is the mandatory feature for the println method?
13. What is the result of 10 % 15?
34.
class A
public static void main(String[] args)
int i = 90;
String s1 = Integer.toBinaryString(i);
System.out.println(s1);
}
Given an integer n,you need to print all number
Less than n which are having digit only 3 or 7 0r both
Input 10
Output 3,7
1. Given n pairs of parentheses, write a function to generate and return all combinations
of well-formed parentheses.
Input : 3
Output :
"((()))",
"(()())",
"(())()"
"()(())",
“()()()”
]