Thursday, February 27, 2014

Short notes on computer terms




ASCII - Acronym for the American Standard Code for Information Interchange. Pronounced ask-ee, ASCII is a code for representing English characters as numbers, with each letter assigned a number from 0 to 127. For example, the ASCII code for uppercase M is 77. Most computers use ASCII codes to represent text, which makes it possible to transfer data from one computer to another.

Gate questions with answer

1. The minimum number of D flip-flops needed to design a mod-258 counter is
     (A) 9 (B) 8 (C) 512 (D) 258


2. A thread is usually defined as a ‘light weight process’ because an operating
system (OS) maintains smaller data structures for a thread than for a process. In
relation to this, which of the followings is TRUE?

(A) On per-thread basis, the OS maintains only CPU register state
(B) The OS does not maintain a separate stack for each thread
(C) On per-thread basis, the OS does not maintain virtual memory state
(D) On per thread basis, the OS maintains only scheduling and accounting
information


3. The lexical analysis for a modern computer language such as Java needs the
power of which one of the following machine models in a necessary and sufficient
sense?
(A) Finite state automata
(B) Deterministic pushdown automata
(C) Non-Deterministic pushdown automata
(D) Turing machine

4. Let the page fault service time be 10ms in a computer with average memory
access time being 20ns. If one page fault is generated for every 106 memory
accesses, what is the effective access time for the memory?
(A) 21ns (B) 30ns (C) 23ns (D) 35ns

5. In a compiler, keywords of a language are recognized during
(A) parsing of the program                         (B) the code generation
(C) the lexical analysis of the program   (D) dataflow analysis

6. If two fair coins are flipped and at least one of the outcomes is known to be a
head, what is the probability that both outcomes are heads?
(A) 1/3 (B) 1/4 (C) 1/2 (D) 2/3

7. Consider different activities related to email.
m1: Send an email from a mail client to a mail server
m2: Download an email from mailbox server to a mail client
m3: Checking email in a web browser
Which is the application level protocol used in each activity?
(A) m1:HTTP m2:SMTP m3:POP             (B) m1:SMTP m2:FTP m3:HTTP
(C) m1: SMTP m2: POP m3: HTTP      (D) m1: POP m2: SMTP m3:IMAP

8. Which of the following pairs have DIFFERENT expressive power?
(A) Deterministic finite automata (DFA) and Non-deterministic finite automata
(NFA)
(B) Deterministic push down automata (DPDA) and Non-deterministic push down
automata (NPDA)
(C) Deterministic single-tape Turing machine and Non-deterministic single tape
Turing machine
(D) Single-tape Turing machine and multi-tape Turing machine
9. Which of the following is NOT desired in a good Software Requirement
Specifications (SRS) document?
(A) Functional Requirements
(B) Non Functional Requirements
(C) Goals of Implementation
(D) Algorithms for Software Implementation

10. A computer handles several interrupt sources of which the following are relevant
for this question.
Interrupt from CPU temperature sensor
Interrupt from Mouse
Interrupt from Hard Disk
(A) Interrupt from Hard Disk              (B) Interrupt from Mouse
(C) Interrupt from Keyboard              (D) Interrupt from CPU temp sensor



A calculator program with java





Step 1:-

Save the file calculator.java


………………………………………………………………………………………

import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;

public class calculator extends Applet
implements ActionListener
{
        TextField t1,t2,t3;
        Label l1,l2,l3;
        Button b1,b2,b3;

        public void init()
        {
                l1=new Label("1st input");
                add(l1);
                t1=new TextField(20);
                add(t1);

                l2=new Label("2nd input");
                add(l2);
                t2=new TextField(20);
                add(t2);

                l3=new Label("result");
                add(l3);
                t3=new TextField(20);
                add(t3);

                b1=new Button("Add");
                add(b1);
                b1.addActionListener(this);

                b2=new Button("Subtract");
                add(b2);
                b2.addActionListener(this);

                b3=new Button("Multiply");
                add(b3);
                b3.addActionListener(this);
               


        }

        public void actionPerformed(ActionEvent e)
        {       int a=Integer.parseInt(t1.getText());
                int b=Integer.parseInt(t2.getText());
                int c;
                if(e.getSource()==b1)
                {
                      c=a+b;
                      t3.setText(String.valueOf(c));
                }
                if(e.getSource()==b2)
                {
                      c=a-b;
                      t3.setText(String.valueOf(c));
                }
                if(e.getSource()==b3)
                {
                      c=a*b;
                      t3.setText(String.valueOf(c));
                }

               

        }

}

For Compilation type :- javac calculator.java
…………………………………………………………………………

Step 2: Html file
Save the file calculator.html

<applet code="calculator.class" width=200 height=200>
</applet>

……………………………………………………………………….


Step 3: Output of the program

To run the program type:- appletviewer calculator.java

                                            

Tuesday, February 25, 2014

June 2006 ugc net computer science paper2 solutions


 1.      Which  of  the  following  strings  is  in  the  language  defined  by  grammar  
S OA, A 1A/0A/1  
(A)  01100                   (B)   00101                   (C)  10011                   (D)  11111
 Hints:

2.             For a complete graph with N vertices, the total number of spanning trees is given by :  (A)  2N-1                  (B)   NN-1                   (C)  NN-2                     (D)  2N+1 

 3.             The preposition (p q) (~ q p) is equivalent to :  
 (A)    q p        (B)   p q (C)    (q p) (p q)        (D)  (p q) (q p) 

 4.             The logic of pumping lemma is a good example of :  
(A) pigeon hole principle (B) recursion
(C) divide and conquer technique (D) iteration
   5.             Let A={ x |-1 < x < 1 }=B. The function f (x)= from A to B is :
(A) injective (B)   surjective
(C) both injective and surjective (D)  neither injective nor surjective

 6.             The number of 1’s present in the binary representation of is :  (A)  8                            (B)   9                            (C)  10                          (D)  11 
Hints:

 7.             Which of the following expression removes static hazard from a two level AND - OR gate implementation of x y + z x’ 
(A) x y + zx’ (B) x y + zx’+ wyz
(C) x y + z x’+ yz (D) x y+ zx’+ wz
  
8.             Which of the following logic has the maximum fan out ?   
(A)  RTL                       (B)   ECL                      (C)  NMOS                   (D)  CMOS 

 9.             In a weighted code with weight 6, 4, 2, 23 the decimal 5 is represented by :  
(A)  0101 (B)   0111 (C)  1011 (D)  1000

10.        Upto how many variables, can the Karnaugh map be used ?  
 (A)  3                            (B)   4                           (C)  5                            (D)  6 

 11.        What is the output of the following program segment ?  
 main ( )  
{  
int   count;
 int digit=0; 
count=1;
while(digit<=9)
 {printf (“%d/n”, ++count); 
  ++digit;
}  
}  
(A)  10                          (B)   9                            (C)  12                          (D)  11

12.        A static variable is one :  
 (A)        Which cannot be initialized  

 (B)         Which is initialized once at the commencement of execution and cannot be changed at runtime   
(C)        Which retains its value throughout the life of the program  
 (D)         Which is the same as an automatic variable but is placed at the head of a program    

13.        If the following loop is implemented   
Main() 
{  
int num=0; 
 do { - - num; 
 printf("%d",num); 
num++;} while (num >=0);
}
   
  (A)        the loop will run infinitely many times   
  (B)        the program will not enter the loop
  (C)        there will be compilation error reported
  (D)        a run time error will be reported  

 14.        # define max (x, y) x=(x > y) ? x : y is a macro definition, which can find the maximum of two numbers x and y if :

  (A)        x and y are both integers only        
 (B)        x and y are both declared as float only  
 (C)        x and y are both declared as double only 
  (D)        x and y are both integers, float or double  
  
15.        The function sprintf ( ) works like printf ( ), but operates on :  
(A)  Data in a file    (B)   stdrr           (C)  stdin        (D)  string

16.        A relation R5{A, B, C, D, E, F} is given with following set of functional dependencies :  F = {A B, AD C, B F, A E}  
Which of the following is candidate key ? 
 (A)  A                           (B)   AC                        (C)  AD               (D)  None of these 

 17.        Immediate updates as a recovery protocol is preferable, when : 
  (A)        Database reads more than writes  
 (B)        Writes are more than reads  
 (C)        It does not matter as it is good in both the situations  
 (D)        There are only writes   

18.        Which of the following statement is wrong ?
  (A)        2 - phase locking protocol suffers from dead locks
  (B)        Time - Stamp protocol suffers from more abort  
 (C)        Time stamp protocol suffers from cascading rollbacks where as 2 - phase locking protocol do not 
 (D)        None of these  

 19.        Which data management language component enabled the DBA to define the schema components ?  
(A) DML (B) Subschema DLL
(C) Schema DLL (D) All of these

 20.        A subclass having more than one super class is called __________ .  
(A) Category (B) Classification
(C) Combination (D) Partial participation

 21.  In the balanced binary tree given below, how many nodes will become unbalanced when a node is inserted as a child of the node “g”. 



(A)  1                            (B)   3                            (C)  7                            (D)  8

 22.        Preorder is also known as :  
(A) Depth first order (B) Breadth first order
(C) Topological order (D) Linear order

23.        Which of the following statement is false ? 
  (A)        Every tree is a bipartite graph   
(B)        A tree contains a cycle 
(C)        A tree with n nodes contains (n-1) edges  
 (D)        A tree is connected graph   

24.        If the post fix form of a string is ABC+-D*, The actual string is :  
(A)  (A-(B+C))*D (B)   ((A-B)+C)*D
(C)  ((A+B)-C)*D (D)  (A+(B-C)*D)

 25.        Application of data structure queue is :  
(A) Levelwise printing of tree (B)   Implementation of priority queues
(C) Function call implementation (D)  Depth first search in a graph

 26.        What is the transmission signal coding method for a T1 carrier called ?  
 (A)  Binary          (B)   NRZ                      (C)  Bipolar                 (D)  Manchester 

 27.        How much bandwidth is required to send 132 voice - grade channels by FDM on an international satellite system ?   
(A)  500 MHz              (B)   10 MHz                (C)  1320 MHz             (D)  50 MHz 

 28.        What is the difference between the Ethernet frame preamble field and the IEEE 802.3 preamble and start of frame Delimiter fields ?   
(A)  1 byte                   (B)   1 bit                      (C)  4 bits                     (D)  16 bits 

 29.        What is the function of a translating bridge ?  
 (A)        Connect similar remote LANs  
 (B)        Connect similar local LANs  
 (C)        Connect different types of LANs 
 (D)        Translate the network addresses into a layer 2 address  

 30.        The program used to determine the round - trip delay between a workstation and a destination address is :   
(A)  Tracert    B)   Traceroute         (C)  Ping                      (D)  Pop 

 31.        Which statement is wrong ?  
 (A)        If linked origin translated origin, relocation must be performed by the linker
  (B)        If load linked origin, the loader must perform relocation  
 (C)        A linker always perform relocation, whereas some loaders do not 
 (D)        None of thses  

32.        Tasks done in parsing are :  
   (A)        Check the validity of a source string 
   (B)        Determine the syntactic structure of a source string
   (C)        Both (A) and (B)   
  (D)        None of these   

33.        YACC builds up __________ parsing table.  
 (A)  LALR                   (B)   LR                         (C)  SLR                       (D)  LLR 

 34.        The action of passing the source program into the proper syntactic class is known as :  
(A) Syntax analysis (B) Lexical analysis
(C) Interpretation analysis (D) Uniform symbol generation

 35.        The dynamic binding occurs during the :  
(A) Compile time (B) Run time
(C) Linking time (D) Pre - processing time

 36.        The first operating system of Microprocessor is __________ .   
(A)  ATLAS                 (B)   CP/M                    (C)  SAGE                   (D)  T.H.E.  

37.        In processor management, round robin method essentially uses the preemptive version of __________ .   
(A)  FILO                      (B)   FIFO        (C)  SJF          (D)  Longest time first 

38.        A page fault __________ .  
 (A)        is an error in specific page  
 (B)        is an access to the page not currently in main memory  
 (C)        occurs when a page program accesses a page of memory  
 (D)        is reference to the page which belongs to another program  

 39.        __________ synchronize critical resources to prevent deadlock.  
 (A)  P - operator         (B)   V - operator         (C)  Semaphores      (D)  Hard disk

40.        The memory allocation scheme subjected to “external” fragmentation is :  
(A) Segmentation (B) Swapping
(C) Demand paging (D) Multiple contiguous fixed partitions

 41.        In software project planning, work Breakdown structure must be __________ .  
(A) A graph (B)   A tree
(C) A Eular’s graph (D)  None of the above
          

42.        In Software Metrics, McCABE’S cyclomatic number is given by following formula :  
(A)  c=e-n+2p (B) C=e-n-2p
(C)  c=e+n+2p (D) C=e-n* 2p

43.        In a good software design, __________ coupling is desirable between modules.  (A)  Highest                 (B)   Lowest                (C)  Internal                  (D)  External  
 
44.        System study yields the following :  
(A) Requirement specifications (B) Prevailing process description
(C) Data source identification (D) All the above
   
 45.        The COCOMO model is used for __________ .  
(A) software design (B) software cost estimation
(C) software cost approximation (D) software analysis
   
 46.        MMS (Multimedia Messaging Service) uses __________ types of messages to perform messaging transactions.   
(A)  4                            (B)   6                           (C)  8                            (D)  10 

  47.        Bluetooth technology uses the transmission media.  
(A) Radio links (B) Microwave links
(C) VSAT communication (D) Optical fiber links

  48.        Downflow is the process associated with __________ and back up of data in a warehouse.   
(A)  packaging            (B)   archiving            (C)  extraction              (D)  loading  

 49.        Predictive modeling in data mining uses __________ technique.  
(A) Statistical (B) Association Discovery
(C) Value prediction (D) None of these

  50.        The use of a smart card represents a form of :  
(A) password encryption (B) user - ID encryption
(C) authorization (D) authentication