Thursday, 19 July 2012

echo, variable, string, operators


Echo
 The following is the combination of HTML and PHP that we used to write this program.
<html>
<h3>My first PHP Program</h3>
  <? echo "Hello world!"; ?>
</html>
If we remove the HTML we will have only the following PHP.
<? echo "Hello world!"; ?> 
The above example revolves around the PHP language constructecho. The echo language construct must be followed by a space. After the space you can give echo any sentence you choose, provided that the sentence is contained within quotes (" "). Like any PHP statement, it must also end with a semicolon (;).
The echo language construct also raises an important term in PHP, as well as general programming terminology: stringswords andsentences.
Strings
In the purest sense, string is series of characters. In the context of this example we will add the requirement that strings be contained within quotes (" "). Strings can be divided into two types,words and sentences.
  • word is a series of characters within quotes (" ") that does not contain any spaces or commas.
  • sentence is a series of characters within quotes (" ") thatdoes contain at least one space or comma.
Given the above three definitions, we can deduce that in the "Hello World!" example, what was referred to as a sentence, can also be formally refered to as a set of words, or a string.
The following are examples of three different words:
  1.  "1234567890"
  2.  "-=\_+|X~qwertyuioo"
  3.  "String"
and the following are examples of three different sentences:
  1.  "1234567890,-=\_+|X~qwertyuioo"
  2.  "pasdf ghjkl;;'zxcv     bnm,./[]{}"
  3.  "This collection of words is a string!"
All six of the above examples are strings. For more information onstrings see the PHP manual's entry on strings  .
Now that we have our terminology defined we can say that whatever you choose to display with echo must be a string.
PHP also has a a language construct called print which is very similar to echo. Within this tutorial we will use echo. More information onecho   and print   can be found online.
We can use echo to display information on our website. Most of the PHP programs we will examine in this class will use PHP to process data and come up with an answer. We will then use echo to display that answer. Thus, even though it serves a simple function, it is essential to using PHP.
Variables
Variables (as taught in Algebra) can take on unknown values and allow us (and our PHP programs) to generalize, which in turn can allow for flexibility. We use variables in spoken languages like English often. For example, a common word such as age can be considered a variable because age can take different values for different people or for the same person at different times. Similarly, country can be considered a variable because a person's country can be assigned a value. Programming languages like PHP also allow us to give a name to something which we can specify in the future.
Variables are denoted in PHP by preeding them with a dollar sign ($). So if I wanted to create a variable called a, I would type the following:
$a;
When programming you should give your variables meaningful names. For example, $age will make more sense to you then $a, if you want a variable to represent someone's age. Variables should be single words(as specified above) . For example, if we were to type:
$erins age
To represent a person named Erin's age we would have a syntax error, because the word "age" would have no meaning in PHP and $erins would be the variable that we created. You should avoid having a space or a comma in your variable. It is conventional in PHP to use an underscore to take the place of space in order to keep a string a word. So, we would represent the variable for Erin's age in PHP like this:
$erins_age
Another convention which comes from Java for representing spaces is to remove all spaces, but use a capital letter to denote what you would intend to be a separate word. For example:
$erinsAge
This method is referred to by some programmers as "studly caps". In this tutorial we will be using the underscore replacement of space instead.

Operators

Operators do things to variables. If I wanted to say "my age is 26", the word "is" could be seen as an operator. The string "my age" could be seen as a variable, and "26" could be seen as the value of the variable. In PHP this would look like this:
$my_age = 26;
Note the use of the assignment operator (=) which sets $my_age to the value of 26.
PHP has other operators and you should already be familiar with most of the following:
ExampleNameResult
$a + $bAdditionSum of $a and $b.
$a - $bSubtractionDifference of $a and $b.
$a * $bMultiplicationProduct of $a and $b.
$a / $bDivisionQuotient of $a and $b.
$a % $bModulusRemainder of $a divided by $b.

visit below website to know openings for freshers

Saturday, 14 July 2012

Workbook for Web Development and PHP Prgramming - I

Download workbook from below link for subject "Web Development and PHP Prgramming - I"
T.Y.B.Sc (Computer Science)

http://cs.unipune.ernet.in/obx/~hod_cs/Lab2_php.pdf

Tuesday, 19 June 2012

smilar question from NET D- 8707


The aging algorithm with a = 1/2 is being used to predict run times. The
       previous for runs, from oldest to most recent, are 40, 20, 40, and 15 
       msec. What is the prediction of the next time? (5 points)

  Ans: If take all four previous run times into consideration, the prediction
       is (((40 + 20) / 2 + 40) / 2 + 15) / 2 = ((30 + 40) / 2 + 15) /2
                                              = (35 + 15) / 2 = 25

       Or if take only two previous run times into consideration, the
       prediction is (40 + 15) /2 = 27.5

cache hit rate

The performance of a file system depends critically on the cache hit rate (fraction of the blocks found in the cache). If it takes 1 msec to satisfy a request from the cache, but 40 msec to satisfy a request if a disk read is needed, give a formula for the mean time required to satisfy a request if the hit rate is h. Plot this function for h:(0,1)

The mean time is calculated as the probability of a hit times the time required to proccess a hit plus the probability of a miss times the time required to proccess a miss or:

1 msec * h + (1 - h) * 40 msec

Monday, 11 June 2012

Important que to improve concept for UGC-NET


Collecting questions to improve my question bank 

answers taken from website getgyan.com

Question 1 :

The register or main memory location wahich contains the effective address of the operand is known as:
Option A: Pointer.
Option B: Indexed Register.
Option C: Special Location.
Option D: Scratch Pad.
Correct Answer: A

Question 2 :

Page stealing is:
Option A: A sign of an efficient system.
Option B: Taking page frames from other working sets.
Option C: Should be the tunning goal.
Option D: Taking larger disk spaces for pages paged out.
Correct Answer: B

Question 3 :

Which of the following refers to the associative memory ?
Option A: The adress of data is generated by the CPU.
Option B: The address of data is supplied by the users.
Option C: There is no need for an address i.e. the data is used as an address.
Option D: The data are accessed sequentially.
Correct Answer: C

Question 4 :

Virtual memory -

A) is a method of memory allocation by which the program is subdevided into equal portions, or pages and core is subdevided into equal portions or blocks.
B) consists of those adedresses that may be generated by a processor during execution of a computation. 
C) is a method of allocating processor time.
D) allows multiple programs to reside in seperate areas of core at the time.
Option A: A
Option B: B
Option C: C
Option D: D
Correct Answer: B

Question 5 :

The Memory Buffer Register (MBR) -

A) is a hardware memory device which denotes the location of the current instruction being executed.
B) is a group of electrical circuits (hardware) , that performs the intent of instruction fetched from memory.
C) contains the address of the memory location that is to be read from or stored into.
D) contains a copy of the designated memory location specified by the MAR after a "read" or the new contents of the memory prior to a "write".
Option A: A
Option B: B
Option C: C
Option D: D
Correct Answer: D

Question 6 :

The instruction register -

A) is hardware memory device which denotes the location of the current instruction being executed.
B) is a group of electrical circuits (hardware) , that performs the intent of instruction fetched from memory.
C) contains the address of the memory location that is to be read from or stored into.
D) contains a copy of the designated memory location specified by the MAR after a "read" or the new contents of the memory prior to a "write".
Option A: A
Option B: B
Option C: C
Option D: D
Correct Answer: B

Question 7 :

Thrashing -
Option A: is a natural consequence of virtual memory systems.
Option B: can always be avoided by swapping.
Option C: always occurs on large computers.
Option D: can be caused by poor paging algorithms.
Correct Answer: D

Question 8 :

Tharshing can be avoided if -
Option A: the pages , belonging to the working set of the programs, are in main memory.
Option B: the speed of CPU is increased.
Option C: the speed of I/O processor is increased.
Option D: All of the above.
Correct Answer: A

Question 9 :

The memory allocation scheme subject to "external" fragmentation is -
Option A: Segmentaion.
Option B: Swapping.
Option C: Pure Demand Paging.
Option D: Multiple contiguous fixed partitions.
Correct Answer: A

Question 10 :

If the number of bits in a virtual address of a program is 12 and the page size is 0.5K bytes, the number of pages in the virtual address space is -
Option A: 16
Option B: 32
Option C: 64
Option D: 128
Correct Answer: D

Question 11 :

Which of the following is not true about Memory Management ?
Option A: Virtual memory is used only in multi - user systems.
Option B: Segmetation suffers from external fragmentation.
Option C: Paging suffers from internal fragmentation.
Option D: Segmented memory can be paged.
Correct Answer: A

Question 12 :

In Virtual Memory Systems, Dynamic Address Translation -
Option A: is te hardware necessary to implement paging.
Option B: stores pages at a specific location on disk.
Option C: is useless wahen swapping is used.
Option D: is part of the operating system paging algorithm.
Correct Answer: A

Question 13 :

Seeks analysis -
Option A: is used for analyzing paging problems.
Option B: is used for analyzing device busy problems.
Option C: is used for analyzing control - unit busy problems
Option D: is only shown on real - time displays.
Correct Answer: B

Question 14 :

Swapping -
Option A: works best with many small partitions.
Option B: allows many programs to use memory simultaneously.
Option C: allows each program in turn to use the memory.
Option D: does not work with overlaying.
Correct Answer: C

Question 15 :

Which of the following statement is true ?
Option A: The LRU algorithm pages out pages that have been used recently.
Option B: Thrashing is a natural consequences of virtual memory systems.
Option C: Seek analusis is used for analysing control - unit busy problems.
Option D: All of the above.
Correct Answer: C

Question 16 :

The LRU algorithm ?
Option A: Pages out pages that have been used recently.
Option B: Pages out pages that have not been used recently.
Option C: Pages out pages that have been last used recently.
Option D: Pages out the first page in a given area.
Correct Answer: C

Question 17 :

Paging -

A) is a method of memory allocation by which the program is subdevided into equal portions, or pages and core is subdevided into equal portions or blocks.
B) consists of those addresses that may generated by a processor during execution of a computation.
C) is mwthod of allocating processor time.
D) allows multiple programs to reside in seperate areas of core at the time.
Option A: A
Option B: B
Option C: C
Option D: D
Correct Answer: A

Question 18 :

The Memory Address Register ( MAR ) -

A) is a hardware memory device which denotes the location of the current instruction being executed.
B) is a group of electrical circuits (hardware) , that performs the intent of instruction fetched from memory.
C) contains the address of the memory location that is to be read from or stored into.
D) contains a copy of the designated memory location specified by the MAR after a "read" or the new contents of the memory prior to a "write".
Option A: A
Option B: B
Option C: C
Option D: D
Correct Answer: C

Question 19 :

Memory -

A) is device that performs a sequence of operations specified by instructions in memory.
B) is the device where information is stored.
C) is a sequence of instructions.
D) is typically charaterized by intractive processing and time slicing of the CPU's time to allow quick response to each user.
Option A: A
Option B: B
Option C: C
Option D: D
Correct Answer: B

Question 20 :

Information in a memory that is no longer valid or wanted is known as -
Option A: Non - Volatile.
Option B: Volatile.
Option C: Surplus.
Option D: Grabage.
Correct Answer: D