### KPPSC Lecturer Computer Science Previous Paper with Answer Keys and Reference 0

Khyber Pakhtunkhwa Public Service Commission

KPPSC Lecturer Computer Science Paper with Answer keys held on 17-11-2021

Time allowed: 1 hour

Max marks: 45

1. The minimum number of temporary variables needed to swap the contents of two variables is

a) 1
b) 3
c) 4
d) 0 *

Check Reference

Note: This question was missing correct option i.e. 0 in the actual paper.

2. When a variable of data type double is converted into float, then

a) Rounding takes place
b) Truncation takes place
c) The lower order bits are dropped
d) None of these

Answer: a) Rounding takes place
Check Reference

3. Choose the correct statements

a) All The elements of the array should be of the same data type and storage class
b) The number of subscripts determines the dimension of the array
c) Both of these
d) None of these

Answer: b) The number of subscripts determines the dimension of the array

Check Reference

4. Initialization cannot be part of the definition if the storage class of the array is

a) static
b) automatic
c) external
d) none of these

5. English language uses full stop as a sentence

a) Separator
b) Terminator
c) Both of these
d) None of these

Answer: c) Both (a) and (b)

a) Function having the same name but with different types of parameters
b) An operator, whose meaning is determined by the operand type
c) Both (a) and (b)
d) None of these

Answer: c) Both (a) and (b)

7. If the parameters are passed by name the output will be:

a) 2,4
b) 4,2
c) 2,2
d) 4,4

Note: Coding part is missing, the complete question as under:
Consider the following program fragment.
Procedure exchange (A: integer, B: integer)
temp: integer;
temp: = A; A:=B; B:=temp
end;
begin
M: = 2; X[X] :=4;
exchange (M,X[M]; write (M,x);
end
If the parameters are passed by name the output will be:
a) 2,4
b) 4,2
c) 2,2
d) 4,4

8. Binding cannot be done

a) When separately compiled modules are linked together
c) While writing a program
d) None of these

Answer: d) none of these

9. What is the maximum value of the function f(x) = 2×2 -2x + 6 in the interval [0, 2]?

a) 6
b) 10
c) 12
d) 5

10. The number of equivalence relation of the set {1,2,3,4} is:

a) 15
b) 16
c) 24
d) 4

11. In a paged memory, the page hit ratio is 0.35. The time required to access a page in secondary memory is equal to 100 ns. The time required to access a page in primary memory is 10 ns. The average time required to access a page is

a) 3.0 ns
b) 68.0 ns
c) 68.5 ns
d) 78.5 ns

Answer: c) 68.5 ns

12. Which of the following scheduling policy is well suited for a time-shared operating system?

a) First come first serve.
b) Shortest job first
c) Round robin
d) None of these

Answer: c) Round robin

13. Any given truth table can be represented by a :

a) Karnaugh Map
b) Sum of product of Boolean expressions
c) Product of sum of Boolean expressions
d) All of these

Answer: (d) All of these

14. The number of columns in a state table for a sequential circuit with m flip-flops and n inputs is

a) m + n
b) m + 2n
c) 2m + n
d) 2m + 2n

Answer: d) 2m + 2n

15. Which of the following architecture is/are not suitable for realizing SIMD ?

a) Vector Processor
b) Array Processor
c) Von Neumann
d) All of these

16. If memory access takes 20 ns with cache and 110 ns without it, then the ratio ( cache uses a 10 ns memory) is:

a) 93%
b) 90%
c) 88%
d) 87%

Check Reference

17. Which of the following is minimum error code?

a) Optical code
b) Binary code
c) Grey code
d) None of these

Answer: c) Grey code

18. How many flip flag circuit are needed to divide by 16?

a) 4
b) 8
c) 16
d) None of these

19. A compiler – compiler is a/an

a) compiler which compiles a compiler program
b) software tool used in automatic generation of a compiler
c) compiler which in the same language it compiles
d) another name for cross. compiler

Answer: (b) software tool used in automatic generation of a compiler

20. The delay between job submission and job completion is called

a) turnaround time
b) in-process time
c) response time
d) wailing time

Answer: (a) turnaround time

21. Which technique is preferable for transferring a large amount of data to and from a memory in a short time?

a) Programmed I/O
b) Interrupt driven I/O
c) DMA
d) None of these

22. A software is to be developed for a system which has a small memory. The software should?

a) avoid using recursion
b) Not use macros instead of functions
c) Both of these
d) None of these

Answer: c) both of these

23. A function that does the same operation on different data types is to be implemented using

a) macros
c) function templates
d) default arguments

Answer: c) function templates

24. The order in which operands are evaluated in an expression is predictable if the operator is:

a) *
b) +
c) %
d) &&

25. Which of the following comments about object oriented design of software, is not true?

a) Objects inherit the properties of class
b) Classes are defined based on the attributes of objects
c) classes are always different
d) an object can belong to two classes

Answer: d) an object can belong to two classes

26. Design phase will usually be

a) Top-down
b) Bottom-up
c) Random
d) None of the above

27. Which of the following is a desirable property of a module?

a) High coupling
b) Independency
c) Low cohesiveness
d) Multi functioning

28. The extent to which the software can continue to operate correctly despite the introduction of invalid inputs is called as

a) Reliability
b) Fault tolerance
c) Robustness
d) Portability

29. Which of the following graph theoretic concept will be useful in software testing?

a) Hamiltonian circuit
b) Eulerian cycle
c) Cyclomatic number
d) None of these

Answer: c) Cyclomatic number

30. In unit testing a module, it is found that for a set of test data, maximum 90% of the code alone were tested with a probability of success 0.9. The reliability of the module is

a) greater than 0.9
b) equal to 0.9
c) at most 0.81
d) at least 1/0.81

Answer: c) at most 0.81

31. The programme volume of a source code with 10 operators, including 6 unique operators, 6 operands including 2 unique operands. The program volume is

a) 48
b) 100
c) 512
d) Cannot be determined

32. A PL /SQL block can return data to SQL* plus through:

a) Local variables
b) Bind variables
c) substitution variables
d) none of these

Answer: a) Local variables

33. Which of the following SQL* Plus commands can be used to see the compilation errors in a PUSQL code?

a) TRACE
b) PROFILE
c) DEBUG
d) SHOW ERRORS

Answer: d) SHOW ERRORS

34. In SQL 10 null be evaluated to

a) False
b) -1
c) Null
d) 10

35. Which of the following is illegal?

a) SELECT SYSDATE – SYSDATE FROM DUAL;
b) SELECT SYSDATE – (SYSDATE – 2) FROM DUAL;
c) SELECT SYSDATE – (SYSDATE + 2) FROM DUAL;
d) None of these

Answer:  d) None of these
Check Reference

36. Which of the following SQL commands can be used to add data to a database table?

a) INSERT
c) UPDATE
d) APPEND

37. The SQL statement: select LPAD(‘abcd’,10,’wert’) from dual; prints

a) Wertwertab
b) Wertweabcd
c) Abcdwertwer
d) None of these

38. The basic programming unit of a PL/SQL code is

a) Procedure
b) Sub-program
c) Module
d) Block

Check Reference

39. Which of the following package can be used to build dynamic SQL?

a) Writing a query with parameters
b) Using sp_executesql
c) Using EXEC
d) All of these

Answer: d)  All of these

Check Reference

40. Which of the following keyword is not used in PL/SQL procedure creation?

a) Declare
b) Begin
c) Exception
d) End

Check Reference

41. Logically speaking, in general it is a good idea to set the values of the checkbox making of the other values property to the value of the property

a) Value when checked
b) Value when unchecked
c) Null
d) None

42. Summary column can be used to display

a) Total
b) Minimum value
c) Average
d) All of these

Answer: d) all of these

43. Column names used and reports are

a) Global
b) Local to the query
c) Local to the groups
d) None of these

Check Reference

44. Records that are displayed by a form can be edited if the mode of the corresponding query is

a) Query
b) Enter query
c) Normal
d) Enter normal

Check Reference

45. At a particular time of computation, the value o. a counting semaphore is 7. Then 20 P operation and ‘x’ V operation were completed on this semaphore. If the final value of the semaphore is 5, x will be

a) 15
b) 22
c) 18
d) 13