Wednesday, September 1, 2010

Answer of WBCS Preliminary Question Paper 2010 -II

24. The separation from a lover fills one’s mind with blues.
(A) Sadness
(B) Romanticism
(C) Nostalgia
(D) Colourfulness

Answer : A

26. Enzymes speed up biochemical reactions by
(A) Increasing the activation energy of the reaction
(B) Lowering the temperature of the reaction
(C) Increasing the temperature of the reaction
(D) Lowering the activation energy of the reaction

Answer : D

27. The narrow portion between uterus and vagina of higher mammals is known as
(A) Clitoris
(B) Urethra
(C) Oviduct
(D) Cervix

Answer : D

28. Presence of sunken stomata in leaves indicates the character of
(A) Hydrophytes
(B) Xerophytes
(C) Halophytes
(D) Mesophytes

Answer : D

29. Cardiac muscles do not undergo fatigue, because
(A) Interconnection of cells by intercalated disc
(B) Having numerous mitochondria
(C) Having more actins
(D) Having more myosin

Answer : B

31. At which Delhi Durbar the Queen of England was proclaimed the Empress of India?
(A) 1876-77 A.D.
(B) 1911 A.D.
(C) 1921 A.D.
(D) None of the above

Answer : A

35. Polytene chromosome is found in the cells of
(A) Salivary gland of larvae of flies
(B) Liver of man
(C) Neuron of insects
(D) None of the above

Answer : A

36. Chittaranjan in West Bengal is well known for its
(A) Fertiliser plant
(B) Locomotive works
(C) Iron and Steel industry
(D) None of the above

Answer : B

37. VAT is imposed on
(A) the final consumer of a commodity
(B) total value added at the final stage of production of a commodity
(C) the value added at each stage of production of a commodity
(D) aggregate value in terms of cost of production of the producer of a commodity

Answer : A

38. The gene for Haemophilia is
(A) X-linked recessive
(B) X-linked dominant
(C) Y-linked
(D) Located in autosome

Answer : A

39. Who was the main inspiration of the Young Bengal movement?
(A) Rammohan
(B) Derozio
(C) Debendranath
(D) David Hare

Answer : B

40. The minimum number of artificial satellites required for communication throughout the globe is
(A) i
(B) 2
(C) 3
(D) 4

Answer : D

41. The toxic chemical element that caused Minamata disease in Japan was
(A) Uranium
(B) Mercury
(C) Cadmium
(D) Arsenic

Answer : B

42. Who is called “A traditional moderniser”?
(A) Vidyasagar
(B) Swami Vivekananda
(C) RammohanRoy
(D) B.G.Tilak

Answer :A

43. The Right to Information Act is applicable to the whole of India except to the state of
(A) Jammu and Kashmir
(B) Mizoram
(C) Manipur
(D) Nagaland

Answer: A

45. The Muhammadan Anglo-Oriental College of Aligarh was founded in the year
(A) 1868 A.D.
(B) 1875 A.D.
(C) 1883 A.D.
(D) 1906 A.D.

Answer : B

46. India developed RISAT 2 satellite in collaboration with
(A) USA
(B) Russia
(C) France
(D) Israel

Answer : D

47. The earthquake in Latur is believed to have resulted from
(A) Excessive loading of water
(B) Plate movement
(C) Fault line underneath a dam
(D) Folding

Answer : C

48. has been declared the International Year of Astronomy.
(A) 2008
(B) 2009
(C) 2010
(D) None of the above

Answer : B

49. In photosynthesis, ‘Light reaction’ takes place in
(A) Cytosol
(B) Grana of chloroplast
(C) Stroma of chloroplast
(D) Ribosome

Answer :B

50. How much of India’s crude oil requirement is imported?
(A) 65%
(B) 70%
(C) 75%
(D) 80%

Answer :A

51. Haversian system is a part of
(A) Kidney
(B) Bone
(C) Heart
(D) Brain

Answer :B

52. With the people of which country Harappan people carried trade?
(A) China
(B) Iran
(C) Russia
(D) Sumer

Answer :A

53. Nadir Shah invaded India in the year
(A) 1738 A.D.
(B) 1739 A.D.
(C) 1740 A.D.
(D) 1741 A.D.

Answer :B

54. The oldest school of Indian Philosophy is
(A) Yoga
(B) Sankhya
(C) Vaisesika
(D) Karma Mimansa

Answer :B

55. The Treaty of Amritsar was signed by the English with Ranjit Singh in the year
(A) 1807 A.D.
(B) 1809 A.D.
(C) 1811 A.D.
(D) 1813 A.D.

Answer :B

56. To which period of Indian history did Aryabhatta and Varahamihira (Scientist and Mathematician
respectively) belong?
(A) Maurya period
(B) Gupta period
(C) Pala period
(D) Delhi Sultanate

Answer :B

57. The apex body which operates micro-finance scheme by promoting self-help groups of individuals from a homogeneous class through banks or non-government organisations is
(A) Regional Rural Bank
(B) Grameen Bank
(C) State Bank of India
(D) National Bank for Agriculture and Rural Development

Answer : D

58. Who was the founder-President of theSwaraj Party?
(A) Motilal Nehru
(B) C.R.Das
(C) Rajendra Prasad
(D) Rajagopalachari

Answer : B

60. Under which Article of the Indian Constitution provision has been made for the formation of a Finance Commission to deal with various aspects of Centre-State financial relationship?
(A) Article 245
(B) Article 280
(C) Article 356
(D) Article 370

Answer : B.

62. Which of the following is a good nuclear fuel?
(A) Uranium 238
(B) Plutonium 239
(C) Neptunium 239
(D) Thorium 236

Answer : B

64. What did Iqta mean during Sultanate period?
(A) A form of Salutation
(B) An important official
(C) The grant of land revenue from a village or territory
(D) None of the above

Answer : C

66. Who founded the “Amrita Bazar Patrika”?
(A) Surendra Nath Banerjee
(B) Barindra Ghosh
(C) Krishna Kumar Mitra
(D) Sisir Kumar Ghosh

Answer : D

67. The technique of ‘DNA sequencing’ was discovered by
(A) H.G.Khorana
(B) Watson and Crick
(C) Frederick Sanger
(D) E.M. Southern

Answer :C

68. Which one of the following companies has recently entered into a memorandum of understanding with the Uranium Corporation of India for exploration of uranium deposits?
(A) ONGC
(B) GAIL
(C) Reliance Petroleum
(D) EssarOil

Answer : A

69. A Cladogram depicts the hypothesis of
(A) Evolutionary relationship
(B) Phenatic relationship
(C) Genetic relationship
(D) Taxonomic relationship

Answer : A

70. Which movement of Gandhiji joined with Khilafat movement?
(A) Civil Disobedience
(B) Non-Co-operation
(C) Quit India
(D) Against Indigo cultivation (1917)

Answer : B

72. The capital of Tipu Sultan was at
(A) Mysore
(B) Seringapattam
(C) Sringeri
(D) Belur

Answer : B

73. Who v/as the Governor-General of India when Widow Remarriage Act was passed?
(A) LordRipon
(B) Lord Canning
(C) Lord Dalhousie
(D) LordBentinck

Answer : C

74. The Muslim League joined the Interim Government in
(A) October 1946
(B) November 1946
(C) December 1946
(D) January 1947

Answer : A

75. Who translated ‘Nil Darpan’ in English?
(A) Madhusudan Dutt
(B) Rev. James Long
(C) Harish Chandra Mukherjee
(D) Kali Prasanna Singha

Answer : A

76. Consider the following statement
1. Definition of force is obtained from Newton’s first law of motion.
2. Definition of force is obtained from Newton’ s second law of motion.
3. In a house-hold wiring the appliances are connected in series.
4. The picture-tube of a television is basically a cathode ray tube.

(A) Only 1 is correct
(B) Only 2 is correct
(C) Only 2 and 4 are correct
(D) Only 1 and 4 are correct

Answer : C

77. In West Bengal SEZ was planned
(A) Around Medinipur
(B) Around Jhargram
(C) Around Nandigram
(D) Around Haldia

Answer : D

78. The Central Government is to collect Rs crore from disinvestment in 2009-10.
(A) 1120
(B) 1125
(C) 1130
(D) 1150

Answer : A

79. The Himalayas are
(A) Fold Mountains
(B) Block Mountains
(C) Residual. Hills
(D) Tableland

Answer : A

81. Which of the following films was directed by Tapan Sinha?
(A) Zindagi Zindagi
(B) Sagina
(C) Ek Doctor Ki Maut
(D) All of the above

Answer:D

Friday, March 19, 2010

Truncate text using php

[sourcecode language="php"]
<?php
function truncate($string, $length='' , $k = ''){
if( $length == '') $length = 50;
if( $k == '') $k = '...';
settype($string, 'string');
settype($length, 'integer');
for($a = 0; $a < $length AND $a < strlen($string); $a++){
$output .= $string[$a];
}
if( strlen($string) > $length)
$output .= $k;
return($output);
}
?>
[/sourcecode]
truncate text using php


$my_string = 'I am kajal Mondol.I live in Kolkata.';
echo truncate($my_string);
echo truncate($my_string,10);
echo truncate($my_string,10,',,,');

This will output:

I am kajal Mondol.I live in Kolkata.
I am kajal...
I am kajal,,,

This function truncates a variable to a character length, default is 50.
'...' is the default text to append if truncation occurs.
Second parameter determines how many characters to truncate to.

Tuesday, March 9, 2010

How to Add a Field to Drupal Contact form

STEP 1 :

First you have to create a module. Create a folder into /sites/all/modules. Give the folder name your module name. Create a module file into the folder. Give the module a name. I have used “contactus.module”. In contactus.module file write the following lines. If you give different module name then the function name should be function yourmodulename_form_alter(&$form, $form_state).


#title    = Title of the input field.

#type     = Type of the input field (e.g. ‘textfield’ or ‘textarea’ etc.  )

#required = If the field is required then value will be true.

Unset function will disable the particular field. Here, in the example I unset copy field. You can re-order all the fields as per need. Just you have to the $ order array. For more information see http://api.drupal.org/api/function/hook_form_alter.

[sourcecode language="php"]

<?php

function contactus_form_alter(&$form, $form_state) {

$form['company'] = array(

'#title' => t('Your company'),

'#type' => 'textfield',

);

$form['phone'] = array(

'#title' => t('Your phone'),

'#type' => 'textfield',

'#required' =>'true',

);

unset($form['copy']);

// reorder the elements in the form to include the elements being inserted

$order = array('name','mail', 'subject', 'company', 'phone','message','submit');

foreach($order as $key => $field) {

$form[$field]['#weight'] = $key;

}

[/sourcecode]

STEP  2: Now you have to create a info file.File name should be your modulename.info . Here I’ve used contactus.info. Into the .info file write the following lines.

name = "contactus"


description = "contact with us"


dependencies[] = contact


core = 6.x


php = 5.1

Thursday, March 4, 2010

Function to create GD thumbnail using Php

function thumbnail($src,$destimagename,$dimension)
{
$src_path=explode("/",$src);
$name=$src_path[count($src_path)-1];
array_pop($src_path);
$oldpath=implode("/",$src_path);
$newpath=$oldpath;
$newpath=$newpath."/".$destimagename;

if(copy($src,$newpath))
{
$name_extension=substr($name,strrpos($name,".")+1);
if (preg_match("/gif/i",$name_extension))
{
$src_img=imagecreatefromgif($newpath);
}
if (preg_match("/jpg|jpeg/i",$name_extension))
{
$src_img=imagecreatefromjpeg($newpath);
}
if (preg_match("/png/i",$name_extension))
{
$src_img=imagecreatefrompng($newpath);
}
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);

$thumb_w = $dimension;
$thumb_h = floor(($old_y/$old_x) * $dimension);

$dst_img=@ImageCreateTrueColor($thumb_w,$thumb_h);
@imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);

if(preg_match("/png/i",$name_extension))
{
@imagepng($dst_img,$newpath);
}
if(preg_match("/jpg|jpeg/i",$name_extension))
{
@imagejpeg($dst_img,$newpath);
}
if(preg_match("/gif/i",$name_extension))
{

@imagegif($dst_img,$newpath);
}
@imagedestroy($dst_img);
@imagedestroy($src_img);

}

}

Wednesday, March 3, 2010

PHP Headers and Popular Mime Types

Atom


header('Content-type: application/atom+xml');

Javascript


header('Content-type: text/javascript');

JPEG Image


header('Content-type: image/jpeg');

PDF


header('Content-type: application/pdf');

XML


header('Content-type: text/xml');

RSS


header('Content-Type: application/rss+xml; charset=ISO-8859-1');

CSS


header('Content-type: text/css');

Create Backup of MySQL Database Using PHP

[sourcecode language="php"]
<?php

$dbName = "db_name";

$dbhost="localhost";

$dbuser="root";

$dbpass="";

$backupFile = $dbName . date("Y-m-d-H-i-s") . '.gz';

$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbName | gzip > $backupFile";

system($command);

header('Content-disposition: attachment; filename='.$backupFile);

header('Content-type: application/x-gzip');

readfile($backupFile);

?>
[/sourcecode]

Configuring The Contact Form Module In Drupal

Drupal has a built in contact form module.

Activate The Module!


Browse to Administer / Site Building / Modules in your site and activate the Contact and Contact Forms module. Save the configuration and you’re ready to go.

Configure The Contact Form


Browse to Administer / Site Building / Contact Form to begin. Click the link at the top of the page to Add Category.




1. Give the category name. I have used Contact Us.

2. Configure recipients. You can put a single email address or multiple email address separated by comma(,).

You can configure the contact us from from the setting options. This page also allows you to set maximum messages per hour – an anti-spam setting that prevents you getting bombarded with contact form spam! You can also allow members to have a personal contact form which relays emails to the address they have in their profile.

Integrating Into Site Navigation


The path of the contact form is yoursite.com/contact. You can link this page from Administer / Site Building / Menus.

Tuesday, February 23, 2010

Fatal error: Allowed memory size of 8388608 bytes exhausted.

Fatal error: Allowed memory size of 8388608 bytes exhausted.

Sometime PHP script may returns the above error. Normally this error is generated when your script exhausted and used up the default memory requirement of 8 MB memory allocation.

* Default memory limit is set in php.ini file ( php configuration file.)
* memory_limit = 8M;

How can we manage with the memory problems comes in some php scripts?
you should check following things when such kind of memory errors occurs in your script.

1. check the default memory_limit variable in your php.ini file.
memory_limit = 8M;
you can change this memory limit and again check for the error.

a. Edit in php.ini

memory_limit = 12M;
restart the apache service.



b. code Level
@ini_set('memory_limit', '12M');



c. htaccess
php_value memory_limit 12M
___________________________________________________________________

2. If the error is not resolved after above step, then you should start debugging your code in order to find out the reason of memory limit exceed.
You have to first find out at what position in your code the memory limit is exceeding. you can use the php's built in function for this purpose.

Function description

memory_get_usage — This function returns the amount of memory allocated to PHP.

Syntax : int memory_get_usage ( true / false );

It returns the amount of memory, in bytes, that's currently being allocated to your PHP script.

Set the option to this function to TRUE to get the real size of memory allocated from system. If not set or FALSE only the memory used by emalloc() is returned.

How to use this function

1. Write this code ( echo memory_get_usage( true ); ) repeteadly after some no of lines.
2. Run it in browser
3. Compare the counts given by each echo and you can check which block of your code needs extra memory.
4. Once you identify the block of code which needs extra memory then you can start deallocating the unused memory spaces allocated by some unused variables and some infinite loops.
5. use following wherever necessary.
a. unset($var_name);
b. mysql_free_result($result_set); — Free result memory
c. Look for include("file.php") in loops, by mistake.
Just try to free the memory everywhere if the variable / array is no longer used.
6. Best of luck.


Function description

bool
mysql_free_result ( resource $result )
It frees all the memory associated with the result identifier result .

Object Oriented Programming with PHP




Object Oriented Programming With PHP 5 #1[gigya width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=oop1-090302214803-phpapp02&stripped_title=object-oriented-programming-with-php-5-1" quality="high" wmode="tranparent" ]

Object Oriented Programming with PHP




Object Oriented Programming With PHP 5 #2[gigya width="455" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=oop2-090302220926-phpapp02&stripped_title=object-oriented-programming-with-php-5-2" quality="high" wmode="tranparent" ]

BASIC COMPUTER OPERATIONS

1. Input: This is the process of entering data and programs in to the computer system. You should know that computer is an electronic machine like any other machine which takes as inputs raw data and performs some processing giving out processed data. Therefore, the input unit takes data from us to the computer in an organized manner for processing.

f1.gif (4622 bytes)

Fig. 2.1 Basic computer Operations

2. Storage: The process of saving data and instructions permanently is known as storage. Data has to be fed into the system before the actual processing starts. It is because the processing speed of Central Processing Unit (CPU) is so fast that the data has to be provided to CPU with the same speed. Therefore the data is first stored in the storage unit for faster access and processing. This storage unit or the primary storage of the computer system is designed to do the above functionality. It provides space for storing data and instructions.

The storage unit performs the following major functions:

  • All data and instructions are stored here before and after processing.

  • Intermediate results of processing are also stored here.


3. Processing: The task of performing operations like arithmetic and logical operations is called processing. The Central Processing Unit (CPU) takes data and instructions from the storage unit and makes all sorts of calculations based on the instructions given and the type of data provided. It is then sent back to the storage unit.

4. Output: This is the process of producing results from the data for getting useful information. Similarly the output produced by the computer after processing must also be kept somewhere inside the computer before being given to you in human readable form. Again the output is also stored inside the computer for further processing.

5. Control: The manner how instructions are executed and the above operations are performed. Controlling of all operations like input, processing and output are performed by control unit. It takes care of step by step processing of all operations in side the computer.

Monday, February 22, 2010

How to get current page URL using PHP?

<?php

function currentPageURL()

{

$pageURL = 'http';

if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}

$pageURL .= "://";

if ($_SERVER["SERVER_PORT"] != "80")

{

$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];

} else {

$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];

}

return $pageURL;

}

?>

You can now get the current page URL using the line:

<?php
echo currentPageURL ();
?>

Thursday, February 18, 2010

Date format converting Code In PHP

In database date are stored with a format like 0000-00-00.But sometime we need to change the format.The following function help you to change the time format.

function dateFormat($Date)

{

$Date =explode("-",$Date);

$new_date= $Date[2]."/".$Date[1]."/".$Date[0]; //date format will be like21/12/2010

return $new_date ;

}

Breaking a big array into small parts

<?php

$smallarray1=array_slice($bigarray, 0, sizeof($bigarray) / 2);
$smallarray2=array_slice($bigarray, sizeof($bigarray) / 2);

?>

Code for Fav icon

<LINK REL="SHORTCUT ICON" href="images/shortcut.jpg" />

how to get File extention using PHP

<?php

$file_extension = strtolower(substr(strrchr($filename,"."),1));

?>

Monday, February 1, 2010

Essential Joomla Extensions

Artio JoomSEF – Artio.cz


This extension will rewrite your Joomla! URLs into a more human friendly form, which at the same time enhances its SEO value. A multi-language interface    support is included, and updates can be made online easily. It also offers API for adding SEF functionality for other 3rd party Joomla! Modules easily. This is a great plug-in for Joomla! Users who wish to make their


Sites more prominent in the search engines.


Download Here:


http://www.artio.cz/en/downloads/joomla-extensions/



AllVideosPlugin - Joomlaworks.gr


The AllVideos Plugin gives you the ability to easily embed online streaming videos/audios within your webpage as well as have your own videos/audios uploaded on your server. No HTML is required at all and all you have to do is to place tags within our content where you want the videos or audios to appear. There are two ways you can use the AllVideosPlugin. If you want to save on your bandwidth, simply upload your videos to a Youtube.com and then embed the video onto your own webpage with the plugin. An alternative will be upload the


video itself to your website, after which you can stream the audios/videos via simple tags. One common complaint is that only 10 videos are allowed per page for this plugin. As long as that is not a problem, the AllVideosPlugin is very useful for all your videos/audios streaming needs.


Download Here:


http://www.joomlaworks.gr/


Jombackup - Jomres.net


Jombackup is an extension used for performing daily mysql backups and emailing them to an address of your choice. You can use the cron jobs function to enable daily backups Joomla! mySQL data. This is a must-have extension to saveguard all your precious data in your databases. It is easy to install as well, and works like a charm.


Download Here:


http://www.jomres.net/index.php?option=com_docman&task=doc_details&gid=72&Itemid=7


9


Phil-A-Form - Phil-taylor.com


Phil-A-Form allows you to generate dynamic forms in Joomla!, without sophisticated programming knowledge. Results can be emailed to anyone, or saved in a database. Phil-AForm was the worlds FIRST EVER mambo/Joomla! Form Generator, and is extremely beginnerfriendly as well. Solid and reliable, a great extension if you need forms on your site.


Download Here:


http://www.phil-taylor.com/Joomla/Components/Phil-A-Form/


VirtueMart - Virtuemart.org


VirtueMart is the leading Online-Shop solution for Joomla! (more than 1.5 Million downloads so far). You can download, use and modify it without any restrictions, for free, just like Joomla!. VirtueMart is not a stand-alone script, but a Plug-in and requires the PHP Content Management System Joomla!. Multiple translations can be readily found in the included


Language pack.


Download Here:


http://www.virtuemart.org/


AdSense Module (ClickSafe - Special Edition) - Joomlaspan.com


This extension is simple solution for implementing Google AdSense ads in Joomla!. As they are, Adsense ads are supposed to be easy to insert by themselves, but this extension provides other useful functionalities like blocking certain IP numbers from seeing Google ads. This helps prevent click fraud as you cannot accidentally click on your own ads. It also has chameleon codes that can make the ad colors automatically change with each page load, as determined


by you.


Download Here:


http://www.joomlaspan.com/joomla-downloads/Download/-JoomlaspanModules/GoogleAdSenseRelatedModules/

Saturday, January 30, 2010

Code for tab in drupal.

This conditional statement controls the tabs.
if ($tabs = theme('menu_local_tasks')) {
$output .= $tabs;
}

How to build joomla templates

Step 1:

Create  a  folder into the templates folder.This folder name must be the template name.


Step 2:

Create a folder named "style" for stylesheet,

Create a folder named "javascript" for javascript,

Create a folder named "images" for images,

Create a folder named "html" for components,

Create a file index.php into you template folder. After that copy and paste the following lines.

<?php
/**
* @copyright    Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license        GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/


defined('_JEXEC') or die('Restricted access');
$url = clone(JURI::getInstance());
?>


Step 3: Copy and paste the follwing lines

<?php echo '<?xml version="1.0" encoding="utf-8"?'.'>'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>" >
<head>
<jdoc:include />
<link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/[your css].css" rel="stylesheet" />
if any javascript file is needed, write the following lines

<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/javascript/[your script].js"></script></head>
<body>


Step 4: For displaying primary links paste thi following codes into the appropriate <Div>

<jdoc:include type="modules" style="" />

Step 5:

For displaying your site content write the following code within appropriate <Div>

<jdoc:include type="component" />

Step 6:
Colse all the opened html tag.

Pie chart using php

<?php
$myImage = ImageCreate(300,300);
$white = ImageColorAllocate ($myImage, 255, 255, 255);
$red  = ImageColorAllocate ($myImage, 255, 0, 0);
$green = ImageColorAllocate ($myImage, 0, 255, 0);
$blue = ImageColorAllocate ($myImage, 0, 0, 255);
$lt_red = ImageColorAllocate($myImage, 255, 150, 150);
$lt_green = ImageColorAllocate($myImage, 150, 255, 150);
$lt_blue = ImageColorAllocate($myImage, 150, 150, 255);

for ($i = 120;$i > 100;$i–) {
ImageFilledArc ($myImage, 100, $i, 200, 150, 0, 90, $lt_red, IMG_ARC_PIE);
ImageFilledArc ($myImage, 100, $i, 200, 150, 90, 180, $lt_green, IMG_ARC_PIE);
ImageFilledArc ($myImage, 100, $i, 200, 150, 180, 360, $lt_blue, IMG_ARC_PIE);
}

ImageFilledArc($myImage, 100, 100, 200, 150, 0, 90, $red, IMG_ARC_PIE);
ImageFilledArc($myImage, 100, 100, 200, 150, 90, 180 , $green, IMG_ARC_PIE);
ImageFilledArc($myImage, 100, 100, 200, 150, 180, 360 , $blue, IMG_ARC_PIE);
header (“Content-type: image/png”);
ImagePNG($myImage);
ImageDestroy($myImage);
?>

Dynamic bar chart using php

<?php
header(“Content-type: image/jpeg”);
$data = array(‘3400′,’2570′,’245′,’473′,’1000′,’3456′,’780′);
$sum = array_sum($data);

$height = 255;
$width = 320;
$im = imagecreate($width,$height); // create width , height px of chart background
/*    $background_color = imagecolorallocate($im, 0, 0, 0);
*/    $white = imagecolorallocate($im,255,255,255);
$black = imagecolorallocate($im,0,0,0);
$red = imagecolorallocate($im,255,0,0);
//create the X & Y axis lines.
imageline($im, 10, 5, 10, 230, $black);
imageline($im, 10, 230, 300, 230, $black);

$x = 15;
$y = 230;
$x_width = 20;
$y_ht = 0;

for ($i=0;$i<7;$i++){
$y_ht = ($data[$i]/$sum)* $height;
imagerectangle($im,$x,$y,$x+$x_width,($y-$y_ht),$red);

/*    $colorHandle = imageColorAllocate($im, 225, 192, $i); // allocate color
imageFilledRectangle($im, $x,$y,$x+$x_width,($y-$y_ht), $colorHandle);// use it for drawing
*/
imagestring( $im,2,$x-1,$y+10,$data[$i],$black);
$x += ($x_width+20);
}
imagejpeg($im);
?>

Friday, January 29, 2010

DIRECTORY_SEPARATOR in php

DIRECTORY_SEPARATOR = strtoupper(substr(PHP_OS,0,3)=='WIN')?'\\':'/';

Monday, January 25, 2010

WBCS preli question paper 2010


W.B.C.S EXECUTIVE EXAMINATION, 2010
Preliminary
Time: 2 hours 30 minutes Marks: 200
GENERAL STUDIES

1. A pugilist is a
(A) boxer                               (B) swimmer
(C) athlete                              (D) weight-lifter


2. The specialist who handles problems in the human body related to bones is a/an
(A) orthodontist                      (B) osteopath
(C) podiatrist                          (D) oncologist

3. Baptism of fire means
(A) a fire fighting act
(B) a bad beginning in the first job
(C) a difficult introduction to an experience
(D) a religious experience

4. A duck is a bird, but to duck is
(A) to feel shy                          (B) to refuse
(C) to abandon                        (D) to avoid

5. Insert the appropriate phrasal verb in the blank below and make the sentence meaningful:
This evidence _____________ with what one already knows.
(A) ties in                                 (B) sets in
(C) gives in                               (D) goes down

6. A manicurist takes care of
(A) foot                                    (B) ear
(C) nails                                   (D) mind

7. Fill in the blank with the right word:
A lame duck organization is one which needs ___________.
(A) authority                            (B) staff
(C) power                               (D) support

8. 'To give a dog a bad name' means
(A) it is very difficult to destroy the reputation of a loyal person
(B) it is very difficult to lose a bad reputation
(C) it is very difficult to earn a good reputation in a bad company
(D) it is very difficult to both be loyal and do something that jeopardizes self-reputation

9. The prospect of her marriage is remote.
The opposite of 'remote', in this sentence, would be
(A) high                                   (B) less
(C) far                                     (D) near

10. 'We are superior to everybody else' is the aptitterance of a/an
(A) egoist                                (B) pacifist
(C) anarchist                            (D) chauvinist

11. Choose the right alternative from the options given below:
A gourmet loves —.
(A) Fashion                             (B) Action
(C) Food                                 (D) Films

Direction for Question Nos. 12 and 13
Fill in the blanks in the sentences choosing the most meaningful alternative from the ones supplied:

12. The street is not properly .
(A) Illumed                             (B) Illumined
(C) Illuminated                        (D) Enlightened

13. The of the place attracts many ascetics.
(A) Quietness                         (B) Silence
(C) Quietude                          (D) Soundlessness

14. Choose the correct alternative from the ones supplied:
Detect where the adjective "public" is used in a derogatory sense:
(A) Public house                    (B) Public woman
(C) Public servant                  (D) Public speech

Direction for Question Nos. 15 to 17
Fill in the blank with the correct alternative from the ones supplied:
15. The man who follows his nose actually follows his .
(A) Passion                          (B) Rationality
(C) Instinct                           (D) Memory

16. Lachrymose nature means .
(A) Lethargic                        (B) Prone to anger
(C) Prone to tear                  (D) Energetic

17. A man in the charge of farming and nurturing animals is called .
(A) A ploughman                 (B) A farmer
(C) A firm-manager             (D) A husbands man

18. Choose the right alternative from the options given:
A man with an irrationally fixed idea is called
(A) An eccentric                  (B) A maniac
(C) A manikin                      (D) A phobic

19. Choose the right word from the alternatives to complete the sentence idiomatically:
A clever man sweeps his family scandals under the .
(A) Ground                         (B) Floor
(C) Carpet                          (D) Grave-stone

20. Fill in the blank with correct word to make the sentence meaningful:
It is usual nowadays to blow one's own
to impress others.
(A) Horn                           (B) Trumpet
(C) Drum
(D) Band
Direction for Question Nos. 21 and 22
Opposite Meaning from these:

21. (A) Doggish Canine
(B) Manly Virile
(C) Divine Infernal
(D) Earthly Terrestrial



22. (A) Pedant Pedagogic
(B) Humid Arid
(C) Erroneous Faulty
(D) Horrible — Horrendous


23. Choose the correct alternative from the options to fill in the blanks:
'In the time of danger, we should try to take the bull by the horns' means "In the time of danger we should try to "
(A) Surmount it
(B) Face the situation boldly
(C) Overcome it
(D) Control ourselves


Direction for Question Nos. 24 and 25
Choose the word from the list which is nearest in meaning to the underlined part of the sentence:


24. The separation from a lover fills one's mind with blues.
(A) Sadness
(B) Romanticism
(C) Nostalgia
(D) Colourfulness

25. Hike in oil price may mar the future of the trade world.
(A) Harness
(B) Help
(C) Better
(D) Worsen

26. Enzymes speed up biochemical reactions by
(A) Increasing the activation energy of the reaction
(B) Lowering the temperature of the reaction
(C) Increasing the temperature of the reaction
(D) Lowering the activation energy of the reaction

27. The narrow portion between uterus and vagina of higher mammals is known as
(A) Clitoris
(B) Urethra
(C) Oviduct
(D) Cervix

28. Presence of sunken stomata in leaves indicates the character of
(A) Hydrophytes
(B) Xerophytes
(C) Halophytes
(D) Mesophytes

29. Cardiac muscles do not undergo fatigue, because
(A) Interconnection of cells by intercalated disc
(B) Having numerous mitochondria
(C) Having more actins
(D) Having more myosin

30. Which Five Year Plan was suspended one year before its time schedule?
(A) Third Plan
(B) Fourth Plan
(C) Fifth Plan
(D) Sixth Plan

31. At which Delhi Durbar the Queen of England was proclaimed the Empress of India?
(A) 1876-77 A.D.
(B) 1911 A.D.
(C) 1921 A.D.
(D) None of the above

32. Rate of radiation of heat from a body is the highest if its surface is
(A) White
(B) Smooth
(C) Smooth but black
(D) Rough but black

33. Which of the following is not a physical change?
(A) Dehydrating milk to get milk powder
(B) Sublimation of iodine
(C) Dissolving sugar in tea
(D) Burning of wax in a candle

34. The vegetative body of a bry ophy te/moss represents the structure of
(A) Sporophyte
(B) Gametophyte
(C) Sporophyte or gametophyte
(D) Sporophyte and gametophyte

35. Polytene chromosome is found in the cells of
(A) Salivary gland of larvae of flies
(B) Liver of man
(C) Neuron of insects
(D) None of the above

36. Chittaranjan in West Bengal is well known for its
(A) Fertiliser plant
(B) Locomotive works
(C) Iron and Steel industry
(D) None of the above

37. VAT is imposed on
(A) the final consumer of a commodity
(B) total value added at the final stage of production of a commodity
(C) the value added at each stage of production of a commodity
(D) aggregate value in terms of cost of production of the producer of a commodity

38. The gene for Haemophilia is
(A) X-linked recessive
(B) X-linked dominant
(C) Y-linked
(D) Located in autosome

39. Who was the main inspiration of the Young Bengal movement?
(A) Rammohan
(B) Derozio
(C) Debendranath
(D) David Hare

40. The minimum number of artificial satellites required for communication throughout the globe is
(A) i
(B) 2
(C) 3
(D) 4


41. The toxic chemical element that caused Minamata disease in Japan was
(A) Uranium
(B) Mercury
(C) Cadmium
(D) Arsenic

42. Who is called "A traditional moderniser"?
(A) Vidyasagar
(B) Swami Vivekananda
(C) RammohanRoy
(D) B.G.Tilak

43. The Right to Information Act is applicable to the whole of India except to the state of
(A) Jammu and Kashmir
(B) Mizoram
(C) Manipur
(D) Nagaland

44. Which metal ion is responsible for electron transportation in photosynthesis?
(A) Sodium
(B) Potassium
(C) Cobalt
(D) Iron

45. The Muhammadan Anglo-Oriental College of Aligarh was founded in the year
(A) 1868 A.D.
(B) 1875 A.D.
(C) 1883 A.D.
(D) 1906 A.D.

46. India developed RISAT 2 satellite in collaboration with
(A) USA
(B) Russia
(C) France
(D) Israel

47. The earthquake in Latur is believed to have resulted from
(A) Excessive loading of water
(B) Plate movement
(C) Fault line underneath a dam
(D) Folding

48. has been declared the International Year of Astronomy.
(A) 2008
(B) 2009
(C) 2010
(D) None of the above

49. In photosynthesis, 'Light reaction' takes place in
(A) Cytosol
(B) Grana of chloroplast
(C) Stroma of chloroplast
(D) Ribosome

50. How much of India's crude oil requirement is imported?
(A) 65%
(B) 70%
(C) 75%
(D) 80%

51. Haversian system is a part of
(A) Kidney
(B) Bone
(C) Heart
(D) Brain

52. With the people of which country Harappan people carried trade?
(A) China
(B) Iran
(C) Russia
(D) Sumer

53. Nadir Shah invaded India in the year
(A) 1738 A.D.
(B) 1739 A.D.
(C) 1740 A.D.
(D) 1741 A.D.

54. The oldest school of Indian Philosophy is
(A) Yoga
(B) Sankhya
(C) Vaisesika
(D) Karma Mimansa

55. The Treaty of Amritsar was signed by the English with Ranjit Singh in the year
(A) 1807 A.D.
(B) 1809 A.D.
(C) 1811 A.D.
(D) 1813 A.D.

56. To which period of Indian history did Aryabhatta and Varahamihira (Scientist and Mathematician
respectively) belong?
(A) Maurya period
(B) Gupta period
(C) Pala period
(D) Delhi Sultanate

57. The apex body which operates micro-finance scheme by promoting self-help groups of individuals from a homogeneous class through banks or non-government organisations is
(A) Regional Rural Bank
(B) Grameen Bank
(C) State Bank of India
(D) National Bank for Agriculture and Rural Development

58. Who was the founder-President of theSwaraj Party?
(A) Motilal Nehru
(B) C.R.Das
(C) Rajendra Prasad
(D) Rajagopalachari
59. Who was the Governor-General who decided in favour of Western education in India?
(A) Lord Cornwallis
(B) LordBentinck
(C) LordRipon
(D) LordCurzon

60. Under which Article of the Indian Constitution provision has been made for the formation of a Finance Commission to deal with various aspects of Centre-State financial relationship?
(A) Article 245
(B) Article 280
(C) Article 356
(D) Article 370


61. The number of m' s in the series a bbb ccccc ddddddd ................... is
(A) 15
(B) 17
(C) 25
(D) 27

62. Which of the following is a good nuclear fuel?
(A) Uranium 238
(B) Plutonium 239
(C) Neptunium 239
(D) Thorium 236

63. Among the districts of West Bengal, according to 2001 census data sex ratio is lowest in
(A) Kolkata
(B) Purulia
(C) Hooghly
(D) Uttar Dinajpur

64. What did Iqta mean during Sultanate period?
(A) A form of Salutation
(B) An important official
(C) The grant of land revenue from a village or territory
(D) None of the above

65. A tube-well will not work if the depth of water below the ground is
(A) 20 ft.
(B) 25 ft.
(C) 28 ft.
(D) 38 ft.

66. Who founded the "Amrita Bazar Patrika"?
(A) Surendra Nath Banerjee
(B) Barindra Ghosh
(C) Krishna Kumar Mitra
(D) Sisir Kumar Ghosh

67. The technique of 'DNA sequencing' was discovered by
(A) H.G.Khorana
(B) Watson and Crick
(C) Frederick Sanger
(D) E.M. Southern

68. Which one of the following companies has recently entered into a memorandum of understanding with the Uranium Corporation of India for exploration of uranium deposits?
(A) ONGC
(B) GAIL
(C) Reliance Petroleum
(D) EssarOil

69. A Cladogram depicts the hypothesis of
(A) Evolutionary relationship
(B) Phenatic relationship
(C) Genetic relationship
(D) Taxonomic relationship

70. Which movement of Gandhiji joined with Khilafat movement?
(A) Civil Disobedience
(B) Non-Co-operation
(C) Quit India
(D) Against Indigo cultivation (1917)

71. Which Carbohydrate is used commercially in the silvering of mirrors?
(A) Sucrose
(B) Fructose
(C) Cellulose
(D) Glucose

72. The capital of Tipu Sultan was at
(A) Mysore
(B) Seringapattam
(C) Sringeri
(D) Belur

73. Who v/as the Governor-General of India when Widow Remarriage Act was passed?
(A) LordRipon
(B) Lord Canning
(C) Lord Dalhousie
(D) LordBentinck

74. The Muslim League joined the Interim Government in
(A) October 1946
(B) November 1946
(C) December 1946
(D) January 1947

75. Who translated 'Nil Darpan' in English?
(A) Madhusudan Dutt
(B) Rev. James Long
(C) Harish Chandra Mukherjee
(D) Kali Prasanna Singha

76. Consider the following statement
1. Definition of force is obtained from Newton's first law of motion.
2. Definition of force is obtained from Newton' s second law of motion.
3. In a house-hold wiring the appliances are connected in series.
4. The picture-tube of a television is basically a cathode ray tube.

(A) Only 1 is correct
(B) Only 2 is correct
(C) Only 2 and 4 are correct
(D) Only 1 and 4 are correct

77. In West Bengal SEZ was planned
(A) Around Medinipur
(B) Around Jhargram
(C) Around Nandigram
(D) Around Haldia

78. The Central Government is to collect Rs crore from disinvestment in 2009-10.
(A) 1120
(B) 1125
(C) 1130
(D) 1150

79. The Himalayas are
(A) Fold Mountains
(B) Block Mountains
(C) Residual. Hills
(D) Tableland

80. Which one of the following is an indirect tax levied by the Central Government in India?
(A) Service tax
(B) Corporate Income tax
(C) Profession tax
(D) Agricultural Income tax


81. Which of the following films was directed by Tapan Sinha?
(A) Zindagi Zindagi
(B) Sagina
(C) Ek Doctor Ki Maut
(D) All of the above

82. Prohibition of Sati was enacted by Regulation XVII in year
(A) 1829 A.D.
(B) 1830 A.D.
(C) 1835 A.D.
(D) None of the above

83. Electrical energy is converted into mechanical energy by a
(A) Thermostat
(B) Motor
(C) Dynamo
(D) Rectifier

84. The Simon Commission was appointed for
(A) Indian Constitutional Reforms
(B) Administrative Reforms
(C) Educational Reforms
(D) Jail Code Reforms

85. Todas are tribals of
(A) Jharkhand
(B) Chhattisgarh
(C) Uttarakhand
(D) Nilgiri Hills

86. World Conference against Racism was recently held in
(A) Beijing
(B) Durban
(C) Bonn
(D) Geneva

87. The 73rd Constitutional Amendment in 1992
1. provided a constitutional guarantee to the formation of Panchayats at the village and other levels.
2. added a new part to the Constitution relating to urban local bodies.
3. stipulated that all Panchayat members be elected for a five year term in elections supervised by the State Election Commission.
Which of the statements given above is/are correct?
(A) 1 and 2
(B) land3
(C) lonly
(D) 2 only

88. Partition of Bengal was withdrawn in
(A) 1905
(B) 1906
(C) 1911
(D) 1909

89. What is Ibadat Khana at Fatepur Sikri?
(A) A magnificent building for residence
(B) A house for religious discourses of all religion s
(C) A house for eating
(D) None of the above

90. Who was Megasthenes?
(A) Ambassador of Selecus
(B) Prime Minister of Chandragupta Maurya
(C) A Greek pilgrim
(D) A Chinese traveller

91. Who among the following Sultans of Delhi wanted to become Second Alexander and conquer the world?
(A) Alauddin Khilji
(B) Ghiyasuddin Balban
(C) Muhammad Bin Tugluq
(D) None of them

92. Kapildhara Falls is located on
(A) River Sone
(B) River Chambal
(C) River Narmada
(D) River Krishna

93. Who founded the "School Book Society"?
(A) William Jones
(B) Hyde East
(C) D.Bethune
(D) David Hare

94. India held joint naval exercise in February with USA and
(A) Japan
(B) Australia
(C) South Korea
(D) None of the above

95. A piece of cotton cloth gets wet if one end of it is dipped in water in a glass. This is due to
(A) Gravitation
(B) Viscosity
(C) Elasticity
(D) Capillarity

96. Tsunamis are generated by
(A) Undersea plate movements
(B) Undersea vulcanism
(C) Tidal change
(D) None of the above

97. Who wrote "Life Divine"?
(A) Swami Vivekananda
(B) Keshab Chandra Sen
(C) Sister Nivedita
(D) Arabindo Ghosh

98. In which year did Jaljanwalabagh massacre happen?
(A) 1908
(B) 1909
(C) 1918
(D) 1919

99. Who was the author of Rajtarangini?
(A) Kautilya
(B) Megasthenes
(C) Kalhan
(D) None of the above

100. Highest population growth rate in West Bengal, according to 2001 census is found in
(A) Malda
(B) Uttar Dinajpur
(C) Dakshin Dinajpur
(D) South 24-Parganas


121. Satyam Computers has been taken over by
(A) Larsen & Toubro
(B) TCS
(C) TechMahindra
(D) W.L.Ross .

122. The first Indian Prime Minister who the then did not belong to the Indian National Congress?
(A) Charan Singh
(B) Vishwanath Pratap Singh
(C) Chandra Shekhar
(D) MorarjiDesai

123. 8 persons A, B, C, D, E, F, G and H are sitting by a round table each facing the centre. D is second to the left of F and third to the right of H. A is second to the right of F and an immediate neighbour of H. C is second to the right of B and F is third to the right of B. G is not an immediate neighbour of F. In the above information who is to the immediate left of A?
(A) H
(B) E
(C) G
(D) B

124. The Bhakra Nangal Multipurpose Project consists of the Bhakra Dam across
(A) River Jhelum
(B) River Sutlej
(C) River Beas
(D) River Indus

125. 'Sundarbans' in West Bengal has been declared World Heritage site in
(A)  1999
(B)  1989
(C)  1979
(D)  1969

126. India was the country to develop nuclear powered submarine.
(A) 5th
(B) 6th
(C) 7th
(D) 8th

127. Shivaji's coronation took place in the year
(A) 1672 AD.
(B) 1673 A.D.
(C) 1674 A.D.
(D) 1675 A.D.

128. Bauxite extracted in Madhya Pradesh is used for the production of
(A) Bronze
(B) Aluminium
(C) Copper
(D) Mica

129. The Diwani of Bengal was granted to Clive in the year
(A) 1757 A.D.
(B) 1765 A.D.
(C) 1772 A.D.
(D) 1784 A.D.

130. Which officer was called Bakshi during the rule of Akbar?
(A) An officer in charge of town administration
(B) Officer in charge of military organization
(C) An administrative/executive officer
(D) None of the above

131. In which of the following Five Year Plans a bold approach was adopted towards a long term employment policy?
(A) Fifth
(B) Sixth
(C) Seventh
(D) Eighth

132. 19 students appear in a class test. The average of the best 10 scores is 69 while that of the worst 10 is 38. If the average of all the 19 scores is 54, the 10th score in order of magnitude is
(A) 62
(B) 58
(C) 46
(D) 44

133. AIDS/HIV virus is a type of
(A) DNA virus
(B) RNA virus
(C) Either DNA or RNA virus
(D) Both DNA and RNA virus

134. Forest Protection Committees consist of
(A) Forest Guards
(B) Panchayat Members
(C) Forest Villages, Forest Department and Panchayat
(D) Forest Department officials

135. In India variety of corals are found around
(A) Lakshadweep
(B) Daman &Diu
(C) Sundarbans
(D) Narmada estuary

136. 50 added to 60% of a number is the number itself. The number is
(A) 110
(B) 125
(C) 200
(D) 300

137. C is A's only daughter, and B and D are her only two brothers. Of the three grandsons E, G and M of A, E and M are only sons of B and D respectively. Of the three grand daughters F, H and N of A, H and N are only daughters of C and D respectively. Then B is G's
(A) Maternal uncle
(B) Paternal uncle
(C) Nephew
(D) Cousin

138. Bailadila range in India is noted for the production of
(A) Aluminium
(B) Iron Ore
(C) Bauxite
(D) Mica

150. Which one of the following pairs of days may appear 53 times each in a leap year while all other days will appear 52 times each?
(A) Sunday and Friday
(B) Wednesday and Thursday
(C) Monday and Wednesday
(D) Tuesday and Saturday

151. Who was known as the mother of Indian revolutionaries?
(A) Sister Nivedita
(B) Annie Besant
(C) Madame Cama
(D) Matangini Hazra

152. The soil of Bankura district is
(A) Podzolic
(B) Alluvial
(C) Lateritic
(D) Salty

153. Corazone Aquino was the head of .
(A) Thailand
(B) Philippines
(C) Fiji
(D) Australia

154. The Nagarjunasagar Multipurpose Project consists of a masonry dam across
(A) River Krishna
(B) River Cauvery
(C) River Tungabhadra
(D) River Sone

155. Which one among the following Indian states has the highest density of population?
(A) West Bengal
(B) Maharastra
(C) Uttar Pradesh
(D) Bihar

156. The last Wimbledon (2009) was Roger Federars grand slam title.
(A) 15th
(B) 16th
(C) 17th
(D) 18th

157. The 109th amendment of the Indian Constitution relates to .
(A) The President's power
(B) Age of voters
(C) Reservation for SCs and STs
(D) Official language

159. Alberto Fujimori was the President of
(A) Peru
(B) Japan
(C) Kenya
(D) Chile

160. Who of the following conquered territory in India and founded an empire in the name of his ancestors?
(A) Humayun
(B) SherShah
(C) Babur
(D) None of them


161. Who presided over the second session of the Indian National Congress?
(A) Dadabhai Naoroji
(B) Badruddin Tayebji
(C) W.C. Bonerjea
(D) Pherozeshah Mehta

162. Queen Victoria became Empress of India by
(A) Royal Titles Act, 1876
(B) Act of 1858
(C) Council Act, 1861
(D) Act of 1872

163. Iran recently celebrated anniversary of its Islamic Revolution.
(A) 20th
(B) 25th
(C) 30th
(D) 50th

164. Inter-state water dispute regarding sharing of river water has been taking place between
(A) Madhya Pradesh and Orissa
(B) Karnataka and Tamil Nadu
(C) Utttar Pradesh and Bihar
(D) Gujarat and Maharashtra

165. In respiration, cytosol plays a significant role in
(A) Oxidative phosphorylation
(B) Oxidative decarboxylation of pyruvic acid
(C) Krebs cycle
(D) Glycolysis

166. Which Constitutional Amendment Act granted the Right to Education for all Indian citizens?
(A) 73rd
(B) 74th
(C) 86th
(D) 91st

167. The All India Home Rule League was established by
(A) Annie Besant
¦ (B) Motilal Nehru
(C) B.R.Ambedkar
(D) Sarojini Naidu

168. A man, while facing east, turns twice in succession to his right; then turns thrice in succession to his left; finally he turns twice in succession to his right. The direction he is facing now is
(A) East
(B) West
(C) North
(D) South

169. The author of "In Other Rooms, Other Wonders" is
(A) Mohsin Hamid
(B) NadeemAslam
(C) Daniyal Mueenuddin
(D) Mohammad Hanif

170. Which one of the following years is regarded as the base year for construction of the Wholesale Price Index in India?
(A) 1990-91
(B) 1991-92
(C) 1992-93
(D) 1993-94

171. Who founded the Indian Association in Calcutta?
(A) W. C. Banerjea
(B) S. N. Banerjee
(C) Subhas Chandra Bose
(D) Chittararijan Das

172. India's third research st?tion in Antarctica will be named
(A) Gangotri
(B) Maitri
(C) Bharti
(D) Alka

173. 69 biscuits were distributed among 27 students in a class. If each boy got 2 biscuits and each girl 3, how many girls were there in the class?
(A) 23
(B) 19
(C) 15
(D) 12

174. River Ganga flows into the sea through
(A) An estuary
(B) A delta
(C) A bird's foot estuary
(D) None of the above

175. The word "demarche" recently appeared in the news in the wake of Mumbai Terror Attacks. What is a "demarche"?
(A) A sudden air-strike on a specific area in a foreign country
(B) A secret report on subversive activities within a state
(C) Diplomatic representation of a government position
(D) Recommendations to the government on police reforms

176. Gangubai Hangal belonged to gharana.
(A) Agra
(B) Gwalior
(C) Mewati
(D) Kirana

177. China was recently lashed by Typhoon ,
(A) Morakot
(B) Lungwang
(C) Wukong
(D) Rumbia

178. The next term in the series 1,2,6,15,31, is
(A) 47
(B) 50 (O 56 (D) 63

179. Suppose x * y = x + y,   if x < y
= x-y+l,  if  x>y
= 2x-l,    if  x = y
Then 5 * (6 * 2) + (5 * 6) * 2 = ?
(A) 24
(B) 23
(C) 20
(D) 19



181. Who is the Chairperson of the Unique Identification Authority'?
(A) B.G.Verghese (3) Nandan Nilekani
(C) SamPitroda
(D) Nandan Bagchi


182. Consider the following statements:
1. Part II ofthe Indian Constitution covers Articles 12 to 35 and deals with Fundamental Rights of Indian citizens.
2. Right to Property is listed as a Fundamental Right in the Constitution.
Which of the above statements is/are correct? (A)  1 only (h) 2 only
(C) Both 1 and 2
(D) Neither 1 nor 2

183. Which ofthe following recently filed for bankruptcy?
(A) General Motors
(B) Toyota rf     -     (C) Hyundai
tag      (D) Honda

184. Globalisation is being reflected in the Indian Scenario through thf1 establishment of
(A) Neighbourhood shops
(B) Local bazaars
(C) Shopping malls
(D) Stationery shops

185. Among Ashok, Dibakar, Aran and Bratin, Dibakar is younger than Aran, Bratin is older than only Ashok. Who is the oldest?
(A) Can't be identified data incomplete
(B) Dibakar
(C) Aran
(D) Bratin

186. An alloy contains 20% zinc, 45% nickel and rest aluminium. The total mass in gm of the alloy containing 105 gm of aluminium is
(A) 170
(B) 200
(C) 250
(D) 300

188. Which of the following Indian pharmaceuticals companies was recently taken over by Diichi Sankyo of Japan with 62-92% of equity share capital?
(A) Ranbaxy
(B) Dr. Reddy's Laboratories
(C) Nicholas Piramal
(D) Glaxo India

189. Bombay High Court recently ordered the merger of Reliance Industries and .
(A) Reliance Natural
(B) Reliance Infra
(C) Reliance Petroleum
(D) Reliance Power

190. 'Andhis' are storms of
(A) Punjab
(B) West Bengal
(C) Assam
(D) Uttar Pradesh

191. Which was not a member of Third Front in last Lok Sabha Election?
(A) CP1(M)
(B) Janata (S)
(C) TRS
(D) SP

192. Same force is applied to two bodies A and B of masses na and 5 m respectively for the same time. Then
(A) Velocity of A and B will be same
(B) Momentum of A and B will be same
(C) Momentum of A will be greater
(D) Momentum of B will be greater

193. Coastal Regulation Zones in India have been identified on the, basis of
(A) Tidal Height
(B) Sea Level Rise
(C) Depth of Water
(D) Undersea Bathymetry

194. India is not a member of .
(A) BRIC
(B) BIMSTEC
(C) SCO
(D) WTO

195. Consider the following statements:
1. Rajya Sabha is a permanent body.
2. Every member of the Rajya Sabha is entitled to a maximum term of five years.
3. Lok Sabha can make laws on subjects mentioned in the State List.
Which of the above statements is/are correct?
(A) 2 and 3
(B) land 3
(C) 2 only
(D) None of 1,2 and 3

196. Who was the President of the Constituent Assembly ?
(A) B.R. Ambedkar
(B) C. Rajagopalachari
(C) Rajendra Prasad
(D) Jawaharlal Nehru

197. Last August India signed a free trade agreement with .
(A) OPEC
(B) AU
(C) ASEAN
(D) NAFTA

198. Which of the following recently witnessed ethnic riots?
(A) Urumaqi
(B) Wuhan
(C) Tianjin
(D) Taichung

199. In West Bengal Plantation Agriculture is found in
(A) Malda district
(B) Darjeeling district
(C) Bankura district
(D) Howrah district

200. Match List I with List II and select the correct
answer using the codes given below the Lists:
List I (Person) List II (Position)
(a) N. Gopalaswamy       1. Chief Information Commissioner
(b) Sukhadeo Thorat       2. Chief Election Commissioner
(c) Wajahat Habibullah    3. Chairperson, National Human
Rights Commission
(d) S. Rajendra Babu      4. Chairman, University Grants
Commission
Codes:
(A) a-2,b-l,c-4,d-3
(B) a-l,b-3,c-4,d-2
(C) a-2,b-4,c-3,d-l
(D) a-2,b-4,c-l,d-3

Tuesday, January 19, 2010

Wednesday, January 13, 2010

How to Get the Current Page URL

<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>

You can now get the current page URL using the line:
<?php
echo curPageURL();
?>

Javascript form validation

validateFormOnSubmit ( )


This is a main function that calls a series of subfunctions, each of which checks a single form element for compliance. If the element complies than sufunction returns an empty string. Otherwise it returns a message describing the error and highlight appropriate element with yellow.

function validateFormOnSubmit(theForm) {
var reason = "";


reason += validateUsername(theForm.username);
reason += validatePassword(theForm.pwd);
reason += validateEmail(theForm.email);
reason += validatePhone(theForm.phone);
reason += validateEmpty(theForm.from);


if (reason != "") {
alert("Some fields need correction:\n" + reason);
return false;
}


return true;
}

validateEmpty ( )


The function below checks if a required field has been left empty. If the required field is blank, we return the error string to the main function. If it’s not blank, the function returns an empty string.

function validateEmpty(fld) {

var error = "";

if (fld.value.length == 0) {
fld.style.background = 'Yellow';
error = "The required field has not been filled in.\n"
} else {
fld.style.background = 'White';
}
return error;
}

validateUsername ( )


The function below checks if the user entered anything at all in the username field. If it’s not blank, we check the length of the string and permit only usernames that are between 5 and 15 characters. Next, we use the JavaScript regular expression /\W/ to forbid illegal characters from appearing in usernames. We want to allow only letters, numbers and underscopes.
function validateUsername(fld) {
var error = "";
var illegalChars = /\W/; // allow letters, numbers, and underscores


if (fld.value == "") {
fld.style.background = 'Yellow';
error = "You didn't enter a username.\n";
} else if ((fld.value.length < 5) || (fld.value.length > 15)) {
fld.style.background = 'Yellow';
error = "The username is the wrong length.\n";
} else if (illegalChars.test(fld.value)) {
fld.style.background = 'Yellow';
error = "The username contains illegal characters.\n";
} else {
fld.style.background = 'White';
}
return error;
}

validatePassword ( )


The function below checks the password field for blankness and allow only letters and numbers - no underscopes this time. So we should use a new regular expression to forbid underscopes. This one /[\W_]/ allow only letters and numbers. Next, we want to permit only passwords that contain letters and at least one numeral. For that we use the seacrh() method and two more regular expressions: /(a-z)+/ and /(0-9)/.
function validatePassword(fld) {
var error = "";
var illegalChars = /[\W_]/; // allow only letters and numbers

if (fld.value == "") {
fld.style.background = 'Yellow';
error = "You didn't enter a password.\n";
} else if ((fld.value.length < 7) || (fld.value.length > 15)) {
error = "The password is the wrong length. \n";
fld.style.background = 'Yellow';
} else if (illegalChars.test(fld.value)) {
error = "The password contains illegal characters.\n";
fld.style.background = 'Yellow';
} else if (!((fld.value.search(/(a-z)+/)) && (fld.value.search(/(0-9)+/)))) {
error = "The password must contain at least one numeral.\n";
fld.style.background = 'Yellow';
} else {
fld.style.background = 'White';
}
return error;
}

validateEmail ( )


Next we want to see if the email address the user entered is real. This means that the input data must contain at least an @ sign and a dot (.). Also, the @ must not be the first character of the email address, and the last dot must at least be one character after the @ sign.

At first we check if the user entered anything at all in the email field. Next, we use regular expression and the test() method to check the field for a compliance. Also we will use trim() function that will trim leading whitespace off the string. This won’t be perfect validation — it is possible to slip not compliant addresses by it — but it's normally good enough.
function trim(s)
{
return s.replace(/^\s+|\s+$/, '');
}
function validateEmail(fld) {
var error="";
var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;


if (fld.value == "") {
fld.style.background = 'Yellow';
error = "You didn't enter an email address.\n";
} else if (!emailFilter.test(tfld)) {              //test email for illegal characters
fld.style.background = 'Yellow';
error = "Please enter a valid email address.\n";
} else if (fld.value.match(illegalChars)) {
fld.style.background = 'Yellow';
error = "The email address contains illegal characters.\n";
} else {
fld.style.background = 'White';
}
return error;
}

validatePhone ( )


The function below checks if the phone number is valid. At first we use regular expression and the replace() method to clear out any spacer characters. Next, we use the isNaN() function to check if the phone number contain only numbers. At last we check the length of the string and permit only phone numbers with 10 digits.
function validatePhone(fld) {
var error = "";
var stripped = fld.value.replace(/[\(\)\.\-\ ]/g, '');



if (fld.value == "") {
error = "You didn't enter a phone number.\n";
fld.style.background = 'Yellow';
} else if (isNaN(parseInt(stripped))) {
error = "The phone number contains illegal characters.\n";
fld.style.background = 'Yellow';
} else if (!(stripped.length == 10)) {
error = "The phone number is the wrong length. Make sure you included an area code.\n";
fld.style.background = 'Yellow';
}
return error;
}

HTML Form


This script accompanies an HTML form. When the user clicks the Submit button on the form, the form data is sent to a JavaScript validation function that checks each field to make sure that it is in the appropriate format. The HTML form could look something like this:
<html>
<head>
<title>Kajal's blog - JavaScript Tutorial</title>
</head>
<body>
<h1>Kajal's blog- JavaScript Tutorial</h1>

<form name="demo" onsubmit="return validateFormOnSubmit(this)" action="test.htm">
<table summary="Demonstration form">
<tbody>
<tr>
<td><label for="username">Your user name:</label></td>
<td><input name="username" size="35" maxlength="50" type="text"></td>
</tr>
<tr>
<td><label for="pwd">Your password</label></td>
<td><input name="pwd" size="35" maxlength="25" type="password"></td>
</tr>
<tr>
<td><label for="email">Your email:</label></td>
<td><input name="email" size="35" maxlength="30" type="text"></td>
</tr>
<tr>
<td><label for="phone">Your telephone number:</label></td>
<td><input name="phone" size="35" maxlength="25" type="text"></td>
</tr>
<tr>
<td>
<label for="from">Where are you :</label></td>
<td><input name="from" size="35" maxlength="50" type="text"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input name="Submit" value="Send" type="submit" ></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</form>

</body>
</html>




Tuesday, January 12, 2010

addClass & removeClass in jquery



<style>
.red
{
background-color:#CC0033;
color:green;
font-weight:bold;
}
.green
{
background-color:#003300;
color:red;
font-weight:bold;
}
#myDiv
{
border:3px double #000000;
}
</style>
<script>
$(document).ready(function(){
$(“#addclass_red”).click(function ()
{
$(“#myDiv”).addClass(“red”);
$(“#myDiv”).removeClass(“green”);
});
$(“#addclass_green”).click(function ()
{
$(“#myDiv”).addClass(“green”);
$(“#myDiv”).removeClass(“red”);
});
});
</script>
<div id=”myDiv” style=”width:100px; height:30px;”>div 1</div>
<input type=”button” id=”addclass_red” name=”addclass_red” value=”Add Red” />
<input type=”button” id=”addclass_green” name=”addclass_green” value=”Add Green” />
when click on “Add Red” button the function add red class to div myDiv & removing the class green.

similarly, when click on “Add Green” button the function add greenclass to div myDiv & removing the class red.

Captcha using php


<form name=”form1″ method=”post” action=”form.php” “>
<table width=”342″ align=”center” cellspacing=”0″ bgcolor=”#D4D0C8″>
<tr>  <td align=”center”><img src=”php_captcha.php”></td>
<td align=”center”> Please enter the string shown in the image in the form.<br>
</td><td align=”center”>
<input name=”number” type=”text”></td><td><input name=”Submit” type=”submit”   value=”Submit”></td> </tr></table></form>


The <ima src=…> is given a page php_captcha.php. Lets create the page.

The following code use to create random numbers and this number are embedding with existing image file, the first line used to initiate session, which use to carry the user inputs.

<?php
session_start();
$RandomStr = md5(microtime());
$ResultStr = substr($RandomStr,0,5);
$NewImage =imagecreatefromjpeg(“img.jpg”);
?>
The second line [md5 (microtime ())] use to generate the random string, and the resultant string is trim by using third line [substr], which returns the portion of string specified by the start and length parameters.
The function imagecreatefromjpeg (“img.jpg”) is use to create a image by existing image file and as back ground ,so that you need to give an image file path.

<?php
$LineColor = imagecolorallocate($NewImage,233,239,239);
$TextColor = imagecolorallocate($NewImage, 255, 255, 255);
imageline($NewImage,1,1,40,40,$LineColor);
imageline($NewImage,1,100,60,0,$LineColor);
imagestring($NewImage, 5, 20, 10, $ResultStr, $TextColor);
?>
After creation of back ground image, we generate some linear line, which is use to avoid the phrasing from random numbers, the respective lines are create by the function named imageline () and imagestring () use to draw a random string horizontally.

<?php
$_SESSION['key'] = $ResultStr;
?>
The resultant random number [trimmed one], carry through session especially for validation purpose.

<?php
header(“Content-type: image/jpeg”);
imagejpeg($NewImage);
?>
Finally above two functions are uses to display/out put the image to browser. So we can just call the particular file by through image source path, it will display the final image.

<?php
if(isset($_REQUEST['Submit'])){
$key=substr($_SESSION['key'],0,5);
$number = $_REQUEST['number'];
if($number!=$key){
echo ‘ Validation string not valid! Please try again!’;}
else{
echo ‘ Your string is valid!’;}
}
?>

Code for active primary link in drupal.

In the page template.php in sites/all/themes/yourthemes paste the following codes:

function new_primary_links($start_level = 1, $pid = 0) {
if (!module_exists('menu')) {
return NULL;
}
if (!$pid) {
$pid = variable_get('menu_primary_menu', 0);
}
if (!$pid) {
return NULL;
}
if ($start_level < 1) {
$start_level = 1;
}
if ($start_level > 1) {
$trail = _menu_get_active_trail_in_submenu($pid);
if (!$trail) {
return NULL;
}
else {
$pid = $trail[$start_level - 1];
}
}
$menu = menu_get_menu();
$links = array();
if ($pid && is_array($menu['visible'][$pid]) && isset($menu['visible'][$pid]['children'])) {
$count = 1;
foreach ($menu['visible'][$pid]['children'] as $cid) {
$index = "menu-$start_level-$count-$pid";
if (menu_in_active_trail_in_submenu($cid, $pid)) {
$index .= "-active active"; // **** HERE'S THE CHANGE
}
$links[$index] = menu_item_link($cid, FALSE);
$count++;
}
}
return $links;
}


After that,in page.tpl.php paste the following codes:

<?php
print theme('links', $primary_links);
?>


For more help: http://drupal.org/

Monday, January 11, 2010

Code for Building a .info File in drupal

As of Drupal 6, a .info file is required as part of a valid theme distribution. The
.info file contains a number of pieces of information intended to inform the system about the theme and to set configuration options. The syntax throughout this file is consistent, use key = value. Semicolons can be used to add comments or commentout options. In the event that optional values are not stated, the system will assume default values.
To get started, open up the .info file you created a short while ago and add
the following:First, a name key is required by the system. Note this is a human-readable value. Forour theme, this entry will appear as follows:
name = kajal
Next, let's add a description. This data will appear in Drupal's theme manager
alongside the theme name and screenshot. This key is optional but as it is very helpful, we're going to include some information here:
description = A simple theme for Drupal.
The core key is required to keep the system from disabling our theme due to
incompatibility.
core = 6.x
Add the engine key as follows (in the absence of this key, the system will assume this is a pure PHP theme):
engine = phptemplate
The regions key sets the regions available for block assignment. Note that this key is not necessary unless you wish to vary from the default set of regions. We've included the regions keys information in this example simply to show the variation in syntax that is required by this key. To set regions, use the following notation:
region[machine_readable_name] = human readable name, for example:
region[head] = Head
region[left] = Left Sidebar
region[right] = Right Sidebar
region[content] = Content
region[footer] = Footer

The .info file can be also used to enable the various theme configuration features, like the site mission, site name, logo, etc. To specify features use the syntax features[] = name of feature. In the absence of a contrary definition, the system will assume the presence of all the following:
features[] = logo
features[] = name
features[] = slogan
features[] = mission
features[] = node_user_picture
features[] = comment_user_picture
features[] = search
features[] = favicon
features[] = primary_links
features[] = secondary_links

Should you not want any of these features, simply delineate the ones you wish to see in the .info file and omit the ones you do not wish to see. As we want to enable all the default features, we need to add nothing to our .info file. In this fashion, the system will enable all the default features, above, giving our site administrator the widest number of configurations for Kajal.

With all the options above (and more), .info files can be quite lengthy. The
garland.info file (themes/garland/garland.info) for example, shows a relatively complex .info file. However, given our new theme's heavy reliance on default values, our .info file will be short and sweet:
name = Kajal
description = A simpletheme for Drupal.
core = 6.x
engine = phptemplate

Code for footer in Drupal.

Though the author only declared two regions, left and right, he includes the
footer region in the code. This provides us with a good example of the function chameleon_regions() in action. The function defines which regions will be available for the administrator to use for the assignment of blocks. In this case, only left and right are options for the administrator, despite the presence of the footer region in the code. Had the function chameleon_regions() been written so as to include 'footer' => t('footer'), then the region would be accessible to the administrator for block assignment. As it stands, however, the only output of the code below is the footer message, wrapped with a div.
if ($footer = variable_get('site_footer', '')) {
$output .= " <div id=\"footer\">$footer</div>\n";
}

Code for Title and Breadcrumb Trail in Drupal

The author places the title and breadcrumb together on the page and makes both subject to the appearance of the title; the title is also wrapped with the<h2> tag.
if ($title) {
$output .= theme("breadcrumb", drupal_get_breadcrumb());
$output .= "<h2>$title</h2>";
}

Code for side bar right in Drupal.

This snippet places the blocks designated for the right region into a table cell. Note the conditional statement; this allows the output to be hidden in the event that no blocks are assigned to the region. For styling, the table cell (td) is given an id name to reflect the placement (sidebar-right).

if ($show_blocks && !empty($blocks_right)) {
$output .= " <td id=\"sidebar-right\">$blocks_right</td>\n";
}

Code for side bar left in drupal

The following places the blocks designated for the left region into a table cell. Note the conditional statement; this allows the output to be hidden in the event that no blocks are assigned to the region. For styling, the table cell (td) is given an id name to reflect the placement (sidebar-left).

if ($show_blocks && !empty($blocks_left)) {
$output .= " <td id=\"sidebar-left\">$blocks_left</td>\n";
}