11. Consider the following program:
#include<stdio.h>
main()
{
int i, inp;
float x, term=1, sum=0;
scanf(“%d %f”,&inp, &x);
{
term=term*x/i;
sum=sum+term;
}
printf(“Result=%f\n”,sum);
}
The program computes the sum of which of the following series?
(A) x+x2/2+x3/3+x4/4+… (B) x+x2/2!+x3/3!+x4/4!+…
(C) 1+x2/2+x3/3+x4/4+… (D) 1+x2/2!+x3/3!+x4/4!+…
Answer: B
Explanation:
term =1 , sum=0
suppose inp entered = 3 so First iteration
term= 1*x/1 = x
sum = 0 + x =x
Second iteration
term = x*x/2= x2/2 =x2/2! sum= x+x2/2!
Third iteration
term = =x2/2! *x/3
=x3/3.2.1=x3/3! sum= x+x2/2!+x3/3!
and so on so sum= x+x2/2!+x3/3!+……
- Consider the following two statements:
(a) A publicly derived class is a subtype of its base class.
(b) Inheritance provides for code reuse.
Which of the following statements is correct?
(A) Both the statements (a) and (b) are correct
(B) Neither of the statements (a) and (b) are correct
(C) Statement (a) is correct and (b) is incorrect
(D) Statement (a) is incorrect and (b) is correct
Answer: A
Explanation:
A publicly derived class is a subtype of its base class.
Inheritance provides for code reuse. BOTH are correct
- Consider a “CUSTOMERS” database table having a column “CITY” filled with all the names of Indian cities (in capital letters). The SQL statement that finds all cities that have “GAR” somewhere in its name, is:
(A) Select *from customers where city=’%GAR%’;
(B) Select *from customers where city=’$GAR$’;
(C) Select *from customers where city like ‘%GAR%’;
(D) Select *from customers where city as ’%GAR’;
Answer: C
Explanation:
For Matching Any String in Oracle Like Operator is Used. also % symbol is used as a wild card character to represent multiple characters.
- Match the following database terms to their functions:
List-I List-II
(a) Normalization (i) Enforces match of primary key to foreign key
(b) Data Dictionary (ii) Reduces data redundancy in a database
(c) Referential Integrity (iii) Define view(s) of the database for particular user(s).
(d) External Schema (iv) Contains metadata describing database structure.
Codes:
(a) (b) (c) (d)
(A) (iv) (iii) (i) (ii)
(B) (ii) (iv) (i) (iii)
(C) (ii) (iv) (iii) (i)
(D) (iv) (iii) (ii) (i)
Answer: B
Explanation:
Normalization: Reduces data redundancy in a database.
Data Dictionary: Contains metadata describing database structure.
Referential Integrity : Enforces match of primary key to foreign key.
External Schema: Define view(s) of the database for particular user(s).
- In general, in a recursive and non-recursive implementation of a problem (program):
(A) Both time and space complexities are better in recursive than in non-recursive program
(B) Both time and space complexities are better in non-recursive than in recursive program
(C) Time complexity is better in recursive version but space complexity is better in non-recursive version of the program
(D) Space complexity is better in recursive version but time complexity is better in non-recursive version of the program
Answer: C
- A three dimensional array in ‘C’ is declared as int A[x][y][z]. Here, the address of an item at the location A[p][q][r] can be computed as follows (where w is the word length of an integer):
(A) &A[0][0][0]+w(y*z*q+z*p+r)
(B) &A[0][0][0]+w(y*z*p+z*q+r)
(C) &A[0][0][0]+w(x*y*p+z*q+r)
(D) &A[0][0][0]+w(x*y*q+z*p+r)
Answer: B
- In C++, which system-provided function is called when no handler is provided to deal with an exception?
(A) terminate() (B) unexpected()
(C) abort() (D) kill()
Answer: A
Explanation:
This function is provided so that the terminate handler can be explicitly called by a program that needs to abnormally terminate, and works even if set_terminate has not been used to set a custom terminate handler
- Which of the following provides the best description of an entity type?
(A) A specific concrete object with a defined set of processes (e.g. Jatin with diabetes)
(B) A value given to a particular attribute (e.g. height-230 cm)
(C) A thing that we wish to collect data about zero or more, possibly real world examples of it may exist.
(D) A template for a group of things with the same set of characteristics that may exist in the real world
Answer: D
- Data which improves the performance and accessibility of the database are called:
(A) Indexes (B) User Data
(C) Application Metadata (D) Data Dictionary
Answer: A
- A relation R={A,B,C,D,E,F,G} is given with following set of functional dependencies:
F={AD→E, BE→F, B→C, AF→G}
Which of the following is a candidate key?
(A) A (B) AB
(C) ABC (D) ABD
Answer is D
Explanation:
ABD CLOSURE = { ABDE}={ABDEF}={ABCDEFG}
SO CANDIDATE KEY IS ABD
21. Which of the following services is not provided by wireless access point in 802.11 WLAN?
(A) Association (B) Disassociation
(C) Error Correction (D) Integration
Answer: C
Explanation:
IEEE 802.11 Services
- Which of the following fields in IPv4 datagram is not related to fragmentation?
(A) Type of service (B) Fragment offset
(C) Flags (D) Identification
Answer: A
- Four channels are multiplexed using TDM. If each channel sends 100 bytes/second and we multiplex 1 byte per channel, then the bit rate for the link is ……………
(A) 400 bps (B) 800 bps
Answer: D
Explanation:
The multiplexer is shown in the Figure.
Each frame carries 1 byte from each channel; the size of each frame, therefore, is 4 bytes, or 32 bits. Because each channel is sending 100 bytes/s and a frame carries 1 byte from each channel, the frame rate must be 100 frames per second. The bit rate is 100 × 32 = 3200 bps.
- In a typical mobile phone system with hexagonal cells, it is forbidden to reuse a frequency band in adjacent cells. If 840 frequencies are available, how many can be used in a given cell?
(A) 280 (B) 210
(C) 140 (D) 120
Answer: A
Explanation:
Each cell has six other adjacent cells, in a hexagonal grid. If the central cell uses frequency group A, its six adjacent cells can use B, C, B, C, B, and C respectively. In other words, only 3 unique cells are needed. So the answer is 840/3 = 280 frequencies.
- Using p=3, q=13, d=7 and e=3 in the RSA algorithm, what is the value of ciphertext for a plain text 5?
(A) 13 (B) 21
(C) 26 (D) 33
Answer: Marks to all
Explanation:
p=3, q=13, d=7, e=3, M=5, C=?
C = Me mod n
n = p*q
= 3*13 = 39
C = 53 mod 39
= 8
Answer is 8.
- A virtual memory has a page size of 1K words. There are eight pages and four blocks. The associative memory page table contains the following entries:
Which of the following list of virtual addresses (in decimal) will not cause any page fault if referenced by the CPU?
(A) 1024, 3072, 4096, 6144 (B) 1234, 4012, 5000, 6200
(C) 1020, 3012, 6120, 8100 (D) 2021, 4050, 5112, 7100
Answer: C
Explanation:
The pages which are not in main memory are:
Page | Address | Address that will cause page fault |
1 | 1K | 1024-2047 |
3 | 3K | 3072-4095 |
4 | 4K | 4096-5119 |
6 | 6K | 6144-7167 |
1020 will not cause page fault (1024-2047)
3012 will not cause page fault (3072-4095)
6120 will not cause page fault (4096-5119)
8100 will not cause page fault (6144-7167)
- Suppose that the number of instructions executed between page faults is directly proportional to the number of page frames allocated to a program. If the available memory is doubled, the mean interval between page faults is also doubled. Further, consider that a normal instruction takes one micro second, but if a page fault occurs, it takes 2001 micro seconds. If a program takes 60 sec to run, during which time it gets 15000 page faults, how long would it take to run if twice as much memory were available?
(A) 60 sec (B) 30 sec
(C) 45 sec (D) 10 sec
Answer: C
Explanation:
T = Ninstr x 1µs + 15,000 x 2,000 µs = 60s
Ninstr x 1µs = 60,000,000 µs – 15,000,000 µs = 30,000,000 µs
Ninstr = 30,000,000
The number of instruction between two page faults is
Ninstr /NPageFaults = 30,000,000/15,000 = 2,000
If the mean interval between page faults is doubled, the number of instruction between two page faults is also doubled and is 4,000. Now the number of page faults is
30,000,000/4,000 = 7,500
T’ = 30,000,000 µs + 7,500 x 2,000 µs
= 30,000,000 µs + 15,000,000 µs = 45,000,000 µs = 45s
Doubling the memory, doesn’t mean that the program runs twice as fast as on the first system. Here, the performance increase is of 25%.
- Consider a disk with 16384 bytes per track having a rotation time of 16 msec and average seek time of 40 msec. What is the time in msec to read a block of 1024 bytes from this disk?
(A) 57 msec (B) 49 msec
(C) 48 msec (D) 17 msec
Answer: B
Explanation:
Time in msec to read a block of 1024 bytes (Access time or Disk Latency) = seek time + average rotational delay + transfer time
If there are 16384 bytes per track there are 1024/16384 tracks to be read for this block.
Seek time = 40 msec
Rotational delay = 16 msec
Transfer time = (sectors_read/sectors per rev.) x rotational delay
= (1024/16384) x 16 = 1
average rotational delay = rotational delay/2 = 16/2 = 8
access time = 40 + 8 + 1 = 49
- A system has four processes and five allocatable resources. The current allocation and maximum needs are as follows:
Allocated | Maximum | Available | |
Process A | 1 0 2 1 1 | 1 1 2 1 3 | 0 0 x 1 1 |
Process B | 2 0 1 1 0 | 2 2 2 1 0 | |
Process C | 1 1 0 1 0 | 2 1 3 1 0 | |
Process D | 1 1 1 1 0 | 1 1 2 2 1 |
The smallest value of x for which the above system in safe state is ………….
(A) 1 (B) 3
(C) 2 (D) 0
Answer: Marks to all
Explanation:
If Process A’s Maximum need is 1 1 2 1 2 instead of 1 1 2 1 3, then answer will be x=1
The needs matrix is as follows:
0 1 0 0 1
0 2 1 0 0
1 0 3 0 0
0 0 1 1 1
If x is 0, available vector will be 0 0 0 1 1, we have a deadlock immediately.
If x is 1, available vector will be 0 0 1 1 1, now, process D can run to completion. When it is finished, the available vector is 1 1 2 2 1.
Now A can run to complete, the available vector then becomes 2 1 4 3 2.
Then C can run and finish, return the available vector as 3 2 4 4 2.
Then B can run to complete. Safe sequence D A C B.
- In Unix, the login prompt can be changed by changing the contents of the file ……………
(A) contrab (B) init
(C) gettydefs (D) inittab
Answer: C