HomeExamsJavaTETAJEEDEVIC1000
TETAJEEDEVIC1000

Infosys Certified Java Programmer

Practice with real exam-pattern questions for Infosys Certified Java Programmer. Each question includes a detailed explanation to help you understand the concept, not just memorise the answer. Try 10 questions free — no login required.

BeginnerJava180 min
Free questions

10 Infosys Certified Java Programmer practice questions with answers

Real Lex exam-pattern multiple-choice questions for the Infosys Certified Java Programmer certification. Each question includes the correct answer. The full question bank is available to Premium members.

  1. Question 1

    Predict the output of the following code snippet:


    public class TestDemo {

    public static void main(String[] args) {
    try {
    Marks(4);
    Marks(3);
    Marks(2);
    Marks(1);
    } catch (ArrayIndexOutOfBoundsException e) {
    System.out.println("Array index is out of bounds at main");
    }
    }

    public static void Marks(int x) {
    int marks[][] = {{10, 20}, {9, 12}, {8, 16}, {7, 15}};
    int total[] = {0, 0, 0, 0};
    try {
    total[x] = (marks[x][0] + marks[x][1]);
    System.out.println(total[x]);

    } catch (ArrayIndexOutOfBoundsException e) {
    System.out.println("Array index is out of bounds at method");
    }

    }

    }

    • Array index is out of bounds at method

      Correct
    • B

      Array index is out of bounds at method
      22
      24
      21

    • C

      Array index is out of bounds at main
      22
      24
      21

    • D

      Array index is out of bounds at main

  2. Question 2

    What will be the output of the following code when executed?
    public class StringTester{
    public static void main(String[] args){
    String str1=null;
    String str2=new String(“null”);
    System.out.println(“null”.equals(str1));
    System.out.println(“null”.equals(str2));
    System.out.println(str1.equals(null));
    }
    }

    • false
      true
      NullPointer Exception

      Correct
    • B

      NullPointer Exception

    • C

      true
      true
      false

    • D

      false
      false
      true

  3. Question 3

    What will be the output of the following code?

    public class BaseClass {

    private int display1(int i)

    { return i++ + --i; }

    public int display2(int i)

    { return display1(--i + 1); }

    }

    class ChildClass extends BaseClass

    {

    int display1(int i) // Line1

    { return display2(++i + ++i + --i); // Line2 }

    }

    class MainClass {

    public static void main(String[] args) {

    System.out.println("Value is " + new ChildClass().display1(27));

    }}

    • Value is 168

      Correct
    • B

      Value is 169

    • C

      Value is 170

    • D

      Value is 171

  4. Question 4

    Which of the following are valid Functional Interfaces?(Choose any 3)

    • @FunctionalInterface
      interface Assign {
      double assess(int id, double percentage);
      }

      Correct
    • B

      @FunctionalInterface
      interface Assign {
      double assess(int id, double percentage);
      default double computeGrade(double cost) {
      //implementation of computeGrade
      }}

    • C

      @FunctionalInterface
      interface Assign {
      double assess(int id, double percentage);
      default double computeGrade(double cost) {
      //implementation of computeGrade
      }
      static void display() {
      //implementation of display
      }
      }

    • D

      @FunctionalInterface
      interface Assign {
      double assess(int id, double percentage);
      default double computeGrade(double cost) {
      //implementation of computeGrade
      }
      static void display() {
      //implementation of display
      }
      public String toString()
      {
      //Implementation of toString() method
      }
      }

  5. Question 5

    What is the output of the following code?
    interface Test {

    void display();
    }

    class Figure implements Test {

    public void display()//line 1
    {
    System.out.println("Inside class Figure");
    }
    }

    public class ChildFigure extends Figure {//line 2

    public void display() {
    System.out.println("Inside class ChildFigure");
    }

    public static void main(String args[]) {
    Test ref = new ChildFigure();
    ref.display();
    Figure obj = (Figure) ref;//line 3
    obj.display();
    }
    }

    • Compilation error at line 1 as display() methods can't be public

      Correct
    • B

      Compilation error at line 2 as class ChildFigure must implement Test interface

    • C

      Compilation error at line 3 as Test ref can't be converted into Figure type class

    • D

      Will print 'Inside class ChildFigure ' and 'Inside class ChildFigure' respectively

  6. Question 6

    What will be the output of the code given below?

    public static void main(String[] args) {

    LocalDateTime date1 = LocalDateTime.now();

    System.out.println(date1.isAfter(date1.plusDays(1)));

    }

    • False

      Correct
    • B

      True

    • C

      Error as we cannot call plusDays() method inside another method

    • D

      Nothing will get printed as isAfter() method has void as it's return type

  7. Question 7

    Given student table:

    stuId stuName

    ----- -------

    1001 Jack

    1002 Jill

    1003 John

    1004 Jason

    Given code snippet:

    ResultSet resultSet = statement.executeQuery("select * from student");

    while(resultSet.hasNext()) {

    resultSet.next();

    String stuName = resultSet.getString(2);

    System.out.print(stuName + " ");

    resultSet.next();

    }

    What will be the output?

    • Jack John

      Correct
    • B

      Jack Jason

    • C

      Jill Jason

    • D

      Jack Jill

  8. Question 8

    For the given code, if con is a valid Connection object, and the table Customer is empty, what will be output of this code?

    try {
    con = DriverManager.getConnection(url,uid,pwd);
    Statement stmnt = con.createStatement();
    rs = stmnt.executeQuery("select * from customer");
    if (rs.next())
    rs.getString(2);
    } catch (SQLException e) {
    e.printStackTrace();
    }

    • Runtime exception at line 1 as getString(2) is not possible with the given select query

      Correct
    • B

      No exception , code runs fine

    • C

      Runtime exception at line 1 as rs.next() will throw an exception

    • D

      Compile time exception at line 1 as getString(2) is not possible with the given select query

  9. Question 9

    Which out of the following are true in regard to interfaces in Java ?(Select two)

    • An interface can contain default and static method with defined bodies.

      Correct
    • B

      An object can be created of an interface

    • C

      Multiple inheritance is allowed in Interfaces

    • D

      Multi-level inheritance is not possible in interfaces

  10. Question 10

    Refer the below code snippet and predict the outcome.

    public static void main(String args[]){
    Integer intVar1 = null;
    Integer intVar2 = new Integer(110);
    Optional<Integer> optinalVar1 = Optional.ofNullable(intVar1);
    Optional<Integer> optinalVar2 = Optional.of(intVar2);
    System.out.println(optinalVar1.orElse(new Integer(0))+optinalVar2.get()); // Line9
    }

    • Compilation fails at Line9 as orElse() method can't be used with an Optional variable

      Correct
    • B

      null

    • C

      110

    • D

      Runtime exception will be thrown at Line9 as get() method can't be used with an Optional variable

Pricing

Pay once. Clear every cert this year.

One subscription, full Telegram channel access, every PDF posted during your membership.

Monthly
50% OFF
₹1,300₹2,600
Per month · cancel anytime
  • Full access to all 1,357+ certifications
  • Monthly updated question banks
  • Telegram private channel access
  • Cancel anytime
Get Monthly
POPULAR
Quarterly
44% OFF
₹1,800₹3,200
That's ₹600/mo · billed for 3 months
  • Everything in Monthly
  • Save ₹2,100 vs monthly billing
  • Priority answer key requests
  • Best for increasing DQ score fast
Get Quarterly
BEST VALUE
Lifetime
52% OFF
₹2,400₹5,000
One-time · lifetime access
  • Everything in Quarterly
  • Lifetime channel access — no renewals
  • All future certifications included
  • Priority response from admin team
Get Lifetime
FAQ

Common questions, straight answers.

A monthly-updated Telegram channel where we post real exam-pattern question banks and detailed answer keys for 1,357+ Infosys Lex certifications. You join once, you get every PDF posted during your membership.

Right after payment on our Graphy page, you'll receive a private invite link to the Telegram channel. Access is instant — usually under 30 seconds.

We compile question banks from the actual Lex test pattern, sourced and verified by 180K+ community members who've recently cleared these exams. Match rate is consistently 85–95%.

Every single month. When Infosys rolls out new versions of certifications, we post updated dumps within 7–10 days. You'll see channel activity weekly.

Clearing certifications is one of the highest-weighted DQ factors. Members typically clear 3–5 certifications in their first 3 months, which moves DQ scores up by a full band.

i
InfyLexDumps

Independent exam preparation platform for Infosys Lex certifications. Real exam-pattern question banks, monthly updates, 180K+ community members.

Join Premium Telegram
Contact
  • @prepflixadmin
  • admin@prepflix.net
This platform is an independent educational resource and is not affiliated with or endorsed by Infosys Ltd. All certification names referenced are property of their respective owners.
© 2026 InfyLexDumps
Join Premium Telegram