InfyTQ Questions and Answers | Java Certification Round
InfyTQ Java MCQ Questions and Solutions for 2024 graduates
InfyTQ has been announced for 2024 passing graduates. This year InfyTQ Certification Exam will have 2 selection rounds.
- Certification Round
- Advantage Round
The Certification Round consists of Java MCQ and Hands on Coding Questions. There will be 10 Java MCQ Questions and 2 coding questions if you opt for Java programming language while booking the slot.
Here we have provided sample practice questions for Java MCQ Questions Round based on previous year questions papers and sample test.
InfyTQ Online Test Pattern:-
Name Of The Section | Number Of Questions |
Hands-on coding | 2 Ques |
DBMS | 10 Ques |
Programming( JAVA or Python) | 10 Ques |
Coding | 3 Ques |
InfyTQ Java MCQ Round Practice Questions
Question 1 – Which of the following main method declarations are valid?
Options
- public static void main(String args){}
- public synchronized final strictfp void main(String[] args){}
- public static int main(String… args){}
- public static synchronized final strictfp void main(String… args){}
Answer- public static synchronized final strictfp void main(String… args){}
Explanation –
- public static void main(String args){} // incorrect because the main function does not contain String[] as an argument.
- public synchronized final strictfp void main(String[] args){} // incorrect because static keyword is missing.
- public static int main(String… args){} //incorrect because we can’t take int as a return type.
- public static synchronized final strictfp void main(String… args){}// valid
Question 2 – What is the range of boolean data type in java?
Options
- -128 to 127
- -32768 to 32767
- 0 to 65535
- Not Applicable
Answer- Not Applicable
Explanation –The range of boolean data type is not applicable but allowed values are true or false.
Question 3 – Which data type is best suited to represent the logical values?
Options
- Integer
- Character
- Boolean
- All of the mentioned above
Answer- Boolean
Explanation – Boolean data type is best suited to represent the logical values.
Question 4 – Two methods with the same name but different argument types are known as?
Options
- Method overloading
- Method overriding
- Both A and B
- All of the mentioned above
Answer- Method overloading
Explanation –Methods with the same name and different argument type are known as method overloading.
Question 5 – The subclass constructor uses the ———keyword to invoke the constructor of the superclass.
Options
- Super
- Final
- Static
- Public
Answer- Super
Explanation –Super keyword is used by the subclass for invoking the superclass constructor.
Question 6 – Which of the following is a correct way to create an object of class Test?
Options
- Test t=new Test();
- Test t=new Test;
- t=new Test();
- new Test t;
Answer- Test t=new Test();
Explanation – Test t=new Test() ,is the correct syntax for creating objects in java.
Question 7 – What will be the output of the following java program?
class Parent { int x=10; } class Child extends Parent { int x=20; } class Test { public static void main(String[] args) { Parent p=new Parent(); System.out.print(p.x+” ”); Child c=new Child(); System.out.print(c.x+” ”); Parent p1=new Child(); System.out.print(p1.x); } }
Options
- 10 20 20
- 10 20 10
- 10 10 10
- 20 20 20
Answer- 10 20 10
Explanation – Overriding concept is not applicable for variables. Hence variable resolution is always taken care of by the compiler based on reference type.So the answer is 10 20 10.
Question 8 – How many reserved words are there in java?
Options
- 20
- 32
- 40
- 52
Answer- 52
Explanation – There are 52 reserved words in java.
Question 9 – What will be the output of the following program?
public class Main { public static void main (String args[]) { int x = 0; if (x) { System.out.println ("if"); } else { System.out.println ("else"); } } }
Options
- if
- else
- compile time error
- no output
Answer- Compile time error
Explanation – The argument to the if statement should be Boolean if we are providing any other type we will get “compile time error”.Here, in the above code the argument type is int so we will get a compile time error :- “int cannot be converted to boolean”.
Question 10 – What is the output of the following code snippet?
public class Question {
public static void main (String [ ] args) {
int var = 22, anotherVar = 7, result ;
String str = “One” ;
String anotherStr = “Two” ;
result = var*anotherVar / anotherVar ;
if ( result < 22 ) {
System.out.println(str) ;
}
else {
System.out.println(anotherStr) ;
}
}
}
Options
- Compilation error: incorrect use of operators
- One
- Two
- No Output
Answer- Two
Explanation – Here the main equation to be concentrated is → result = var*anotherVar / anotherVar ; var has the value 22 in it and anotherVar has the value 7 so the equation can be written as 24*7/7, but because of BODMAS 7/7 will be executed first which will result in 1 and this will be considered for multiplication as 22*1 which gives us 22. So the final value which is stored in the variable result is 22. While checking if condition 22>22 will be a False and hence anotherStr which has the value “Two” will be printed as the output.
Login/Signup to comment