Showing posts with label infosys. Show all posts
Showing posts with label infosys. Show all posts

Tuffest PHP Interview Questions And Answers

0 comments Posted by Unknown at 01:42
What Are the Options to Transfer Session IDs?
Once a new session is created, its session ID must be transferred to the client browser and included in the next client request, so that the PHP engine can find the same session created by the same visitor. The PHP engine has two options to transfer the session ID to the client browser:
  • As URL parameter - The Session ID will be embedded in all URLs in the HTML document delivered to the client browser. When the visitor clicks any of those URLs, the session ID will be returned back to the Web server as part of the requesting URL.
  • As a cookie - The session ID will be delivered as a cookie to the client browser. When visitor requests any other pages on the Web server, the session ID will be returned back to the Web server also as a cookie.
The PHP engine is configured to use URL parameters for transferring session IDs by default.

Read More »

Advanced PHP questions and answers

0 comments Posted by Unknown at 01:26
How To Test Cookies on a Web Server?
If you want to test cookies with a browser, you need to run a Web server locally, or have access to a Web server remotely. Then you can copy the following PHP cookie test page, setting_receiving_cookies.php, to the Web server:
<?php
  setcookie("LoginName","PICKZYCenter");
  setcookie("PreferredColor","Blue");
  print("<pre>\n");
  print("2 cookies were delivered.\n");
 
  if (isset($_COOKIE["LoginName"])) {
    $loginName = $_COOKIE["LoginName"];
    print("Received a cookie named as LoginName: ".$loginName."\n");
  } else {
    print("Did not received any cookie named as LoginName.\n");
  }
 
  $count = count($_COOKIE);
  print("$count cookies received.\n");
  foreach ($_COOKIE as $name => $value) {
     print "  $name = $value\n";
  }
  print("</pre>\n");
?>
Read More »

Job interview Questions in PHP

0 comments Posted by Unknown at 00:51

What Are the Special Characters You Need to Escape in Single-Quoted Stings?
There are two special characters you need to escape in a single-quote string: the single quote (') and the back slash (\). Here is a PHP script example of single-quoted strings:
<?php 
echo 'Hello world!'; 
echo 'It\'s Friday!'; 
echo '\\ represents an operator.'; 
?>
This script will print:
Hello world!It's Friday!\ represents an operator.
Can You Specify the "new line" Character in Single-Quoted Strings?
You can not specify the "new line" character in a single-quoted string. If you don't believe, try this script:
<?php 
echo '\n will not work in single quoted strings.'; 
?>
This script will print:
\n will not work in single quoted strings.

How Many Escape Sequences Are Recognized in Single-Quoted Strings?
There are 2 escape sequences you can use in single-quoted strings:
  • \\ - Represents the back slash character.
  • \' - Represents the single quote character.

Read More »

Infosys Solved Questions

0 comments Posted by Unknown at 14:27

Infosys Solved Questions

1.What will be the output of the following code?
void main ()
{ int i = 0 , a[3] ;
a[i] = i++;
printf (“%d",a[i]) ;
}
Ans: The output for the above code would be a garbage value. In the statement a[i] = i++; the value of the variable i would get assigned first to a[i] i.e. a[0] and then the value of i would get incremented by 1. Since a[i] i.e. a[1] has not been initialized, a[i] will have a garbage value.
-------------------------------------------------------------------------------------------------
Read More »

C Questions

0 comments Posted by Unknown at 19:16

Interview Questions in c

Note : All the programs are tested under Turbo C/C++ compilers. 
It is assumed that,
Ø  Programs run under DOS environment,
Ø  The underlying machine is an x86 system,
Ø  Program is compiled using Turbo C/C++ compiler.
The program output may depend on the information based on this assumptions (for example sizeof(int) == 2 may be assumed).

Predict the output or error(s) for the following:

1.      void main()
{
            int  const * p=5;
            printf("%d",++(*p));
}
Read More »

Depth in c

0 comments Posted by Unknown at 19:24
What will be output if you will compile and execute the following c code?
#include<stdio.h>
int main(){
printf("%s",__DATE__);
return 0;
}
(a) Current system date
(b) Current system date with time
(c) null
(d) Compiler error
(e) None of these
Answer: (a)
Explanation:
__DATE__ is global identifier which returns current system date.

Read More »
 

© 2011. All Rights Reserved | Interview Questions | Template by Blogger Widgets

Home | About | Top