Friday, August 29, 2008

PHP

1. In PHP, if $x = 'Sunil' what is the output from "echo 'Hello $x'" ?

Ans : Hello $x

2. What value is $x in this PHP section of code "function foo ($i) {
return ((($i*2)-3)%3); } $x = foo(6);"

Ans : 0

3. In PHP, what is the value of $x when '$x = 10 - "2 elephants";'

Ans : 8

4. In PHP, if $a is TRUE and $b is TRUE, what is ($a xor $b)?.

Ans : True

5. What will the output of this PHP code be 'function x () { function y()
{ return "y"; } return "x"; } echo y();'

Ans: Fatal error: Call to undefined function: y()

6. If table x has an integer column y and there are three rows in the
table with values 45, 34 and 1, what is the output of this MySQL
statement "select count(*), count(y), sum(y), min(y), round(avg(y),2) from x;"

Ans : 3 3 80 1 26.67

7. With a table x (y int(10), z int(10)) having data of 1 1, 2 1, 3 4, 4
2, 5 1 (where first number is y, second number is z (there are 5 rows
of data)), what is the output of this MySQL statement "select count(y)
from x group by z having count(y) > 1;"

Ans: 4


8. What is the MySQL output of this statement "select
date_add('2004-10-11',interval -2 month);"

Ams: 2004-08-11




9. If the current date/time is 2004-10-14 13:05:34, what would be the output of the MySQL statement "select date_format(sysdate(),'%b-%Y-%d-%i');"

ANS :October-2004-14-13

10 . If $x = 7, what would the output be from this PHP statement:
if ($x < 2) { echo "1"; }
elseif ($x < 6) { echo "2"; }
elseif ($x < 4) { echo "3"; }
elseif ($x > 4) { echo "4"; }
elseif ($x < 10) { echo "5"; }
else { echo "6"; }

Ans : 4

11 . In PHP, given an array of words, create a function called separate_out() that returns
the contents of the array in a string separated by a specified character

ANS : function separate_out($array) {
$separate=implode(",",$array);
return $separate;
}

12..What result would appear if this sql statement is processed in
MySQL, "select 'Sunil' like 'S_n%';"

Ans: Don’t know ? We think “False “



13. Question of function show me the money ?

function show_me the_money($money){
$a=round($money,3);
echo $a;
}


14 . Purpose of global statement in context function ?

ANS : Global variable will have the scope outside the function , if the value of this variable is changed in this function this will be the same outside the function.





15.Question of Fruit , Vegitables Ice cream ?
ANS :
function check($a,$b){
$result=array_diff_assoc($a,$b);
$c=array_reverse($b);
$result2=array_diff_assoc($a,$c);
$count=count($result);
$count2=count($result2);
if($count==0){
return Fruit;
}
elseif($count2==0)
return vegetable;
else{
return icecream;}
}
}



16 .Qestion to display Hello to out put olleh ?

ANS : function reverse($hello){
$a = strrev("Hello");
echo $a;
}

17 . Create some PHP code that reads from a flat file the MySQL username,
password and database and connects to the database. The flat file is
called 'connect.txt', it has three lines in it. Line 1 is the database,
line 2 is the username and line 3 is the password. Please note, the flat
file is not a PHP file.

ANS : $handle=file.open(connect.txt);
$db=fgtes($handle); $user=fgtes($handle); $pwd=fgtes($handle);
$dbConnect = mysql_pconnect("localhost", "$user ", "$pwd ");
mysql_select_db("$db ", $dbConnect);

18. Write a PHP function that escapes single quotes in a string (e.g.
input: Sunil's output Sunil\'s). The function is called
escape_for_database(). You cannot use the addslashes() function.

ANS : function escape_for_database($escape){
$x = str_replace("’", "\’", $x);
echo $x
}

19. Command for search criteria to find the lines within the Mercury file in linux ?

ANS : Find …..

20. If you change a file's permissions to chmod 755 in Linux, what kind
of permissions are assigned to the group that owns the file?

ANS : readonly

21 . Which of the following commands would quit a vi session without saving changes to the file?

ANS : q!

22. Finding comand for string in text file ?

ANS: grep .

23. Command for display process in linux.

ANS : ps and top

24. Which command will display the last lines of the text file called file1?

ANS : last answer in question

25. In Linux, how do you force a particular process to stop executing?

Ans : KILL

26. What kind of files are found in the /usr directory?

ANS : User home directories

27. To find command for finding three letter linux directory …. Question not full

ANS : *y

28 .If a file has permissions of 777 in Linux it means:

ANS : All of the above

29 . ANS : limit - fait - foal




30. Afish has head 9. tail equals size of head plus size of body .
The body is the size of head plus tail . how long the fish ? --

ANS: 72 units

31. Smitha had a number of cookies. After eating one, she gave half the
remainder to her sister. After eating another cookie, she gave half of
what was left to her brother. Smitha now had only five cookies left.
How many cookies did she start with?

Ans : 23

32. How many minutes before 9AM is it if 90 minutes later it will be 45
minutes to 11AM?

Ans : 15Minuts

33. All Worgs are Tworps and no Tworps are Smeeguls, then no Smeeguls are Worgs. The statement is:?

Ans : False

34 . Dresser …………
Ans : wear

35 . If the day before two days after the day before tomorrow is Monday, what day is today?

Ans : wnesday

36. Complete the sequence: 2,3,5,8,13,21,34,55,____

ANS :89

37. Two girls caught 25 frogs. Lali caught four times as many as Amrita.
How many frogs did Amrita catch?

ANS: 5

38. Continue the pattern: B G D L F Q ____

ANS : H

39 . A cynic is one who knows the price of everything and the _______ of nothing.

ANS : Value

40 . The price of an article was cut 20% for a sale. By what percent must the item be
increased to again sell the article at the original price?

ANS : 25%

41. You are contacted by a client who requires support for certain
services which is not offered by your company. Also you are aware that this
client is one of the long term client of your company. What do you
think would be the best way to handle this situation and draft a complete
reply to the customer.

Sir,
We are happy to extend these services to you. But as such we are not handling these type of services mentioned by you but as you are one of our esteem client, we would try to find out another possible way to find a solution to the services mentioned by you and get back to you in a day or two.
Thanking you,
Name.

42. While working on the server you accidentally deleted certain files
which are owned by the customer. Later you are contacted by the client
and he complains his files are missing. What do you think would be the
best way to handle this situation draft a complete reply to the customer.

Sir,
I was unaware of the fact that there were certain files which was provided by you were missing.
I will personally look into this matter. Can you please provide me a copy of the files which were missing,
so that if i could'nt find it, I may do the work with the backup file.
Thanking you,
Name.

43 .What is the connection implimentation of PHP/HTML interface ?

SRS Preparation
System Study
Database Designe
Interface Design
Connection & required coding
Testing
Implimentation

44. Falicious argument ?

ANS : FALSE

45. What number is one half of one quarter of one tenth of 800?

ANS : 10



46. Which number should come next? 144, 121, 100, 81, 64………

ANS :49

47 . Pinaple eaten …… ?

ANS : 5

48. Shaiju is shorter than Anil, but she is taller than Anup. Renjith is shorter than Anil, and shorter than Anup. Raj is taller than Renjith, but shorter than Anil. If the statements above are true, one can validly conclude that Sathish is shorter than Shaiju if it is true that:

ANS : Raj is taller than Sathish, but shorter than Anup


49 . Raj is taller than Anup, and Brijesh is shorter than Raj. Which of the following statements would be most accurate?

ANS : It is impossible to tell whether Brijesh or Anup is taller

50. Assume that these two statements are true: All brown-haired men have bad tempers. Harry is a brown-haired man. The statement that Harry has a bad temper is:

ANS : TRUE

51 . Krishna, twelve years old, is three times as old as his brother. How old will Krishna be when
he is twice as old as his brother?

ANS :: 16

52 Shaiju is shorter than Anil, but she is taller than Anup. Renjith is shorter than Anil, and shorter than Anup. Raj is taller than Renjith, but shorter than Anil. If the statements above are true, one can validly conclude that Sathish is shorter than Shaiju if it is true that:

ANS : Raj is taller than Sathish, but shorter than Anup


53:Under the school administration's ________ rule, the students didn't dare misbehave.

ANS : draconian
54 . Consider the scenario, where you have made a mistake, say you have configured
everything correctly and have responded to the client that you have solved the
problem but unfortunately have forgotten to restart the required services and the client has written back angrily. What do you think would be the best way to handle his situation and please write a complete reply to customer.

Dear Customer ,
We are really sorry for the mistake that have occured , now we solved the
problem and never repeat it again. Now the Software will work properlly.

Thanking You
Regards Company Name

55. You are contacted by an annoyed customer who complains about a recent outage of your
service and mentions that he has lost many business contracts, just because your
company didn't have a disaster recovery policies. What do you think would be the best
way to handle this situation?

Dear Customer ,

We apologize for the inconvenience caused for you , and assure that we will
make all possible remedial measures to alleviate the problem you are currently facing.


Thanking You
Regards Company Name


Dear Mr Sunil, I am not sure if we should proceed with the client's instructions. Please ______.

The benefits of computer games ___beat__ the negative aspects.

I need some money'. 'Ok, _____ you some

Even the most __Ugly______ rose has thorns

The pure and simple truth is rarely pure and never ___Simple____










We are waiting always a long time for the bus.
Gurantee

1 comment:

@devaram said...

Hi Lubina,
I think some of your answers are incorrect. Please make sure that your answer is correct or not.