Cognizant GenC Next OOPs Questions

GenC Next OOPs Questions 2025

Cognizant GenC Next OOPs Sections is one of the most important section for Genc Next 2025 hiring. This section will asses your object oriented programming concept such as Classes, Objects, Abstraction, encapsulation, Inheritance , Polymorphism (Method Overloading and Method Overriding), Message passing etc. You will face question of OOPs in mcq section as well as in coding section.

GenC Next OOPS
Cognizant OOPs Questions

20 Question(shared)

Total Question

40 minutes

Total Time

1 Mark/Question

Marking Scheme

Cognizant OOPs Questinos

No

Negative Marking

Practice Questions for GenC Next OOPs Round

1. What is a tightly encapsulated class?

A class is said to be tightly encapsulated if and only if every variable of that class is declared as private.

A class is said to be tightly encapsulated if and only if every variable of that class is declared as private.

52.91%

A class is said to be tightly encapsulated if and only if every function of that class is declared as private.

A class is said to be tightly encapsulated if and only if every function of that class is declared as private.

24.79%

A class is said to be tightly encapsulated if and only if every variable of that class is declared as protected.

A class is said to be tightly encapsulated if and only if every variable of that class is declared as protected.

14.64%

A normal java class can also be called as tightly encapsulated class.

A normal java class can also be called as tightly encapsulated class.

7.65%

A class is said to be tightly encapsulated if and only if every variable of that class is declared as private whether the variable has getter and setter methods or not and whether these methods declared as public or not, no required to check.

 

2.

public class Plant
{
    private String name;
    public Plant (String name)
    {
        this.name = name;
    }

    public String getName ()
    {
        return name;
    }

}

public class Tree extends Plant
{
    public void growFruit ()
    {
    } 
    
    public void dropLeaves ()
    {
    } 
}

which statement is true?

The code will compile without changes.

The code will compile without changes.

52.82%

The code will compile if public Tree() { Plant();} is added to the Tree class.

The code will compile if public Tree() { Plant();} is added to the Tree class.

22.14%

The code will compile if public Plant(){ Tree();} is added to the Plant class.

The code will compile if public Plant(){ Tree();} is added to the Plant class.

16.12%

The code will compile if public Plant(){ this("fern");} is added to the Plant class.

The code will compile if public Plant(){ this("fern");} is added to the Plant class.

8.93%

By default the child class constructor calls the zero argument constructor of the parent class.

3. When Overloading does not occur?

More than one method with same name but different method signature and different number or type of parameters

More than one method with same name but different method signature and different number or type of parameters

29.2%

More than one method with same name, same signature but different number of parameters

More than one method with same name, same signature but different number of parameters

15.2%

More than one method with same name, same signature, same number of parameters but different type

More than one method with same name, same signature, same number of parameters but different type

28.4%

More than one method with same name, same number of parameters and type but different signature

More than one method with same name, same number of parameters and type but different signature

27.2%

Overloading occurs when more than one method with same name but different constructor and also when same signature but different number of parameters and/or parameter type.

4. What will be the output of the following program?

class Main 
{
    public void func (String s) 
    {
        System.out.print ("String ");
    } 
    
    public void func (Object o) 
    {   
        System.out.print ("Object ");   
    }
    
    public static void main (String[]args) 
    {
        Main obj = new Main ();
        obj.func (new Object ());
        obj.func ("Prepinsta");
        obj.func (null);
    } 
}

Object String String

Object String String

36.15%

Object String Object

Object String Object

46.09%

Object Object Object

Object Object Object

10.78%

String String String

String String String

6.98%

In overloading, the child class will always get high priority then parent class.

5. What will be the output of the following program?

class Sample 
{
    public void func () 
    {
        System.out.println ("Hello Prepsters : Sample");
    } 
} 

public class Main extends Sample 
{
    protected void func () 
    {
        System.out.println ("Hello prepsters : Main");
    } 
    public static void main (String[]args)
    {
        Main m = new Main ();
        m.func ();
    } 
}

Hello prepsters: Sample

Hello prepsters: Sample

16.06%

Hello prepsters : Main

Hello prepsters : Main

66.67%

Compile time error : weaker access privileges

Compile time error : weaker access privileges

15.33%

No output

No output

1.95%

While overriding we can’t reduce the scope of access modifiers.

6. What will be the output of the following program?

class Sample 
{
    int a = 10;
} 

public class Main extends Sample 
{
    int a = 20;
    public static void main (String[]args)
    {
        Sample s = new Main ();
        System.out.println (s.a);
    } 
}

10

10

28.57%

20

20

52.54%

Compilation error

Compilation error

16.22%

No output

No output

2.66%

Overriding concept is not applicable for variables. Variable resolution is always takes care by the compiler based on reference type.

7. What will be the output of the following program?

public class Main 
{
    Main () 
    {
        System.out.println ("Constructor");
        super ();
    }
   
    public static void main (String[]args)
    {
        Main m = new Main ();   
    } 
}

Constructor

Constructor

53.07%

No output

No output

9.83%

Compile time error

Compile time error

28.01%

Runtime error

Runtime error

9.09%

We have to take super() or this() only in the first line of the constructor. If we are taking anywhere else we will get a compile time error.

8. ------------------keyword does not allow a method to be overridden in the subclass.

public

public

4.63%

abstract

abstract

18.29%

final

final

54.4%

static

static

22.69%

In any object-oriented programming language, Overriding is a feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its super-classes or parent classes.
Final keyword does not allow a method to be overridden in the subclass.

9. What will be the output of the following program?

public class Main 
{
    final int i;
    public void func ()
    {
        i = 100;
    } 
    
    public static void main (String[]args) 
    {
        Main m = new Main ();
        System.out.println (m.i);
    } 
}

100

100

45.52%

Compilation error

Compilation error

36.83%

no output

no output

14.07%

Zero(0)

Zero(0)

3.58%

For the final instance variable we should perform initialization before constructor completion i.e.
1)at the time of declaration
2)inside instance block
3)inside the constructor.

10. What will be the output of the following program?

public class Main 
{
    public static void func (final int a, int b) 
    {
        a = 200;
        b = 100;
        System.out.println (a + " " + b);
    }
    public static void main (String[]args) 
    {
        func (100, 200);
    } 
}

200 100

200 100

31.84%

100 200

100 200

25.79%

Compilation error

Compilation error

39.74%

No output

No output

2.63%

If we declare formal parameters as final then we can’t change its value within the method.

×

Please login to report

Preparation Material for GenC Next OOPs Section 2021-22

Below are all the topics mentioned from which you can expect MCQ Questions in Section 1 of the hiring test. 

  • Classes
  • Objects
  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism
    • Method Overloading
    • Method Overriding
  • Message passing

GenC Next OOPs Section Details

OOPs SectionGenC Pro
Number of Questions20 Questions
Time Limit40 Mins
DifficultyMedium
Negative MarkingNo

FAQs about Cognizant GenC Next

What is the sectional cut off for this Section?

There is no sectional cut-off, however it is mandatory that you get at least 15 questions right from the pack of 20 questions in the Code Debugging section to get a higher overall score

What is the difficulty level of Cognizant Genc Next exam?

The GenC Next hiring exam is commparatively of higher difficulty level than the normal GenC exam. This hiring process is mainly focused for hiring coding proficient students, hence the package offered of GenC Next is also higher than GenC.

What is the package offered for Cognizant Genc Next exam?

The package offered for GenC Next candidates is 6.75 LPA

WILL I GET ANY OTHER ROLE IF NOT FOUND SUITABLE FOR GENC Next?

Yes, you will get GenC Elevate role according to your performance in skill based assessment and final interview.

WHAT ARE ALL THE ROUNDS IN COGNIZANT GENC Next EXAM?

Skill based assessment followed by technical/HR interview.