fp3.1 test 2 questions

6
1. Output of the following program is main() { int iValue=0; for(iValue=0;iValue<20;iValue++) { switch(iValue) case 0:iValue+=5; case 1:iValue+=2; case 5:iValue+=5; default iValue+=4; break; } printf("%d,",iValue); } } a) 0,5,9,13,17 b) 5,9,13,17 c) 12,17,22 d) 16,21 2. #define square(x) x*x main() { int iValue; iValue = 64/square(4); printf("%d",iValue); } a) 64 b) 4 c) 16 d) 8 Ans: 64 3. main() { int iValue=_l_abc(10); printf("%d\n",--iValue);

Upload: kalpanasripathi

Post on 27-Dec-2015

20 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: FP3.1 Test 2 Questions

1. Output of the following program ismain(){int iValue=0;for(iValue=0;iValue<20;iValue++){switch(iValue)case 0:iValue+=5;case 1:iValue+=2;case 5:iValue+=5;default iValue+=4;break;}printf("%d,",iValue);}}a) 0,5,9,13,17b) 5,9,13,17c) 12,17,22d) 16,21

2. #define square(x) x*xmain(){int iValue;iValue = 64/square(4);printf("%d",iValue);}a) 64b) 4c) 16d) 8

Ans: 64

3. main(){int iValue=_l_abc(10);printf("%d\n",--iValue);}int _l_abc(int iValue){return(iValue++);}a) 11b) 9

Page 2: FP3.1 Test 2 Questions

c) 10d) compile error

4. Which of the following is NOT true regarding recursion and iteration?a) Any recursive method can be rewritten in an iterative form (with a loop)b) Recursive calls take time and consume additional memoryc) In general, recursive algorithms lead to better performance than iterative algorithmsd) A recursive method is a method that calls itself

5. The space factor when determining the efficiency of algorithm is measured bya) Counting the maximum memory needed by the algorithmb) Counting the minimum memory needed by the algorithmc) Counting the average memory needed by the algorithmd) Counting the maximum disk space needed by the algorithm

6. Which of the following is the independent examination of a work producta) Boundary value analysisb) Coverage analysisc) Bugd) Audit

7. Which of the following statement is false with regards to Unit testing?a) The goal of unit testing is to isolate each part of the program and show that the individual parts are correct.b) Unit testing is commonly automated, but cannot still be performed manually.c) To ensure testing robustness and simplify maintenance, tests should never rely on other tests nor should they depend on the ordering in which tests are executed.d) Unit test should be written without explicit knowledge of the environment context in which that they can be run anywhere at any time.

8. Which is a bottom-up approach to database design that design by examining the relationship between attributes?a) Functional dependencyb) Database modelingc) Normalization d) Decomposition

9. If n > 0, how many times will result be called to evaluate result(n) (including the initial call)?a) 2b) 2n

c) 2nd) n2

10. class MyClass {

Page 3: FP3.1 Test 2 Questions

int iValue;float fValue;MyClass(int iX_Value, float fY_Value){iValue=iX_Value;fValue=fY_Value;}public static void main(String args[]){MyClass myObj=new MyClass();System.out.println(“myObj.iValue=”+myObj.iValue+”, myObj.jValue=”+myObj.jValue);} a) myObj.iValue=0, myObj.jValue=0.0b) The code may result in compile time errorc) The code may result in run time errord) The code displays a garbage value

11. With pointer variables, you can _______________ manipulate data stored in other variables.a) neverb) seldomc) indirectlyd) all of these

12. The contents of pointer variables may be changed with mathematical statements that performsa) all mathematical operators that are legal in Cb) multiplication and divisionc) addition and subtractiond) b and c

13. What explains briefly but clearly, what the test case is doing?a) test case nameb) test procedurec) input conditiond) expected result

14. Which techniques is used to identifying the case in which, it consists of dividing all possible inputs into a set of classes, where either all inputs that fall into a given class are valid or all are invalid. Then selecting a few test cases from each class is sufficient.a) Equivalence portioningb) boundary value analysisc) logic coveraged) random generation

15. High level design of an algorithma) flowchartb) logic code

Page 4: FP3.1 Test 2 Questions

c) pseudocoded) data flow

Page 5: FP3.1 Test 2 Questions