Networking/Databases/C/SE/SQL/HTML Test Set 1

1)   Which of the following transport protocols uses UDP?

a. SMTP
b. Telnet
c. HTTP
d. DNS
Answer  Explanation 

ANSWER: DNS

Explanation:
Either TCP or UDP can be used as transport protocol connecting to the server port. Ordinary DNS requests can be made with TCP.


2)   Which system call results in the sending of the SYN Packets?

a. Socket
b. Connect
c. Bind
d. Listen
Answer  Explanation 

ANSWER: Socket

Explanation:
There is a 3 way handshake where A sends a SYN packet to B. B receives B sends the acknowledgement and vice versa. Hence a socket is used to do all this sending an receiving and establish a TCP connection.


3)   State the bit rate in ethernet when manchester encoding is used.

a. Same as the band rate
b. half of the band rate
c. Twice the band rate
d. None of these
Answer  Explanation 

ANSWER: half of the band rate

Explanation:
In manchester encoding, 2 signals changes to represent a bit. So the band rate (no of signal/sec)=2*bit rate (no of bits/sec). Hence, bit rate is half of the band rate.


4)   State the concurrency protocols which ensure both conflict serializability and freedom from deadlock
1. 2-phase locking
2. Time-stamp ordering


a. 1 only
b. 2 only
c. Both 1 and 2
d. Neither 1 nor 2
Answer  Explanation 

ANSWER: 2 only

Explanation:
As the time- stamp ordering is a non-lock concurrency control method. It is used to safely handle transactions.


5)   Why are B+ trees preferred over binary trees in databases?

a. Disk capacities are greater than memory capacities
b. Disk access is much slower than memory access
c. Disk data transfer rates are much less than memory data transfer rates
d. Disks are more reliable than memory
Answer  Explanation 

ANSWER: Disks are more reliable than memory

Explanation:
Transfer of data from disk to primary memory is in form of data blocks. These data blocks can store large information while transferring,transferring on single block is more efficient.


6)   Which of the following forms is considered as adequate for normal relational database design?

a. 1NF
b. 5NF
c. 4 NF
d. 3NF
Answer  Explanation 

ANSWER: 3NF

Explanation:
There is not always a decomposition into BCNF that is lossless and dependency preserving. So 3NF is considered adequate for normal RDBMS design.


7)   Which of these is a client server application?

a. Web browsing
b. E-mail
c. Internet Chat
d. All of the above
Answer  Explanation 

ANSWER: All of the above

Explanation:
In Computer science client-server is a software architecture model consisting of two parts, client systems and server systems, both communicating over a computer network or on the same computer. A client-server application is a distributed system made up of both client and server software.


8)   Which of the following objects can be used in expression and scriplets in JSP without explicitly declaring them?

a. Request and response only
b. Response and session only
c. Session and request only
d. Session,request and response
Answer  Explanation 

ANSWER: Session and request only

Explanation:
Implicit objects in JSP are Session: The session object for the client.
Request: the request triggering the execution of the JSP page.


9)   Which of the following statements are true?

a. HTTP runs over TCP
b. HTTP allows information to be stored in a URL
c. HTTP can be used to test the validity of a hypertext link
d. All of the above
Answer  Explanation 

ANSWER: All of the above

Explanation:
No explanation is available for this question!


10)   C has garbage collectors


a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
C does not have any garbage collectors because it is an age old language and during the time this language was developed it was developed without garbage collectors.


11)   What is a null pointer?

a. Null pointer is a pointer which is pointing to nothing
b. Null pointer points the base address of segment
c. Pointer which is initialized with NULL value is considered as NULL pointer.
d. All of the above
Answer  Explanation 

ANSWER: All of the above

Explanation:
No explanation is available for this question!


12)   What is size of void pointer?


a. 3
b. 9
c. 10
d. Platform dependent value
Answer  Explanation 

ANSWER: Platform dependent value

Explanation:
The size of a void* is a platform dependent value. Typically it's value is 4 or 8 for 32 and 64 bit platforms respectively. If you are getting 2 as the value then your likely running on a 16 bit coding platform (or potentially have a coding error).


13)   C Programming : Find the output

#include< stdio.h>
void i(int *a,int *b)
{
       a=b;
*a=2;      }
int x=0,y=1;
int main()
{
i(&x,&y);
printf(ā€œ%d%d\nā€,x,y);
return 0;
      }



a. 22
b. 21
c. 02
d. 01
Answer  Explanation 

ANSWER: 02

Explanation:
It begins from main I and j globally initialized by 0 and 1. So when we call function i(&x,&y) the address of x and y are passed. When a=b and *a=2 means *b=2, so value of *b is passed 2 and value of *b return to y and value of x and y as 2.
So printf(ā€œ%d%d\nā€,x,y) give output (0,2)


14)   C Programming : Consider the following program

int n(int i)
{
     static int a=0;
     if(i<=0) return 1;
     if (i>3)
     {
          a=i;
return n(i-2)+2;
                }
               return n (i-1)+a;
           }
             What is the value of f(5)?


a. 5
b. 10
c. 12
d. 18
Answer  Explanation 

ANSWER: 18

Explanation:
No explanation is available for this question!


15)   From the following which is not desired in a good software requirement specification (SRS) Document

a. Goals of Implementation
b. Non-Functional Requirement
c. Functional Requirement
d. Algorithm for software implementation
Answer  Explanation 

ANSWER: Algorithm for software implementation

Explanation:
No explanation is available for this question!


16)   The coupling between different modules of a software is as follows
1. Content coupling
2. Common coupling
3. Control coupling
4. Stamp coupling
5. Data coupling
Arrange the coupling between modules from strongest(least desirable) to weakest (most desirable) as follows


a. a) 5,4,3,2,1
b. b) 1,3,5,4,2
c. c) 1,2,3,4,5
d. d) 4,2,5,1,3
Answer  Explanation 

ANSWER: c) 1,2,3,4,5

Explanation:
Content
Common
Control
Stamp
Data


17)   Identify which of the following statements are true?

1. The context diagram should depict the system as a single bubble
2. Control Information should not be represented in a DFD
3. A data store can be connected either to another data store or to an external entity.
4. External entities should be identified clearly at all levels of DFD's


a. 1 and 2
b. 2 and 3
c. 3 and 4
d. 1,2 and 4
Answer  Explanation 

ANSWER: 1 and 2

Explanation:
No explanation is available for this question!


18)   From the following sorting algorithms which has the lowest worst case complexity?

a. Bubble sort
b. Quick sort
c. Merge sort
d. Selection sort
Answer  Explanation 

ANSWER: Merge sort

Explanation:
Let the input be n. The merge sort uses the weak complexity their complexity is shown as O(n log n).


19)   From the following sorting algorithms which algorithm needs the minimum number of swaps

a. Bubble sort
b. Quick sort
c. Merge sort
d. Selection sort
Answer  Explanation 

ANSWER: Selection sort

Explanation:
First find the smallest in the array and exchange it with the element in the first position, then find the second smallest element and exchange it with the element in the second position and continue in this way until the entire array is sorted. Hence, we say that selection sort takes the minimum number of swaps.


20)   Out of 4 distinct keys how many distinct primary keys can be created?

a. 5
b. 20
c. 45
d. 14
Answer  Explanation 

ANSWER: 14

Explanation:
the no of keys given are 4
apply the formula Bn=1/(n+1)*(2n!/n!n!)
where B is the binary tree and n is the number of keys.
Bn=1/(4+1)*(8!/4!4!)
Bn=1/5*(8*7*6*5*4!)/4!4!
Bn=8*7*9*6/(4*3*2)
Bn=56/4
Bn=14
Hence, the total no of binary trees with n=4 is 14.


21)   What are the different SQL statements?
1. DML
2. DDL
3. DCL
4. DQL



a. 1 and 2
b. 2 and 3
c. 3 and 4
d. 1,2 and 3
e. All of the above
Answer  Explanation 

ANSWER: All of the above

Explanation:
All these statements are used to make a sql query.


22)   What are the different types of joins?

1. Outer join
2. Inner join
3. Right join
4. Left join
5. Full join



a. 1 and 3
b. 4 and 5
c. 3,4 and 5
d. All of the above
Answer  Explanation 

ANSWER: All of the above

Explanation:
All these are the different types of joins.


23)   Which SQL command is used to insert a row in a table?

a. Select
b. Create
c. Insert
d. Drop
Answer  Explanation 

ANSWER: Insert

Explanation:
Insert is used to add data to the tables or add rows to the table.


24)   From the following statements which of them is/are true about SQL

1. All attributes used in the group by clause must appear in the select clause
2. An SQL query can contain a having clause only if it has a group by clause
3. An SQL query can contain a having clause even if it does not have a group by clause
4. Not all attributes used in the group by clause need to appear in the select clause


a. 3 and 4
b. 1 and 2
c. 1,3 and 4
d. All of the above
Answer  Explanation 

ANSWER: 3 and 4

Explanation:
Statement number 3 is true because it considers the output by select query as a single group if group by statement is not present.


25)   Consider the following set of relations

EMP ( emp_no,emp_name,dept_no,salary)
DEPT (dept_no,dept_name,location)
Write SQL query for the following
Find all the employees whose departments are located in 'Mumbai' and salary is greater than Rs. 20,000.


a. select emp_name from dept where dept_no and location='Mumbai';
b. select emp_name from emp where salary > 20,000 and dept_no in (select dept_no from dept where location = 'Mumbai');
c. select dept_no ,count(emp_no) from emp where salary > 50,000 group by dept_no;
d. update table emp where emp_name='Mumbai';
Answer  Explanation 

ANSWER: select emp_name from emp where salary > 20,000 and dept_no in (select dept_no from dept where location = 'Mumbai');

Explanation:
No explanation is available for this question!