Thursday, 28 June 2018

Technical Lead QA Questions asked in Sears Holdings


1. What is the best definition of a Class?
a) A provision for holding state and behaviour together.
b) Can only have state and behaviour at Class level also.
c) An entity that is formed with neat boundries clear responsibilities and remains cohesive.
d) A template for an object that encapsulates state(s) amd behaviour.

2. Which statements are true out of the following :-
            S1: Static State have same value in all objects.
            S2: Non Static can have same/different value in all the object.
            S3: Non Static states and behaviour belongs to Class and not to Object.
a)     S1,S2
b)    S1,S2
c)     S1,S3
d)    S1,S2,S3

3. What is true about Object :-
S1: Contains all Static Stuff
S2: Gets created with initialized values of Non-Static/Static states for fields.
S3: Example of Encapsulation
a)     S1,S2,S3
b)    S2,S3
c)     S1,S2
d)    S1,S3

4.Same Behaviour but different implementation is: -
a.     Polymorphism
b.    Abstraction
c.     Encapsulation
d.    Inheritance

5.Which of the following assumption is true: -
S1: Static Global Variable
S2: Non Static Parameters
S3: Static Local Variables
S4: Non Static Method
a)     S1,S3
b)    S2,S3
c)     S1,S2 and S4
d)    All of the above

6.Out of the following which one is non-primitive data type: -
a) Int
b) String
c) Float
d) Boolean

7.Can we access Non Static stuff directly inside Static Method?
a)     Yes
b)    No

8.Can we access everything (Static, Non Static Stuff) directly inside Non Static Method :-
a) No
b) Yes

9.     Which term is not an equivalent term of Non Static Method: -
a.     Instance Method
b.    Dynamic Method
c.     Class Method
d.    Object Method

10.  Can we access local variables indirectly: -
a.     Yes
b.    No
c.     Yes and No

11.  If I am not initializing local variable but I haven’t used it anywhere then what will happen in this case :-
a.     Gives Compilation Error
b.    Default Initialization will happen
c.     Exception will come
d.    No error will come until we use the local variable anywhere

12.  Which Statement(s) is/are False
S1: Constructor cannot be abstract
S2: Constructor can be Static
S3: It can have any return type
S4: It returns a value
a)     All of the above
b)    S1,S4
c)     S2,S3
d)    S2,S3,S4

13.  Identify the output of the following code snippet: -
package this_keyword;
public class UsageOfThis {
int i=1;
public void method1(UsageOfThis ref) {
System.out.println(ref.i);
System.out.println(i);
System.out.println(this.i);
}
public void method2(){
System.out.println(i);
UsageOfThis ref2 = new UsageOfThis();
this.i=3;
i=6;
System.out.println(this.i);
System.out.println(ref2.i);
method1(this);
}
public static void main (String[] args){
UsageOfThis ref1 = new UsageOfThis();
ref1.method2();
System.out.println(ref1.i);
}
}

14.  Identify the Output of the following code snippet :-
package rough;
public class DIL{
{
int i=9;
}
int i=0;
{
int i =8;
}
public static void main (String[] args){
DIL ref = new DIL ();
System.out.println(ref.i);
}
}

15.  Identify the Output of the following code snippet :-
package rough;
public class DIL{
{
 i=9;
}
int i=0;
{
 i =8;
}
public static void main (String[] args){
DIL ref = new DIL ();
System.out.println(ref.i);
}
}

16.  If you are reviewing a code written to automate, how would you go about doing this activity?

17.  If you are writing code in Java, please explain the UMl artifacts you will want to create, and why.

18.  If there is a need to run your tests across environments (DEV,QA, etc.) explain in detail, the steps you will take to ensure that one ca run tests across environments with ease.

19.  If you are using recursion to solve any problem, what are the guidelines you will follow?

20.  Automate the following scenario :
a.     Open a website www.xyz.com
b.    Click on a button whose attribute “id” is dynamic in nature (e.g., id=”abc123”,”abc3531” and so on…where text “abc” is static)
c.     On clicking above button a new browser window opens up.
d.    Go to new browser window and select the 11th dropdown option fron drop down menu(id=drpdwn) where the DropDown is inside a fram (id=frameid1)
e.     On selecting the above drop down option a confirmation message “Option Saved successfully” shows up(outside the frame) – Validate this message (Your Test Case will Pass/Fail on this validation and you are not allowed to use any conditional statements like if – else to validate)
f.     Close the Parent Window.

21.  What do you expect as output: -
SELECT id, YEAR(BillingDate) AS BillingYear FROM invoices WHERE BillingYear >=2010;

22.  Tell the output: -
Class A {
public static void main(String args[]){
String str1 =”ABCD”;
String str2 = new String(“ABCD”);
if (str1.equals(str2)){
System.out.println (“Hello1”);
}
if (str1==str2){
System.out.println (“Hello2”);
}
if (str1.equalsIgnoreCase(str2)){
System.out.println (“Hello3”);
}
}
}

23.  Write a short note on using XML,JSON – can you enumerate principal benefits of using any of these?

24.  Use regular expression to change “dd-MON-YYYY” to “MON/YYYY/DD”.

25.  Write a program to count the number of occurrences of an integer in an array.
Ex:- int[] arr= {2,4,6,2,8,9,4,4}
O/P :- 2 occurred 2 times; 4 occurred 3 times and so on.

Enjoy Interview.

No comments:

Post a Comment