Here we go.!!
a.A cookie is a piece of code that has a potential to compromise the security of an Internet user.
b. A cookie gains entry to the user's work area through an HTTP Header.
c. It has expiry date and time.
d. It can be used to track the browsing pattern of a user at a particular site.
a. Any personal information that you give to a Web site, including credit card information, will most likely be stored in a cookie unless you have turned off the cookie feature in your browser.
b.
c. The Expires directive in cookie tells the browser the exact/absolute date and time to delete the cookie
d If the user requests a page of the site for first time the server creates a random string and sends it as a cookie back to the browser together with the requested page;this cookie will automatically be sent by the browser to the server every time a new page from the site is requested;the server stores the URL of the requested page, the date/time of the request, and the cookie in a log file. By analyzing the log file collected in the process it is possible to plot browsing pattern.
Ans: a
2.If a binary tree has 20 leaves, then how many nodes will have two children nodes?
If there are n leaves, there will be (n-1) nodes having two child nodes.
Answer is 20-1=19
3. In a typical server in which order the operations- accept, bind, listen and recv - will be executing?
a)listen,bind,accept,recv
b)bind,listen,accept,recv
c)listen,accept,bind,recv
d)accept,listen,bind,recv
bind( ) :to associate the socket with a port on server machine
listen( ) :wait for incoming connections
accept( ):accept the connection request and returns new socket file descriptor
recv( ) : accepts the data from the client.
The order is as in (b):
4. Assume that for a certain processor, a read request takes 50 nanoseconds on a cache miss and 5 nanoseconds in a cache hit. Suppose while running a program, it was observed that 80% of the processor's read requests result in a cache hit. The average read access time in nanoseconds is :
Ans: effective memory access time = (hit rate * cache access time) + (miss rate * access time for cache miss),
(50x20+5x80)/100=14 ns
5. Find the number of divisors for 2100?
To find the number of positive integral divisors, write the number as a product of prime numbers. Add one to exponent value of each prime number and multiply them together .
Read the method in detail here.
Given number 2100 can be represented as 2100=2*3*5*7*2*5=2^2 * 3 * 5^2* 7
Total number of divisors= (2+1)*(1+1)*(2+1)*(1+1)= 3*2*3*2= 36
6. Let R be the relation on the set of positive integers such that aRb if and only if a and b are distinct and have a common divisor other than 1. Which one of the following statements about R is true?
a) Reflexive and symmetric but not transitive
b) Neither Reflexive nor symmetric but transitive
c) Symmetric but not reflexive, not transitive
d) Reflexive but not symmetric, not transitive
Ans c
#Given relation is symmetric for all integers. eg: 7R21 means 21R7
#Given relation cannot be reflexive as a and b should be distinct numbers.
#Given relation may not be transitive Eg: 7R21 and 21 R 3 are true but 7R3 is false.
7. What will the following code print if input is given as ABCD EFGH
void foo(char *a)
{
if(*a && *a != ' ')
foo(a+1);
putchar(*a);
}
a. ABCD EFGH
b. ABCD
c. EFGH
d. DCBA
Ans d
8. Match the following
A. Lexical analysis i. Graph coloring
B. Parsing ii. DFA minimization
C. Register allocation iii. Post order traversal
D. Expression evaluation iv. production tree
Solution:
A -ii B- iv C-i D-iii
9. In a bank transaction scenario, read(x); x:=x-50; write(x); ready(y); y:=y+50; write(y);. The restriction such that the sum of x and y should always be a constant will come under which property?
a. Atomicity
b. Consistency
c. Isolation
d. Durability
Ans: b
10. In an unordered list of numbers find the complexity of an algorithm to search for an element which is neither maximum nor minimum.
a. Θ(n logn)
b. Θ( n)
c. Θ(log n)
d. Θ(1)
Ans: d
We only need to consider any 3 elements and compare them. So the number of comparisons is constants, that makes time complexity as Θ(1)
Let us take an array {10, 20, 15, 7, 90}. Output can be 10 or 15 or 20Pick any three elements from given liar. Let the three elements be 10, 20 and 7.
Using 3 comparisons, we can find that the middle element is 10