Upload
francis-logan
View
219
Download
1
Embed Size (px)
Citation preview
www.ramkumarsjava.com
CODING STANDARDS,TESTING(UNIT & ASSEMBLY) &PERFORMANCE
Grp2
www.ramkumarsjava.com
CODING STANDARDS
www.ramkumarsjava.com
1) According to ORACLE, 80% of the lifetime cost of a software goes to ? A. NEW SOFTWARE DEVELOPMENT B. MAINTENANCE
Ans: MAINTENANCE
www.ramkumarsjava.com
2) Which of the following describes the Importance of coding Conventions?? A. Improved code quality B. bug free code C. easy maintainability D. scalability, readability
Ans : all the above, therefore results in better performance
www.ramkumarsjava.com
3) According to coding convention,” package declaration” is the last statement in a program? A. TRUE B.FALSE
Ans : false, package is first statement in a program
www.ramkumarsjava.com
4)_______ is the template which describes the details of an OBJECT. A. VARIABLE B.CLASS C.METHOD D.PACKAGE
Ans: CLASS
www.ramkumarsjava.com
5) Which of the following class name , follows the code convention?? A. class customercontroller B. class Customercontroller C. class CustomerController D. all the above
Ans : (c)class CustomerControllerFirst letter of class name and internal names should be CAPITAL
www.ramkumarsjava.com
6) Which of the following is available type of COMMENTS?? A. Single line comments B. Block comments C. JavaDoc comments
ANS: ALL THE ABOVE
www.ramkumarsjava.com
7) _________ are the memory locations which keeps on changing their value throughout execution of the program A. Constants B. Variables C. Constructors D .none
ANS: variables
www.ramkumarsjava.com
8) _______ are the special variables whose value never change throughout the program.A. Constants B. VariablesC. ConstructorsD. None
Ans: Constants
www.ramkumarsjava.com
9) _______ are the code of blocks which are executed the moment object is created.A. ConstantsB. VariablesC. ConstructorsD. None
Ans: Constructors
www.ramkumarsjava.com
10) Which of the following , follows the code conventions of constants?A. static final int Max_Length = 80;B. static final int Max_length = 80;C. static final int MAX_LENGTH=80;D. NONE
Ans: (c), variable name should be in capital
www.ramkumarsjava.com
11) Code conventions that to be followed with METHODS?A. First letter should be in lower caseB. First letter of each internal word should be capitalC. Method name should represent functionality of it.D. All the above
Ans: All the above
www.ramkumarsjava.com
12) Every switch statement should include a default case.A. TrueB. False
Ans: True
www.ramkumarsjava.com
13)When an expression will not fit on a single line, break it according to those general principles, this is called as ________??
Ans: Wrapping Lines
www.ramkumarsjava.com
14) Statement 1: Camel case notations used for variable declarations. Statement 2: Pascal case notations are used for object names.A. 1 & 2 are trueB. 1 true, 2 falseC. 1 false, 2 trueD. 1&2 are false
Ans: B
www.ramkumarsjava.com
15) Hungarian notation is used in ???A. JavaB. CC.C++D. All the above
Ans :C
www.ramkumarsjava.com
16) Which tools helps in checking the coding standards of java program in eclipse?A. PMDB. Check styleC. ACQT D. ALL THE ABOVE
Ans: A, B
www.ramkumarsjava.com
17) Some of the Code Formatting conventions on SPACING:Can we use spaces between a function name and parenthesis?
www.ramkumarsjava.com
Can we use a single space after a comma between function arguments??
www.ramkumarsjava.com
Can we use spaces inside brackets??
www.ramkumarsjava.com
Can we use single space before and after comparison??
www.ramkumarsjava.com
UNIT TESTING
www.ramkumarsjava.com
1.In OOPs , the smallest unit is a _____
Ans: Class
www.ramkumarsjava.com
2.Unit may be called as ____
Ans: Component
www.ramkumarsjava.com
3.The smallest testable part of an application is ____
Ans: Unit
www.ramkumarsjava.com
4. Unit testing validates the source code of a defined _____
Ans:Functional unit
www.ramkumarsjava.com
5.Unit testing helps a software developer to:(a)test code for correctness(b)Re-factor code faster(c)design better(d)Enhance documentation(e)All of the above
Answer: e
www.ramkumarsjava.com
6. Unit testing is usually done by the tester ,during the build phase of the application.(True/False)
Ans: False
www.ramkumarsjava.com
7._______ is the first step in build phase
Ans: UNIT TEST SCRIPTS or UNIT TEST CASES(UTC)
www.ramkumarsjava.com
8.Unit test should cover
Ans: -code -branches -paths -cycles
www.ramkumarsjava.com
9.Which technique is used for unit testing?
(a)Black-box testing(b)White-box testing(c)Both(d)None
Ans: b
www.ramkumarsjava.com
10.Which tool is used for unit testing?
Ans: JUNIT
www.ramkumarsjava.com
11.Benefits of unit testing are:-(a)facilitates change(b)simplifies integration(c)Provides living documentation(d)serves as a design(e)All of the above
Ans: e
www.ramkumarsjava.com
12.Unit testing deliverables are?
Ans:-Test Condition and Expected Results(TCER)-Test Cycle Control Sheet(TCCS)-Test Data-Test Drivers/Media Program Document-Test Environment Document
www.ramkumarsjava.com
13.Unit testing exposes only the presence of errors, not their absence.(True/False)
Ans: True
www.ramkumarsjava.com
14.A ____ is a statement that defines a constraint that must be satisfied by the program being tested
Ans: Test condition
www.ramkumarsjava.com
15.Test condition general principles are?
Ans:-Branch coverage-Condition coverage-Loop coverage-Interface coverage-Logic path coverage
www.ramkumarsjava.com
16.____ , _____ & _______ belong to loop coverage Ans: FOR, WHILE, DO-WHILE
www.ramkumarsjava.com
17.The ______ is when all the test conditions are re-executed for function modules influenced by a change or bug fix to the program
Ans: Regression test
www.ramkumarsjava.com
18. For database operations which three cases should be tested in a unit test?
Ans: 1) WHERE clause 2) data definition & operation 3) stored procedure & function
www.ramkumarsjava.com
19.The ______ is when all the test conditions are re-executed for function modules influenced by a change or bug fix to the program
Ans: Regression test
www.ramkumarsjava.com
20.The ____ checks the performance capability of the software or a system
Ans: Performance test
www.ramkumarsjava.com
21.During regression test the test data is the same as the before.(True/False)
Ans: True
www.ramkumarsjava.com
22.The nature of unit testing may have similarities with the debugging, and both can be considered same.(True/false)
Ans: False
www.ramkumarsjava.com
ASSEMBLY TESTING
www.ramkumarsjava.com
Q1) state true/false
Assembly test does not test complex functionality of final product.
Ans: true
www.ramkumarsjava.com
Q2) TCER stands for
A. Test condition and elaborated requirementsB. Test condition and expected requirementC. Test condition and expected resultD. Test condition and elaborated requests
Ans: c
www.ramkumarsjava.com
Q3) TCER A. Defines when and by whom test cycles are executedB. Explains what to test and how to carry out the test at high levelC. Details the exact stepsD. Explains the objectives and scope of the test.
Ans: B
www.ramkumarsjava.com
Q4) defines when and by whom test cycles are executed.
A. TCERB. TCCSC. RTMD. TEST SCRIPT
Ans: B
www.ramkumarsjava.com
Q5) test scenarios are created by:
A. Technical leadB. ManagerC. DeveloperD. Testing team
Ans: A
www.ramkumarsjava.com
Q6) ______________ and ______________ forms the part of test plan to be executed by test execution team.
A. TCER AND TCCSB. TCCS AND TEST SCRIPTC. TCCS AND TEST SCENARIOSD. TCER AND TEST SCRIPT
ANS: B
www.ramkumarsjava.com
Q7) _____________ is used as an input into planning the test to ensure that the application under testing meets the clients requirements.
A. Requirement documentB. Functional specification documentC. Technical specification documentD. RTM
Ans:A
www.ramkumarsjava.com
Q8)test condition are designed to address which of the following. Select all that apply.
A. Limit valuesB. Negative conditionsC. Exception conditionD. Positive condition
Ans: All
www.ramkumarsjava.com
PERFORMANCE
www.ramkumarsjava.com
1.Identify the reasons for performance degrade
(a)Lot of repeated method calls(b)lot of heavy weight object creation(c)improper use of loop(d)IO bottleneck(e)Switch(long if/else if) statements not used judiciously(f)Logging not used judiciously(g)Exception Handling not done properly
(i)(a),(b),(d) & (g) (ii)(b),(c),(f) & (g)(iii)all of the above(iv))c),(d),(e) & (g)
Ans: (iii)
www.ramkumarsjava.com
2.Performance improvement techniques in object creation?
(a)avoid creating objects in a loop(b)always try to use String literals instead of String objects(c)never create objects just for accessing a method(d)whenever you are done with an object make the reference null (e)never keep inheriting chains long(f)use primitive data types rather than using wrapper classes(g)whenever possible avoid using class variables, use local variables instead
(i)All of the above(ii)All except (e)(iii)All except (g)(iv)None of the above
Ans: (i)
www.ramkumarsjava.com
3. Lazy object creation refers to ________
Ans: delaying the memory allocation to an object till it is not being put into use
www.ramkumarsjava.com
4. Performance improvement techniques in using loops?
(a)use INT data type as loop index variable(b)avoid method calls, assigning values to variables or testing for conditions(c)avoid accessing array elements in a loop(d)avoid using try-catch inside the loops(e)if possible convert nested loops to a single loop
(i)(a),(b),(d) & (e) (ii)All of the above(iii)I’m not sure!
Ans: (ii)
www.ramkumarsjava.com
5. Performance improvement technique for IO
Ans: Use Buffered Streams to buffer the data and then read/write which gives good performance
www.ramkumarsjava.com
6. Choose the correct option: we’ll get bad performance if we use?
(a)FileInputStream.read(byte[] b)(b)FileOutputStream.write(int b)(c)BufferedInputStream.read()(d)BufferedOutputStream.write(int b)
(i)(a)(ii)(a) & (b)(iii)(c)(iv)(c) & (d)
Ans: (ii)
www.ramkumarsjava.com
7. Performance improvement techniques in Exception Handling?
(a)In a catch block avoid using the generic class Exception(b)Whenever you are using ‘throws’ clause always use the specific subclass of Exception(c)Don’t use Exception handling for anything other than exception handling like to control the flow of your program(d)Always use finally block to release resources(e)Don’t use Exception handling in loops(f)When using method calls always handle the exceptions in the method where they occur, don’t allow them to propagate to the calling method unless it is specifically required
(i)All except (f)(ii)All except (b)(iii)All of the above(iv)None of the aboveAns: (iii)
www.ramkumarsjava.com
8. Multithreading technique improves application performance.T/F?
Ans: T