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]