0% found this document useful (0 votes)
56 views

Java Coding Assessments

The document contains 20 multiple choice questions about Java loops, Selenium IDE, and Selenium in general. It provides the questions, possible answers, and in some cases an explanation of the correct answer. It also contains advertisements to join a WhatsApp or Telegram group to receive daily QA job alerts.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Java Coding Assessments

The document contains 20 multiple choice questions about Java loops, Selenium IDE, and Selenium in general. It provides the questions, possible answers, and in some cases an explanation of the correct answer. It also contains advertisements to join a WhatsApp or Telegram group to receive daily QA job alerts.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

FRESHERS JOBS BY QA IDEA

DATE: -19-FEB-2022

**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

1. Choose the Java-Code below with a never-ending loop.


A. while(true);
B. for(;true;);
C. do { ; } while(true);
D. All

Answer: D
**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

2. An Increment operator "++" and/or a Decrement operator "--" are used along with a Loop-Counter
variable in Java. (TRUE / FALSE).

A. True
B. False

Answer: B
**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

3. What is the output of the below Java program?

int a=1;
while(a<4)
{
System.out.print(a + " ");
a++;
}

A1234
B123
C6
D Compiler error

Answer: Answer: Option B


Explanation:
a++; yields to a=a+1;

1 QA Idea
FRESHERS JOBS BY QA IDEA
DATE: -19-FEB-2022

**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

4. What is the main difference between a WHILE and a DO-WHILE loop in Java?
● A. WHILE loop executes the statements inside of it at least once even if the condition is false.
● B. DO-WHILE loop executes the statements inside of it at least once even if the condition is false.
● C. WHILE loop is fast.
● D. DO-WHILE loop is fast.

Answer: B
Explanation:
Both the WHILE loop and DO-WHILE loop work at the same speed. A DO-WHILE loop executes the
statements inside of it even if the condition is false. This is the reason why a DO-WHILE loop is used in
MENU driven console java programs.
**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

5. What is the value of "age" in the below Java program with a DO-WHILE loop?

int age=20;
do
{
age++;
}while(age<20);
System.out.println(age);

A. 20
B. 21
C. Compiler error
D. None

Answer: B
Explanation:
WHILE condition fails. By that time, the incremental statement was executed for one time. So its new
value is 21.
**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

6. In Java language, BREAK or CONTINUE statements can be implemented inside a Loop only with the
help of ___ statements to avoid never-ending loops.
A. IF ELSE
B. SWITCH

2 QA Idea
FRESHERS JOBS BY QA IDEA
DATE: -19-FEB-2022
C. ENUM
D. None

Answer: A
**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

7. A BREAK or CONTINUE statement applies only to the ___ loop.


a) Inner loop or the loop containing break or continue
b) always Outer loop
c) Sometimes inner loop, sometimes outer loop
d) None

Answer: a

**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

8. Choose rules for naming a Label in Java below.


a) The name of a label or identifier may start only with Alphabet, Underscore ( _ ) or Dollar ($) symbol
b) A label is kept before the loop in general
c) Duplicate label names are not allowed
d) All

Answer: D
**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

9. Is it possible to break all loops with a single BREAK with a Label statement? (YES/NO)
A. YES
B. NO

Answer: A
**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

10.Which of the following is used with the switch statement?


a) Continue
b) Exit
c) break
d) do

3 QA Idea
FRESHERS JOBS BY QA IDEA
DATE: -19-FEB-2022
Answer: c
Explanation: Break is used with a switch statement to shift control out of switch.
**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

11.Which of the following is not a valid flow control statement?


a) exit()
b) break
c) continue
d) return

Answer: a
Explanation: exit() is not a flow control statement in Java. exit() terminates the currently running JVM.
**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

12. Which of the following is not a valid jump statement?


a) break
b) goto
c) continue
d) return

Answer: b
Explanation: break, continue and return transfer control to another part of the program and returns
back to caller after execution. However, goto is marked as not used in Java.
**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

13. Which one of these selection statements in java


a) if()
b) for()
c) continue
d) break
View Answer
Answer: A

**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

14. Select the language which is not supported by selenium RC


a) ASP
b) java
c) C#

4 QA Idea
FRESHERS JOBS BY QA IDEA
DATE: -19-FEB-2022
d) PHP
View Answer
Answer: A
**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

15. Selenium IDE stands for


a) SUMMER
b) UNKNOWN
c) Compiler error
d) None
View Answer
Answer: a

**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

16. Which type of loop is guaranteed to have the body execute at least once?
A. Selenium Initialization Development Environment
B. Selenium Interrelated Development Environment
C. Selenium Integrated Development Environment
D. Selenium Information Development Environment

Answer: C
**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

17. Select the component which is not a part of selenium suite


A. Selenium IDE
B. Selenium RC
C. SeleniumGrid
D. Selenium Web

Answer: D
**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

18. Select the name which is not the type of locators


A. ID
B. Name
C. password
D. Link text

5 QA Idea
FRESHERS JOBS BY QA IDEA
DATE: -19-FEB-2022
Answer: Option C
**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

19. Select the operating system which is not supported by selenium IDE
A. Unix
B. Linux
C. Windows
D. Solaris

Answer: Option A
**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

20. Out of the following which can only test web applications
A. QTP
B. Selenium

Answer: option B
**********************************************************************************
To Get Daily QA Job Alerts, Join Our WhatsApp / Telegram Group.
**********************************************************************************

6 QA Idea
FRESHERS JOBS BY QA IDEA
DATE: -19-FEB-2022

Online Selenium Automation Training:-


Start Date: - 04th April 2022
Trainer Name: - SHAMMI JHA

☸ Course Contents:-
Java, Selenium, TestNG, Maven, GIT, Jenkins, BDD Cucumber, Selenium Grid, Page Object
Model, HTML, JavaScript, AutoIT, Log4j, Assertion, API Testing, etc.

✔Transposed 10000+ People into Automation across the World.


✔Customized Notes on All Topics.
✔Concept Retention with Funny Example.
✔In Depth Interview Preparation with Dedicated Sessions, Resume Writing Assistance and Much
More.

☑ First 4 sessions are free. ☑

✔Duration:- 3 Months
✔Monday to Thursday: - 2 Hours
✔Timing:- 9.30 PM to 11.30 PM IST
✔Fees:- 6000/-
✔Mode of Training: - Online

Click here to join Online Selenium Training : - https://bit.ly/39gGfwZ

Phone / WhatsApp Details:-


-----------------------------------------
Shammi Jha: - +91-8305429370

7 QA Idea

You might also like