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.

53.11%

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.75%

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.59%

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.54%

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.

53.07%

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.03%

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.

15.9%

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.

9%

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.56%

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.08%

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.37%

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

26.98%

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%

Object String Object

Object String Object

46.11%

Object Object Object

Object Object Object

10.95%

String String String

String String String

6.95%

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.22%

Hello prepsters : Main

Hello prepsters : Main

66.59%

Compile time error : weaker access privileges

Compile time error : weaker access privileges

15.25%

No output

No output

1.94%

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.61%

20

20

52.4%

Compilation error

Compilation error

16.35%

No output

No output

2.64%

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.06%

No output

No output

9.78%

Compile time error

Compile time error

28.12%

Runtime error

Runtime error

9.05%

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.59%

abstract

abstract

18.12%

final

final

54.59%

static

static

22.71%

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.18%

Compilation error

Compilation error

36.8%

no output

no output

14.21%

Zero(0)

Zero(0)

3.81%

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.85%

100 200

100 200

25.85%

Compilation error

Compilation error

39.69%

No output

No output

2.61%

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.