javascript

CAO

Effactive access time= p* page fault time+(1-p)*memory access time

where p is page fault rate

Computer Network:

Ping:    Ping is a computer network administration utility used to test the reachability of a host on an Internet Protocol (IP) network and to measure the round-trip time for messages sent from the originating host to a destination computer. The name comes from active sonar terminology which sends a pulse of sound and listens for the echo to detect objects underwater.

    Ping operates by sending Internet Control Message Protocol (ICMP) echo request packets to the target host and waiting for an ICMP response. In the process it measures the time from transmission to reception (round-trip time) and records any packet loss. The results of the test are printed in the form of a statistical summary of the response packets received, including the minimum, maximum, and the mean round-trip times, and sometimes the standard deviation of the mean.

    Depending on actual implementation, the ping utility may be executed with various command-line switches to enable special operational modes. For example, options include specifying the packet size of the probe, automatic repeated operation for sending a specified count of probes, and time stamping. Many operating systems provide a companion utility, ping6, for probing Internet Protocol version 6 (IPv6) hosts, but some systems may include this capability within the ping utility.

    Ping may be abused as a simple form of denial-of-service attack in the form of a ping flood, in which the attacker overwhelms the victim with ICMP echo request packets.

Database: Clustered and Nonclustered Indexes

    An index is an on-disk structure associated with a table or view that speeds retrieval of rows from the table or view. An index contains keys built from one or more columns in the table or view. These keys are stored in a structure (B-tree) that enables SQL Server to find the row or rows associated with the key values quickly and efficiently.

A table or view can contain the following types of indexes:

    Clustered:    Clustered indexes sort and store the data rows in the table or view based on their key values. These are the columns included in the index definition. There can be only one clustered index per table, because the data rows themselves can be sorted in only one order.

        The only time the data rows in a table are stored in sorted order is when the table contains a clustered index. When a table has a clustered index, the table is called a clustered table. If a table has no clustered index, its data rows are stored in an unordered structure called a heap.

    Nonclustered:    Nonclustered indexes have a structure separate from the data rows. A nonclustered index contains the nonclustered index key values and each key value entry has a pointer to the data row that contains the key value.

        The pointer from an index row in a nonclustered index to a data row is called a row locator. The structure of the row locator depends on whether the data pages are stored in a heap or a clustered table. For a heap, a row locator is a pointer to the row. For a clustered table, the row locator is the clustered index key.

        You can add nonkey columns to the leaf level of the nonclustered index to by-pass existing index key limits, 900 bytes and 16 key columns, and execute fully covered, indexed, queries. For more information, see Create Indexes with Included Columns.

Both clustered and nonclustered indexes can be unique. This means no two rows can have the same value for the index key. Otherwise, the index is not unique and multiple rows can share the same key value. For more information, see Create Unique Indexes.

    Indexes are automatically maintained for a table or view whenever the table data is modified.

Probability


Algebra of events
i)    Not A    <=>    A’
ii)    A or B (at least one of A or B)     <=>    A U B
iii)    A and B    <=>    A ∩ B
iv)    A but not B    <=>    A ∩ B’
v)    Neither A nor B    <=>    A’ ∩ B’
vi)    At least one of A, B, or C    <=>    A U B U C
vii)    Exactly one of A and B    <=>    (A ∩ B’) U (A’ ∩ B)
viii)    All three of A, B and C    <=>    A ∩ B ∩ C
ix)    Exactly two of A, B and C    <=>    (A ∩ B ∩ C’) U (A ∩ B’ ∩ C) U (A’ ∩ B ∩ C)

Set

If A, B, C are finite sets, and U be the finite universal set, then
i)    n(A U B)=n(A)+n(B) - n(A ∩ B)
ii)    n(A U B)=n(A)+n(B) <=> A,B are disjoint non-void sets.
iii)    n(A-B)= n(A)- n(A ∩ B)
iv)    n(A ∆ B)= Number of elements which belongs to exactly of A or B
        = n(A)+n(B)- 2n(A ∩ B)
v)    n(A U B U C)=n(A)+n(B)+n(C)-n(A ∩ B)-n(B ∩ C)-n(C ∩ A)+ n(A ∩ B ∩ C)
vi)    Number of elements in exactly two of the sets A, B, C
    = n(A ∩ B) + n(B ∩ C) + n(C ∩ A)- 3n(A ∩ B ∩ C)
vii)    Number of elements in exactly one of the sets A, B, C
    = n(A)+n(B)+n(C)- 2n(A ∩ B) - 2n(B ∩ C) - 2n(C ∩ A) + 3n(A ∩ B ∩ C)
viii)    n(A′ U B′)= n((A ∩ B)′)=n(U)-n(A ∩ B)
ix)    n(A′ ∩ B′)= n((A U B)′)=n(U)-n(A U B)

Set

Equal sets: Two sets A and B are said to be equal if every element of A is a member of B, and every element of B is a member of A.

Set

Equivalent sets: Two finite sets A and B are equivalent if their cardinal numbers are same i.e., n(A)=n(B)

Set

The total number of subsets of a finite set containing n elements is 2n.

Identifiers

Identifiers: The names of variables, functions, arrays etc. are called identifiers. Identifiers are user defined names which consists a sequence of letters, digits and underscore. The first character must be a letter.

Keywords


Keywords: Keywords are basic building blocks of program. All keywords have fixed meanings and these meanings cannot be changed. All keywords must be written in lowercase.

Data type

Data type: A data type can be defined as abstract concept that defines an internal representation of data in the memory.

How threads differ from processes?



Differences between threads and processes
Threads differ from traditional multitasking operating system processes in that:

    ->    processes are typically independent, while threads exist as subsets of a process
    ->    processes carry considerably more state information than threads, whereas multiple threads within a process share process state as well as memory and other resources
    ->    processes have separate address spaces, whereas threads share their address space
    ->    processes interact only through system-provided inter-process communication mechanisms
    ->    context switching between threads in the same process is typically faster than context switching between processes.

Program of call by value and call by referecne

#include<iostream>
using namespace std;
//call by reference
void swap1(int *a, int *b)
{
    int temp;
    temp=*a;
    *a=*b;
    *b=temp;

    cout<<"\nInside swap1()";
    cout<<"\na="<<*a<<" b="<<*b;
}

//call by value
void swap(int a, int b)
{
    int temp;
    temp=a;
    a=b;
    b=temp;

    cout<<"\nInside swap()";
    cout<<"\na="<<a<<" b="<<b;
}

main()
{
    int a=10,b=20;

    //Call by value
    cout<<"\nBefore swap()";
    cout<<"\na="<<a<<" b="<<b;
    swap(a,b);
    cout<<"\nInside main()";
    cout<<"\na="<<a<<" b="<<b;

    cout<<"\nBefore swap1()";
    cout<<"\na="<<a<<" b="<<b;
    //Call by reference
    swap1(&a,&b);
    cout<<"\nInside main()";
    cout<<"\na="<<a<<" b="<<b;
   

}

Explain the function of if .... else in C programming.

if... else:
It is a conditional or branching statement which helps to jump from one part of a program to another part with the help of the decision condition given.