Friday, 8 June 2018

Computer network security, Question 68, GATE IT 2008

The total number of keys required for a set of n individuals to be able to communicate with each other using secret key and public key crypto-systems, respectively are:

(A) n(n-1) and 2n
(B) 2n and ((n(n - 1))/2)
(C) ((n(n - 1))/2) and 2n
(D) ((n(n - 1))/2) and n

Filters and commands in Unix temp temp

Commonly used filter commands 

    awk
    cat
    comm
    cut
    expand
    compress
    fold
    grep
    head
    less
    more
    nl
    perl
    paste
    pr
    sed
    sh
    sort
    split
    strings
    tail
    tac
    tee
    tr
    uniq
    wc
    zcat

 

awk command:

Pattern scanning and text processing language. Finds patterns and Replaces patterns or text, validate, index and database sort
~$ man awk



Built In Variables:

Awk’s built-in variables include the field variables—$1, $2, $3, and so on ($0 is the entire line) — that break a line of text into individual words or pieces called fields.
NR: NR command keeps a current count of the number of input records. Remember that records are usually lines. Awk command performs the pattern/action statements once for each record in a file.
NF: NF command keeps a count of the number of fields within the current input record.
FS: FS command contains the field separator character which is used to divide fields on the input line. The default is “white space”, meaning space and tab characters. FS can be reassigned to another character (typically in BEGIN) to change the field separator.
RS: RS command stores the current record separator character. Since, by default, an input line is the input record, the default record separator character is a newline.
OFS: OFS command stores the output field separator, which separates the fields when Awk prints them. The default is a blank space. Whenever print has several parameters separated with commas, it will print the value of OFS in between each parameter.
ORS: ORS command stores the output record separator, which separates the output lines when Awk prints them. The default is a newline character. print automatically outputs the contents of ORS at the end of whatever it is given to print.

Here, we listed the root directory files detail and saved the same to the tesfile5
Here, awk command retries the field values of the column 1 and 6.



Below will prints only line which are non-empty. First and last line of testfile5 are empty. So, empty line only printed while displaying the  file using cat command.





Below image show some of the functions implemented using the awk command

 

cat command:

The cat ("concatenate") is filter command of operating systems like Linux/Unix. cat command used to create one or more files, view content of file, concatenate different files and can redirect the output to files or terminal.

In this post article, we are going to find out the very basic use  of the cat command and options related to the command with examples in Linux.

Syntax of the command

cat [OPTION] [FILE]...

(1) cat command to Create file and display File content in terminal

~$ cat > testfile1      //command to create file testfile1
~$ cat testfile            //command to display the content of the file to terminal

System creates file opens the blank file. then, user can write and press CNTRL+D to exit the file and the written content will be saved to file test3.





(2) Content Display for Multiple Files in terminal

~$ cat testfile1 testfile2
 Shows content of the testfile1 and at the end content testfile2


(3) Appending Standard Output with Redirection Operator 

~$ cat testfile3 >> testfile2
 Append the content of testfile3 to the end of testfile2. As we can see above the in the content display of filetest2.


(4) Redirection Operator Uses Standard Output to overwrite the file content. ~$ cat testfile3 > testfile4
 content of testfile4 will be overwritten by the testfile3 file content.

 (4) Redirection Operator Uses Standard Output to write Multiple Files content to a file

~$ cat testfile1 testfile2 > testfile4 

It's multiple file contents redirecting to a Single File
Conent of testfile1 and testfile3 overwritten to the testfile4

(5) Redirection Operator Uses Standard input to display content in terminal.
~$ cat < testfile4


Here the content of the file testfile4 will be used as input to the terminal. So, terminal will display the testfile4 content.

Comm Command:
comm compare two sorted files line by line and write to standard output; the lines that are common and the lines that are unique.


  -1 : hide first column (first column shows distinct lines in testfile6 )
  -2 : hide second column (second column shows distinct lines in testfile7 )
  -3 : hide third column (second column shows lines common in both files).





Monday, 4 June 2018

Filters and commands in Unix

The cat ("concatenate") is filter command of operating systems like Linux/Unix. cat command used to create one or more files, view content of file, concatenate different files and can redirect the output to files or terminal. In article of this post, we are going to find out the very basic use cat command and options related to the command with examples in Linux.
Syntax of the command
cat [OPTION] [FILE]...
(1) Display File content in terminal
# cat /etc/test1
Shows content of the test1 file
(2) Content Display for Multiple Files in terminal
# cat test1 test2
Shows content of the test1 and test2 file
(3) cat command to Create file
# cat > test3
create file and open the blank file then, user can write and press CNTRL+D to exit the file and the written content will be saved to file test3.
(4) Redirection Operator Uses Standard Output to overwrite the file content.
# cat test3 > test4
test4 file content will be overwritten by the test file content.
(5) Redirection Operator Uses Standard input to display content in terminal.
# cat < test5
This is content of test5 file.
Here the content of the file test5 will be used as input to the terminal. So, terminal will display the file content.
(6) Multiple Files content Redirecting to a Single File
# cat test test1 test2 > test3
content $ cat sample.txt 1,2,3,4,5,6,7,8,9
$ cat sample.txt | cut -d \; -f 2 > output.txt
$ cat output.txt
2

Saturday, 2 June 2018

semaphore

A semaphore is variable with integer value that is updated through 2 standard operations which are atomic :

(1) P: wait () operation
and
(2) V: signal () operation.
Lets say Semaphore variable is Sm

wait(Sm) {
while Sm<= 0 ;    //No-operation, keep in while loop if condition true, next line will not execute
S- - ;       //executed if while loop is not satisfied
}

signal(Sm)
 S+ +;
 }

As both functions are atomic whole wait() and signal() function must be executed without interruption. This means the while condition check and the S- - operation will be executed without break or interruption. Variable Sm can only be accessed by only one function either wait() or signal() at a time.


Tuesday, 15 May 2018

UGC NET net solved papers computer science & application paper 2 november 2017 Q41-50

41. Software does not wear-out in the traditional sense of the term, but software does tend to deteriorate as it evolves, because :
(1) Software suffers from exposure to hostile environments.
(2) Defects are more likely to arise after software has been used often.
(3) Multiple change requests introduce errors in component interactions.
(4) Software spare parts become harder to order.
Correct Answer: (3) Multiple change requests introduce errors in component interactions.
42. Software re-engineering is concerned with :
(1) Re-constructing the original source code from the existing machine (low - level) code program and modifying it to make it more user - friendly.
(2) Scrapping the source code of a software and re-writing it entirely from scratch.
(3) Re-organising and modifying existing software systems to make them more maintainable.
(4) Translating source code of an existing software to a new machine (low - level) language.
Correct Answer: (3) Re-organising and modifying existing software systems to make them more maintainable.
43. Which of the following is not a key issue stressed by an agile philosophy of software engineering ?
(1) The importance of self-organizing teams as well as communication and collaboration between team members and customers.
(2) Recognition that change represents opportunity.
(3) Emphasis on rapid delivery of software that satisfies the customer.
(4) Having a separate testing phase after a build phase.
Correct Answer:  (4) Having a separate testing phase after a build phase.
44. What is the normal order of activities in which traditional software testing is organized ?
(a) Integration Testing
(b) System Testing
(c) Unit Testing
(d) Validation Testing
Code :
(1) (c), (a), (b), (d)
(2) (c), (a), (d), (b)
(3) (d), (c), (b), (a)
(4) (b), (d), (a), (c)
Correct Answer: (2) (c), (a), (d), (b)
45. Which of the following testing techniques ensures that the software product runs correctly after the changes during maintenance ?
(1) Path Testing
(2) Integration Testing
(3) Unit Testing
(4) Regression Testing
Correct Answer: (4) Regression Testing
46. Which of the following Super Computers is the fastest Super Computer ?
(1) Sun-way TaihuLight
(2) Titan
(3) Piz Daint
(4) Sequoia
Correct Answer:  (1) Sun-way TaihuLight
47. Which of the following statements about ERP system is true ?
(1) Most ERP software implementations fully achieve seamless integration.
(2) ERP software packages are themselves combinations of seperate applications for manufacturing, materials, resource planning, general ledger, human resources, procurement and order entry.
(3) Integration of ERP systems can be achieved in only one way.
(4) An ERP package implemented uniformly throughout an enterprise is likely to contain very flexible connections to allow charges and software variations.
Correct Answer: (2)
48. Which of the following is not a Clustering method ?
(1) K - Mean method
(2) Self Organizing feature map method
(3) K - nearest neighbor method
(4) Agglomerative method
Correct Answer:(3) K - nearest neighbor method
49. Which of the given wireless technologies used in IoT, consumes the least amount of power ?
(1) Zigbee
(2) Bluetooth
(3) Wi-Fi
(4) GSM/CDMA
Correct Answer: (2) Bluetooth
50. Which speed up could be achieved according to Amdahl’s Law for infinite number of processes if 5% of a program is sequential and the remaining part is ideally parallel ?
(1) Infinite
(2) 5
(3) 20
(4) 50
Correct Answer: (3) 20

UGC NET net solved papers computer science & application paper 2 november 2017 Q31-40

31. Consider the following program fragment in assembly language :
          mov ax, 0h
          mov cx, 0A h
doloop :
          dec ax
          loop doloop
What is the value of ax and cx registers after the completion of the doloop ?
(1) ax=FFF5 h and cx=0 h
(2) ax=FFF6 h and cx=0 h
(3) ax=FFF7 h and cx=0A h
(4) ax=FFF5 h and cx=0A h
Correct Answer: (2) ax=FFF6 h and cx=0 h
32. Consider the following assembly program fragment :
stc
mov al, 11010110b
mov cl, 2
rcl al, 3
rol al, 4
shr al, cl
mul cl
The contents of the destination register ax (in hexadecimal) and the status of Carry Flag (CF) after the execution of above instructions, are :
(1) ax=003CH; CF=0
(2) ax=001EH; CF=0
(3) ax=007BH; CF=1
(4) ax=00B7H; CF=1

Correct Answer: (1) ax=003CH; CF=0
33. Which of the following regular expressions, each describing a language of binary numbers (MSB to LSB) that represents non-negative decimal values, does not include even values ?
(1) 0*1+0*1* (2) 0*1*0+1* (3) 0*1*0*1+ (4) 0+1*0*1* Where {+, *} are quantification characters.
34. Which of the following statements is/are TRUE ? (a) The grammar S → SS | a is ambiguous. (Where S is the start symbol) (b) The grammar S → 0S1 | 01S | ε is ambiguous. (The special symbol ε represents the empty string) (Where S is the start symbol) (c) The grammar (Where S is the start symbol) S → T/U T → x S y | xy | e U → yT generates a language consisting of the string yxxyy.
(1) Only (a) and (b) are TRUE.
(2) Only (a) and (c) are TRUE.
(3) Only (b) and (c) are TRUE.
(4) All of (a), (b) and (c) are TRUE.
Correct Answer: (4) All of (a), (b) and (c) are TRUE.
35. Match the description of several parts of a classic optimizing compiler in List - I, with the names of those parts in List - II :   List - I List - II
(a) A part of a compiler (i) Optimizer syntax. that is responsible for recognizing (b) A part of a compiler that takes as input a stream of (ii) Semantic Analysis characters and produces as output a stream of words along with their associated syntactic categories. (c) A part of a compiler that understand the meanings of (iii) Parser variable names and other symbols and checks that they are used in ways consistent with their definitions. (d) An IR-to-IR transformer that tries to improve the IR (iv) Scanner program in some way (Intermediate Representation).
Code : (a) (b) (c) (d)
(1) (iii) (iv) (ii) (i)
(2) (iv) (iii) (ii) (i)
(3) (ii) (iv) (i) (iii)
(4) (ii) (iv) (iii) (i)
Correct Answer:  (1) (iii)  (iv)  (ii)   (i)
36. In Distributed system, the capacity of a system to adapt the increased service load is called ____.
(1) Tolerance
(2) Scalability
(3) Capability
(4) Loading
Correct Answer: (2) Scalability 
37. In __________ disk scheduling algorithm, the disk head moves from one end to other end of the disk, serving the requests along the way. When the head reaches the other end, it immediately returns to the beginning of the disk without serving any requests on the return trip.
(1) LOOK
(2) SCAN
(3) C - LOOK
(4) C - SCAN
Correct Answer:  (4) C - SCAN
38. Suppose there are six files F1, F2, F3, F4, F5, F6 with corresponding sizes 150 KB, 225 KB, 75 KB, 60 KB, 275 KB and 65 KB respectively. The files are to be stored on a sequential device in such a way that optimizes access time. In what order should the files be stored ?
(1) F5, F2, F1, F3, F6, F4
(2) F4, F6, F3, F1, F2, F5
(3) F1, F2, F3, F4, F5, F6
(4) F6, F5, F4, F3, F2, F1
Correct Answer:  (2) F4, F6, F3, F1, F2, F5
If we put the small file first then, then the average time to access all the file will be minimum. Lets put the largest file in  first place and smaller after that. then, in this case to access smaller file multiple time, systems need to cross the larger file sequentially each time which is very complex.
39. Which module gives control of the CPU to the process selected by the short-term scheduler?
(1) Dispatcher
(2) Interrupt
(3) Schedular
(4) Threading
Correct Answer: (1) Dispatcher
40. Two atomic operations permissible on Semaphores are __________ and __________.
(1) wait, stop
(2) wait, hold
(3) hold, signal
(4) wait, signal
Correct Answer: (4) wait, signal

Monday, 14 May 2018

UGC NET november 2017 paper 2 computer science & application solved Q21-Q30

21. Consider an array representation of an n element binary heap where the elements are stored
from index 1 to index n of the array. For the element stored at index i of the array (i<=n),
the index of the parent is :
(1) floor ((i+1)/2)
(2) ceiling ((i+1)/2)
(3) floor (i/2)
(4) ceiling (i/2)

Correct Answer is: (3) floor (i/2)
As shown below the root of the 13 and 10 are floor of the 4 and 5 respectively.

22. The following numbers are inserted into an empty binary search tree in the given order :
10, 1, 3, 5, 15, 12, 16. What is the height of the binary search tree ?
(1) 3
(2) 4
(3) 5
(4) 6

Correct Answer is: (1) 3
Here, height is longest path from root to the leaf node. As shown green number in below image indicates the count of the tree edges which has max height.


23. Let G be an undirected connected graph with distinct edge weight. Let Emax be the edge
with maximum weight and Emin the edge with minimum weight. Which of the following
statements is false ?
(1) Every minimum spanning tree of G must contain Emin.
(2) If Emax is in minimum spanning tree, then its removal must disconnect G.
(3) No minimum spanning tree contains Emax.
(4) G has a unique minimum spanning tree.

Correct Answer is: (3) No minimum spanning tree contains Emax.

24. A list of n strings, each of length n, is sorted into lexicographic order using merge - sort
algorithm. The worst case running time of this computation is :
(1) O(n log n)
(2) O(n2 log n)
(3) O(n2 + log n)
(4) O(n3)

Correct Answer is: (2) O(n2 log n)

25. Postorder traversal of a given binary search tree T produces following sequence of keys :
3, 5, 7, 9, 4, 17, 16, 20, 18, 15, 14
Which one of the following sequences of keys can be the result of an in-order traversal of
the tree T ?
(1) 3, 4, 5, 7, 9, 14, 20, 18, 17, 16, 15
(2) 20, 18, 17, 16, 15, 14, 3, 4, 5, 7, 9
(3) 20, 18, 17, 16, 15, 14, 9, 7, 5, 4, 3
(4) 3, 4, 5, 7, 9, 14, 15, 16, 17, 18, 20

Correct answer is: (4) 3, 4, 5, 7, 9, 14, 15, 16, 17, 18, 20
3, 5, 7, 9, 4, 17, 16, 20, 18, 15, 14
Here, the root of the binary tree is 14 (last element), as it's post-order traversal.
Right side of the tree contains bigger elements than 14
Left side of the tree contains bigger elements than 14
So, the first number >14 on left of root (14) (check from right to left).
=>root of right sub-tree is 15
So, the first number <14 on left of root (14) (check from right to left).
=>root of left sub-tree is 4
now we have two sequences: right tree and left tree
right tree:  17, 16, 20, 18, 15,
left tree: 3, 5, 7, 9, 4
Here, also similarly  find left and right sub-tree of both tree root-right(15) and the root-left(4).
So, final binary tree is

26. Which of the following devices takes data sent from one network device and forwards it to
the destination node based on MAC address ?
(1) Hub
(2) Modem
(3) Switch
(4) Gateway

Correct answer is: (3) Switch

27. __________ do not take their decisions on measurements or estimates of the current traffic
and topology.
(1) Static algorithms
(2) Adaptive algorithms
(3) Non - adaptive algorithms
(4) Recursive algorithms

Correct answer is: (3) Non - adaptive algorithms

28. The number of bits used for addressing in Gigabit Ethernet is __________.
(1) 32 bits
(2) 48 bits
(3) 64 bits
(4) 128 bits

Correct answer is: (2) 48 bits

29. Which of the following layer of OSI Reference model is also called end-to-end layer ?
(1) Network layer
(2) Datalink layer
(3) Session layer
(4) Transport layer

Correct answer is: (4) Transport layer

30. The IP address __________ is used by hosts when they are being booted.
(1) 0.0.0.0
(2) 1.0.0.0
(3) 1.1.1.1
(4) 255.255.255.255

Correct answer is:  (1) 0.0.0.0

UGC NET november 2017 paper 2 computer science & application solved Q11-Q20

11. ‘ptrdata’ is a pointer to a data type. The expression *ptrdata++ is evaluated as (in C++) :
(1) *(ptrdata++)
(2) (*ptrdata)++
(3) *(ptrdata)++
(4) Depends on compiler

Answer is: (1) *(ptrdata++)
as the ++ has higher precedence than * operator.

12. The associativity of which of the following operators is Left to Right, in C++ ?
(1) Unary Operator
(2) Logical not
(3) Array element access
(4) addressof

Answer is: (3) Array element access
Unary Operator -- right to left associativity
Logical not -- right to left associativity
Array element access -- Array subscript - [ ] - Left to Right associativity addressof -- right to left associativity

13. A member function can always access the data in __________ , (in C++).
(1) the class of which it is member
(2) the object of which it is a member
(3) the public part of its class
(4) the private part of its class

Correct Answer is: (1) the class of which it is member

14. Which of the following is not correct for virtual function in C++ ?
(1) Must be declared in public section of class.
(2) Virtual function can be static.
(3) Virtual function should be accessed using pointers.
(4) Virtual function is defined in base class.

Answer is: (2) Virtual function can be static. A virtual function must be declared within public section of base class and is overridden by the derived-class. When we refer to a derived class object using a reference of the base class, you can call a virtual function for that class object.then, version of the function defines in derived class will execute.

15. Which of the following is not correct (in C++) ?
(1) Class templates and function templates are instantiated in the same way.
(2) Class templates differ from function templates in the way they are initiated.
(3) Class template is initiated by defining an object using the template argument.
(4) Class templates are generally used for storage classes.

OPTION 2, 3, 4 ARE CORRECT (as per UGC answer key)

16. Which of the following is/are true with reference to ‘view’ in DBMS ?
(a) A ‘view’ is a special stored procedure executed when certain event occurs.
(b) A ‘view’ is a virtual table, which occurs after executing a pre-compiled query.(1) Only (a) is true
(2) Only (b) is true
(3) Both (a) and (b) are true
(4) Neither (a) nor (b) are true

(2) Only (b) is true View is the table or the result of query after query execution.

17. In SQL, __________ is an Aggregate function.
(1) SELECT (2) CREATE (3) AVG (4) MODIFY

Correct Answer is: AVG function used to find the average of the particular attribute values. e.g., to find avg salary of employee of a company.

18. Match the following with respect to RDBMS :
(a) Entity integrity (i) enforces some specific business rule that do not fall into entity or domain.
(b) Domain integrity(ii) Rows can’t be deleted which are used by other records
(c) Referential integrity(iii) enforces valid entries for a column
(d) User defined integrity (iv) No duplicate rows in a table
Code :
(1) (iii) (iv) (i) (ii)
(2) (iv) (iii) (ii) (i)
(3) (iv) (ii) (iii) (i)
(4) (ii) (iii) (iv) (i)

Correct Answer is: (2) (iv) (iii) (ii) (i)
Entity integrity: No duplicate rows in a table. Every entity(row) in the table must be unique based on the primary key of the table. Table would not allow the same primary key twice.
Domain integrity:Defines the what type of values to be inserted to the particular (attribute)column of DB for an entity. If we define the salary attribute in employee class then, domain of such values are numeric (say double). This integrity enforces valid entries for a column. (not allow alpha-numeric values for the salary).
Referential integrity: is based on foreign keys (so, it referred by other referencing table, deletion of such entries causes the undefined value for referencing table). Rows can’t be deleted which are used by other records.
User defined integrity: enforces some specific business rule that do not fall into entity or domain.
For e.g., you defining the constraint over the values of the attribute. let's assume that you are inserting the values to the table such that max and minimum salary for the part-time employee must be in in range 10,000 and 100. (So, you are restricting any insert to DB outside this salary range).

19. In RDBMS, different classes of relations are created using __________ technique to prevent modification anomalies.
(1) Functional Dependencies
(2) Data integrity
(3) Referential integrity
(4) Normal Forms

Correct Answer is: (4) Normal Forms
Normal forms are used to reduce the redundancy and increase the data consistency.

20. __________ SQL command changes one or more fields in a record.
(1) LOOK-UP
(2) INSERT
(3) MODIFY
(4) CHANGE

Correct Answer is: (3) MODIFY

Saturday, 12 May 2018

NATIONAL ELIGIBILITY TEST

This year, the CBSE is conducting the National Eligibility Test (NET) on July 8, 2018 for selecting the eligibility of Indian candidates for the Eligibility for Assistant Professor only or both Junior Research Fellowship and Eligibility for Assistant Professor Both in Indian Colleges and Universities.

Monday, 7 May 2018

isro cs question paper solution 2018 Q25 Set-A

CFG (Context Free Grammer) is not closed under

(a) Union
(b) Complementation
(c) Kleene star
(d) Product

Answer is:  (b) Complementation

Intersection and complementation of two CFG need not be context free.

Closed under union, concatenation, and Kleene star.
Closed under substitution, homomorphism, and reversal

UGC NET Computer Science December 2019 | Question 16

Question 16 In a certain coding language. 'AEIOU' is written as 'TNHDZ'. Using the same coding language. 'BFJPV' wil...

Popular Posts