| 0 comments ]

Optimized with RankingToday.com

| 1 comments ]






INTERVIEW QUESTIONS




INTERVIEW QUESTIONS












TOP

Java Interview Questions




Q: Describe synchronization in respect to multithreading.


A: With respect to multithreading, synchronization is the capability to control the
access of multiple threads to shared resources. Without synchonization, it is possible
for one thread to modify a shared variable while another thread is in the process of
using or updating same shared variable. This usually leads to significant errors.



Q: What if the main method is declared as private?



A: The program compiles properly but at runtime it will give
"Main method not public."message.
[ Received from Sandesh Sadhale]



Q: What if the static modifier is removed from the signature of the main method?



A: Program compiles. But at runtime throws an error "NoSuchMethodError".

[ Received from Sandesh Sadhale]



Q: What if I write static public void instead of public static void?



A: Program compiles and runs properly.

[ Received from Sandesh Sadhale]



Q: What if I do not provide the String array as the argument to the method?



A: Program compiles but throws a runtime error "NoSuchMethodError".

[ Received from Sandesh Sadhale]



Q: What is the first argument of the String array in main method?



A: The String array is empty. It does not have any element. This is unlike
C/C++ where the first element by default is the program name.

[ Received from Sandesh Sadhale]



Q: If I do not provide any arguments on the command line, then
the String array of Main method will be empty or null?



A: It is empty. But not null.

[ Received from Sandesh Sadhale]



Q: How can one prove that the array is not null but empty using one
line of code?



A: Print args.length. It will print 0. That means it is empty.
But if it would have been null then it would have thrown a NullPointerException on
attempting to print args.length.
[ Received from Sandesh Sadhale]



Q: What environment variables do I need to set on my machine in order to
be able to run Java programs?



A: CLASSPATH and PATH are the two variables.

[ Received from Sandesh Sadhale]



Q: Can an application have multiple classes having main method?



A: Yes it is possible. While starting the application we mention the class name
to be run. The JVM will look for the Main method only in the class
whose name you have mentioned. Hence there is not conflict amongst
the multiple classes having main method.
[ Received from Sandesh Sadhale]



Q: Can I have multiple main methods in the same class?



A: No the program fails to compile. The compiler says that the main method is
already defined in the class.
[ Received from Sandesh Sadhale]



Q: Do I need to import java.lang package any time? Why ?



A: No. It is by default loaded internally by the JVM.

[ Received from Sandesh Sadhale]



Q: Can I import same package/class twice? Will the JVM load the package
twice at runtime?


A: One can import the same package or same class multiple times.
Neither compiler nor JVM complains abt it. And the JVM will internally load
the class only once no matter how many times you import
the same class.
[ Received from Sandesh Sadhale]



Q: What are Checked and UnChecked Exception?



A: A checked exception is some subclass of Exception (or Exception itself),
excluding class RuntimeException and its subclasses.
Making
an exception checked forces client programmers to deal with the possibility
that the exception will be thrown. eg, IOException thrown by java.
io.FileInputStream's read() method·

Unchecked exceptions are RuntimeException and any of its subclasses.
Class Error and its subclasses also are unchecked. With an unchecked exception,
however, the compiler doesn't force client programmers either
to catch the
exception or declare it in a throws clause. In fact, client
programmers may not even know that the exception could be thrown.
eg, StringIndexOutOfBoundsException thrown by String's charAt() method·
Checked exceptions must be caught at compile time. Runtime exceptions do
not need to be. Errors often cannot be.




Q: What is Overriding?



A: When a class defines a method using the same name, return type, and arguments
as a method in its superclass, the method in the class overrides
the method in the superclass.
When the method is invoked for an object of the class,
it is the new definition of the method that is called, and not the
method definition from superclass. Methods may be overridden to be more
public, not more private.




Q: What are different types of inner classes?



A: Nested top-level classes, Member classes, Local classes, Anonymous classes


Nested top-level classes- If you declare a class within a class and specify
the static modifier, the compiler treats the class just like any other
top-level class.
Any class outside the declaring class accesses the nested class
with the declaring class name acting similarly to a package. eg, outer.inner.
Top-level inner classes implicitly have access only to static variables.
There can also be inner interfaces. All of these are of the nested
top-level variety.

Member classes - Member inner classes are just like other member
methods and member variables and access to the member class is restricted,
just like methods and variables. This means a public member class acts similarly
to a nested top-level class. The primary difference between member classes and
nested top-level classes is that member classes have access to the specific
instance of the enclosing class.

Local classes - Local classes are like local variables,
specific to a block of code. Their visibility is only within the block of their declaration.
In order for the class to be useful beyond the declaration block,
it would need to implement a
more publicly available interface.Because local
classes are not members, the modifiers public, protected, private,
and static are not usable.


Anonymous classes - Anonymous inner classes extend local inner classes one level
further. As anonymous classes have no name, you cannot provide a constructor.






Q: What is the difference between an Interface and an Abstract class?


A: An abstract class can have instance methods that implement a default behavior. An
Interface can only declare constants and instance methods, but cannot implement
defaultbehavior and all methods are implicitly abstract. An interface has all public
members and no implementation. An abstract class is a class which may have the usual
flavors of class members (private, protected, etc.), but has some abstract methods.




Q: What is the purpose of garbage collection in Java, and when is it used?


A: The purpose of garbage collection is to identify and discard objects that are no
longer needed by a program so that their resources can be reclaimed and reused. A Java
object is subject to garbage collection when it becomes unreachable to the program in
which it is used.






Q: Explain different way of using thread?


A: The thread could be implemented by using runnable interface or by inheriting from the
Thread class. The former is more advantageous, 'cause when you are going for multiple
inheritance..the only interface can help.




Q: What are pass by reference and passby value?


A: Pass By Reference means the passing the address itself rather than passing the value.
Passby Value means passing a copy of the value to be passed.




Q: What is HashMap and Map?


A: Map is Interface and Hashmap is class that implements that.




Q: Difference between HashMap and HashTable?


A: The HashMap class is roughly equivalent to Hashtable, except that it is
unsynchronized and permits nulls. (HashMap allows null values as key and value whereas
Hashtable doesnt allow). HashMap does not guarantee that the order of the map will
remain constant over time. HashMap is unsynchronized and Hashtable is synchronized.




Q: Difference between Vector and ArrayList?


A: Vector is synchronized whereas arraylist is not.




Q: Difference between Swing and Awt?


A: AWT are heavy-weight componenets. Swings are light-weight components.
Hence swing works faster than AWT.




Q: What is the difference between a constructor and a method?


A: A constructor is a member function of a class that is used to create objects of that
class. It has the same name as the class itself, has no return type, and is invoked using
the new operator.
A method is an ordinary member function of a class. It has its own name,
a return type (which may be void), and is invoked using the dot operator.




Q: What is an Iterator?


A: Some of the collection classes provide traversal of their contents via a
java.util.Iterator interface. This interface allows you to walk through a collection of
objects, operating on each object in turn. Remember when using Iterators that they
contain a snapshot of the collection at the time the Iterator was obtained; generally it
is not advisable to modify the collection itself while traversing an Iterator.




Q: State the significance of public, private, protected, default modifiers both singly
and in combination and state the effect of package relationships on declared items
qualified by these modifiers.


A: public : Public class is visible in other packages, field is visible everywhere
(class must be public too)

private : Private variables or methods may be used only by an instance of the same class
that declares the variable or method, A private feature may only be accessed by the
class that owns the feature.

protected : Is available to all classes in the same package and also available to all
subclasses of the class that owns the protected feature.This access is provided even to
subclasses that reside in a different package from the class that owns the protected feature.

default :What you get by default ie, without any access modifier (ie, public private or
protected).It means that it is visible to all within a particular package.




Q: What is an abstract class?


A: Abstract class must be extended/subclassed (to be useful). It serves as a template.
A class that is abstract may not be instantiated (ie, you may not call its constructor),
abstract class may contain static data. Any class with an abstract method is
automatically abstract itself, and must be declared as such.

A class may be declared abstract even if it has no abstract methods. This prevents it
from being instantiated.




Q: What is static in java?


A: Static means one per class, not one for each object no matter how many instance of a
class might exist. This means that you can use them without creating an instance of a
class.Static methods are implicitly final, because overriding is done based on the type
of the object, and static methods are attached to a class, not an object.
A static
method in a superclass can be shadowed by another static method in a subclass, as long
as the original method was not declared final. However, you can't override a static
method with a nonstatic method. In other words, you can't change a static method into an
instance method in a subclass.




Q: What is final?


A: A final class can't be extended ie., final class may not be subclassed. A final
method can't be overridden when its class is inherited. You can't change value of a
final variable (is a constant).






























Q: Are the imports checked for validity at compile time? e.g. will the code
containing an import such as java.lang.ABCD compile?



A: Yes the imports are checked for the semantic validity at compile time. The code
containing above line of import will not compile. It will throw an error saying,
can not resolve symbol

symbol : class ABCD

location: package io

import java.io.ABCD;

[ Received from Sandesh Sadhale]



Q: Does importing a package imports the subpackages as well? e.g. Does importing
com.MyTest.* also import com.MyTest.UnitTests.*?



A: No you will have to import the subpackages explicitly. Importing com.MyTest.
* will import classes in the package MyTest only.
It will not import any class in any of it's subpackage.

[ Received from Sandesh Sadhale]



Q: What is the difference between declaring a variable and defining a variable?



A: In declaration we just mention the type of the variable and it's name. We do not
initialize it. But defining means declaration + initialization.

e.g String s; is just a declaration while String s = new String ("abcd");
Or String s = "abcd"; are both definitions.

[ Received from Sandesh Sadhale]



Q: What is the default value of an object reference declared as an instance
variable?


A: null unless we define it explicitly.

[ Received from Sandesh Sadhale]



Q: Can a top level class be private or protected?



A: No. A top level class can not be private or protected. It can have either
"public" or no modifier. If it does not have a modifier it is supposed to have a
default access.If a top level class is declared as private the compiler will complain
that the "modifier private is not allowed here". This means that a top level
class can not be private. Same is the case with protected.

[ Received from Sandesh Sadhale]



Q: What type of parameter passing does Java support?



A: In Java the arguments are always passed by value .

[ Update from Eki and Jyothish Venu]



Q: Primitive data types are passed by reference or pass by value?



A: Primitive data types are passed by value.

[ Received from Sandesh Sadhale]



Q: Objects are passed by value or by reference?



A: Java only supports pass by value. With objects, the object reference itself
is passed by value and so both the original reference and parameter copy both
refer to the same object .

[ Update from Eki and Jyothish Venu]



Q: What is serialization?



A: Serialization is a mechanism by which you can save the state of an object by
converting it to a byte stream.

[ Received from Sandesh Sadhale]



Q: How do I serialize an object to a file?



A: The class whose instances are to be serialized should implement an interface
Serializable. Then you pass the instance to the ObjectOutputStream which is
connected to a fileoutputstream. This will save the object to a file.

[ Received from Sandesh Sadhale]



Q: Which methods of Serializable interface should I implement?



A: The serializable interface is an empty interface, it does not contain any
methods. So we do not implement any methods.

[ Received from Sandesh Sadhale]



Q: How can I customize the seralization process? i.e. how can one have a control
over the serialization process?



A: Yes it is possible to have control over serialization process. The class should
implement Externalizable interface. This interface contains two methods namely
readExternal and writeExternal. You should implement these methods and write the
logic for customizing the serialization process.

[ Received from Sandesh Sadhale]



Q: What is the common usage of serialization?



A: Whenever an object is to be sent over the network, objects need to be serialized.
Moreover if the state of an object is to be saved, objects need to be serilazed.

[ Received from Sandesh Sadhale]



Q: What is Externalizable interface?



A: Externalizable is an interface which contains two methods readExternal and
writeExternal. These methods give you a control over the serialization mechanism.
Thus if your class implements this interface, you can customize the serialization
process by implementing these methods.

[ Received from Sandesh Sadhale]



Q: When you serialize an object, what happens to the object references included
in the object?



A: The serialization mechanism generates an object graph for serialization. Thus it
determines whether the included object references are serializable or not. This is a
recursive process. Thus when an object is serialized, all the included objects are
also serialized alongwith the original obect.

[ Received from Sandesh Sadhale]



Q: What one should take care of while serializing the object?



A: One should make sure that all the included objects are also serializable.
If any of the objects is not serializable then it throws a NotSerializableException.

[ Received from Sandesh Sadhale]



Q: What happens to the static fields of a class during serialization?



A: There are three exceptions in which serialization doesnot necessarily read
and write to the stream. These are

1. Serialization ignores static fields, because they are not part of ay particular state.

2. Base class fields are only hendled if the base class itself is serializable.

3. Transient fields.


[ Received from Sandesh Sadhale Modified after P.John David comments.]


















Q: Does Java provide any construct to find out the size of an object?



A: No there is not sizeof operator in Java. So there is not direct way to
determine the size of an object directly in Java.

[ Received from Sandesh Sadhale]



Q: Give a simplest way to find out the time a method takes for execution without
using any profiling tool?



A: Read the system time just before the method is invoked and immediately after method
returns. Take the time difference, which will give you the time taken by a method for
execution.
To put it in code...


long start = System.currentTimeMillis ();

method ();

long end = System.currentTimeMillis ();


System.out.println ("Time taken for execution is " + (end - start));


Remember that if the time taken for execution is too small, it might show that it is
taking zero milliseconds for execution. Try it on a method which is big enough, in
the sense the one which is doing considerable amout of processing.


[ Received from Sandesh Sadhale]



Q: What are wrapper classes?



A: Java provides specialized classes corresponding to each of the primitive data types.
These are called wrapper classes. They are e.g. Integer, Character, Double etc.

[ Received from Sandesh Sadhale]



Q: Why do we need wrapper classes?



A: It is sometimes easier to deal with primitives as objects. Moreover most of the
collection classes store objects and not primitive data types. And also the wrapper
classes provide many utility methods also. Because of these resons we need wrapper
classes. And since we create instances of these classes we can store them in any of
the collection classes and pass them around as a collection. Also we can pass
them around as method parameters where a method expects an object.

[ Received from Sandesh Sadhale]



Q: What are checked exceptions?



A: Checked exception are those which the Java compiler forces you to catch. e.g.
IOException are checked Exceptions.

[ Received from Sandesh Sadhale]



Q: What are runtime exceptions?



A: Runtime exceptions are those exceptions that are thrown at runtime because of
either wrong input data or because of wrong business logic etc. These are not checked
by the compiler at compile time.

[ Received from Sandesh Sadhale]



Q: What is the difference between error and an exception?



A: An error is an irrecoverable condition occurring at runtime. Such as OutOfMemory
error. These JVM errors and you can not repair them at runtime. While exceptions are
conditions that occur because of bad input etc. e.g. FileNotFoundException will be
thrown if the specified file does not exist. Or a NullPointerException will
take place if you try using a null reference. In most of the cases it is possible
to recover from an exception (probably by giving user a feedback for entering
proper values etc.).
[ Received from Sandesh Sadhale]



Q: How to create custom exceptions?



A: Your class should extend class Exception, or some more specific type thereof.

[ Received from Sandesh Sadhale]



Q: If I want an object of my class to be thrown as an exception object,
what should I do?



A: The class should extend from Exception class. Or you can extend your class
from some more precise exception type also.

[ Received from Sandesh Sadhale]



Q: If my class already extends from some other class what should I do if I want an
instance of my class to be thrown as an exception object?



A: One can not do anytihng in this scenarion. Because Java does not allow multiple
inheritance and does not provide any exception interface as well.

[ Received from Sandesh Sadhale]



Q: How does an exception permeate through the code?



A: An unhandled exception moves up the method stack in search of a matching When an
exception is thrown from a code which is wrapped in a try block followed by one
or more catch blocks, a search is made for matching catch block. If a matching
type is found then that block will be invoked. If a matching type is not
found then the exception moves up the method stack and reaches
the caller method. Same procedure is repeated if the caller method is included
in a try catch block. This process continues until a catch block handling
the appropriate type of exception is found. If it does not find such a block then
finally the program terminates.

[ Received from Sandesh Sadhale]



Q: What are the different ways to handle exceptions?



A: There are two ways to handle exceptions,

1. By wrapping the desired code in a try block followed by a catch block to catch
the exceptions. and

2. List the desired exceptions in the throws clause of the method and let the
caller of the method hadle those exceptions.

[ Received from Sandesh Sadhale]



Q: What is the basic difference between the 2 approaches to exception handling.


1> try catch block and

2> specifying the candidate exceptions in the throws clause?

When should you use which approach?


A: In the first approach as a programmer of the method, you urself are dealing with
the exception. This is fine if you are in a best position to decide should be done
in case of an exception. Whereas if it is not the responsibility of the method to
deal with it's own exceptions, then do not use this approach. In this case use
the second approach. In the second approach we are forcing the caller of the
method to catch the exceptions, that the method is likely to throw. This is
often the approach library creators use. They list the exception in the throws
clause and we must catch them. You will find the same approach throughout
the java libraries we use.

[ Received from Sandesh Sadhale]



Q: Is it necessary that each try block must be followed by a catch block?



A: It is not necessary that each try block must be followed by a catch block.
It should be followed by either a catch block OR a finally block. And whatever
exceptions are likely to be thrown should be declared in
the throws clause of the method.

[ Received from Sandesh Sadhale]



Q: If I write return at the end of the try block, will the finally block still execute?



A: Yes even if you write return as the last statement in the try block and no
exception occurs, the finally block will execute. The finally block will
execute and then the control return.

[ Received from Sandesh Sadhale]



Q: If I write System.exit (0); at the end of the try block, will the finally
block still execute?



A: No in this case the finally block will not execute because when you say System.
exit (0); the control immediately goes out of the program, and thus finally never
executes.

[ Received from Sandesh Sadhale]






ORACLE Interview Questions



          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          





TOP











1. To see current user name


Sql> show user;



2. Change SQL prompt name


SQL> set sqlprompt “Manimara > “

Manimara >

Manimara >



3. Switch to DOS prompt


SQL> host



4. How do I eliminate the duplicate rows ?


SQL> delete from table_name where rowid not in (select max(rowid) from table group by
duplicate_values_field_name);

or

SQL> delete duplicate_values_field_name dv from table_name ta where rowid <(select
min(rowid) from table_name tb where ta.dv=tb.dv);

Example.

Table Emp

Empno Ename

101 Scott

102 Jiyo

103 Millor

104 Jiyo

105 Smith

delete ename from emp a where rowid < ( select min(rowid) from emp b where a.ename =
b.ename);

The output like,

Empno Ename

101 Scott

102 Millor

103 Jiyo

104 Smith



5. How do I display row number with records?


To achive this use rownum pseudocolumn with query, like SQL> SQL> select rownum, ename
from emp;

Output:

1 Scott

2 Millor

3 Jiyo

4 Smith



6. Display the records between two range


select rownum, empno, ename from emp where rowid in

(select rowid from emp where rownum <=&upto

minus

select rowid from emp where rownum<&Start);

Enter value for upto: 10

Enter value for Start: 7



ROWNUM EMPNO ENAME

--------- --------- ----------

1 7782 CLARK

2 7788 SCOTT

3 7839 KING

4 7844 TURNER



7. I know the nvl function only allows the same data type(ie. number or char or
date Nvl(comm, 0)), if commission is null then the text “Not Applicable” want to
display, instead of blank space. How do I write the query?




SQL> select nvl(to_char(comm.),'NA') from emp;



Output :



NVL(TO_CHAR(COMM),'NA')

-----------------------

NA

300

500

NA

1400

NA

NA



8. Oracle cursor : Implicit & Explicit cursors


Oracle uses work areas called private SQL areas to create SQL statements.

PL/SQL construct to identify each and every work are used, is called as Cursor.

For SQL queries returning a single row, PL/SQL declares all implicit cursors.

For queries that returning more than one row, the cursor needs to be explicitly
declared.



9. Explicit Cursor attributes


There are four cursor attributes used in Oracle

cursor_name%Found, cursor_name%NOTFOUND, cursor_name%ROWCOUNT, cursor_name%ISOPEN



10. Implicit Cursor attributes


Same as explicit cursor but prefixed by the word SQL



SQL%Found, SQL%NOTFOUND, SQL%ROWCOUNT, SQL%ISOPEN



Tips : 1. Here SQL%ISOPEN is false, because oracle automatically closed the implicit
cursor after executing SQL statements.

: 2. All are Boolean attributes.



11. Find out nth highest salary from emp table


SELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM
EMP B WHERE a.sal<=b.sal);


Enter value for n: 2

SAL

---------

3700



12. To view installed Oracle version information


SQL> select banner from v$version;



13. Display the number value in Words


SQL> select sal, (to_char(to_date(sal,'j'), 'jsp'))

from emp;

the output like,


SAL (TO_CHAR(TO_DATE(SAL,'J'),'JSP'))

--------- -----------------------------------------------------

800 eight hundred

1600 one thousand six hundred

1250 one thousand two hundred fifty

If you want to add some text like,

Rs. Three Thousand only.

SQL> select sal "Salary ",

(' Rs. '|| (to_char(to_date(sal,'j'), 'Jsp'))|| ' only.'))

"Sal in Words" from emp

/

Salary Sal in Words

------- ------------------------------------------------------

800 Rs. Eight Hundred only.

1600 Rs. One Thousand Six Hundred only.

1250 Rs. One Thousand Two Hundred Fifty only.



14. Display Odd/ Even number of records


Odd number of records:

select * from emp where (rowid,1) in (select rowid, mod(rownum,2) from emp);

1

3

5

Even number of records:

select * from emp where (rowid,0) in (select rowid, mod(rownum,2) from emp)

2

4

6



15. Which date function returns number value?


months_between



16. Any three PL/SQL Exceptions?


Too_many_rows, No_Data_Found, Value_Error, Zero_Error, Others



17. What are PL/SQL Cursor Exceptions?


Cursor_Already_Open, Invalid_Cursor



18. Other way to replace query result null value with a text


SQL> Set NULL ‘N/A’

to reset SQL> Set NULL ‘’



19. What are the more common pseudo-columns?


SYSDATE, USER , UID, CURVAL, NEXTVAL, ROWID, ROWNUM



20. What is the output of SIGN function?


1 for positive value,

0 for Zero,

-1 for Negative value.



21. What is the maximum number of triggers, can apply to a single table?


12 triggers.









C+,C++ Interview Questions



          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          





TOP












Q1: Tell how to check whether a linked list is circular.


A: Create two pointers, each set to the start of the list. Update each as follows:



while (pointer1) {

pointer1 = pointer1->next;

pointer2 = pointer2->next; if (pointer2) pointer2=pointer2->next;

if (pointer1 == pointer2) {

print ("circular\n");

}

}



Q2: OK, why does this work?


If a list is circular, at some point pointer2 will wrap around and be either at the
item just before pointer1, or the item before that. Either way, it’s either
1 or 2 jumps until they meet.



How can you quickly find the number of elements stored in a a) static array b)
dynamic
array ?


Why is it difficult to store linked list in an array?


How can you find the nodes with repetetive data in a linked list?


Write a prog to accept a given string in any order and flash error if any of the
character is different. For example : If abc is the input then abc, bca, cba, cab
bac are acceptable but aac or bcd are unacceptable.



This is a C question that I had for an intern position at Microsoft: Write out a
function that prints out all the permutations of a string. For example, abc would give
you abc, acb, bac, bca, cab, cba. You can assume that all the characters will
be unique. After I wrote out my function, he asked me to figure out from the
code how many times the printf statement is run, and also questions
on optimizing my algorithm.



What’s the output of the following program? Why?



#include

main()

{

typedef union

{

int a;

char b[10];

float c;

}

Union;



Union x,y = {100};

x.a = 50;

strcpy(x.b,"hello");

x.c = 21.50;



printf("Union x : %d %s %f \n",x.a,x.b,x.c );

printf("Union y :%d %s%f \n",y.a,y.b,y.c);


}

Given inputs X, Y, Z and operations | and & (meaning bitwise OR and AND, respectively)



What is output equal to in




output = (X & Y) | (X & Z) | (Y & Z)



Posted in: C++ |



74 Responses to “Interview questions on C/C++”

chinmaya Says:

May 26th, 2005 at 4:33 am

i think this will work for

while(node)

{

If(node==start)

printf(”circular”);

node=node->next;

}



nagarajan makala Says:

May 29th, 2005 at 12:01 pm

Chinmaya,

Your solution works only if loop begins at first element. But original solution works
for all cases.



Karthiksarma Says:

May 31st, 2005 at 1:37 am

this is a very useful site for freshers like me and who are willing to gain more
knowledge. i have many other ideas which will help this site to comeup



if u can give a chance i will tell i m frm hyderabad



confused Says:

June 1st, 2005 at 6:53 pm

How about those codes:



node = start->next;

while(node)

{

if(node == start)

{

printf(”circular”);

return;

}

node = node->next;

}



Mel Says:

June 2nd, 2005 at 2:52 am

The posted solution is flawed in that it can (and usually will) seg-fault on
non-circular lists. A correct solution should have a “not circular” result as well.


karthikeyan Says:

June 8th, 2005 at 10:19 am

how can u find no of elements in an array quickly?



if it is a dynamic array(linked list) the tradition is to keep the count variable in
the head

and incrementing it everytime an insertion is performed and decrementing whenever a
deletion is performed.so by seeing that count vaiable we can easily tell no. of
elements.



karthikeyan Says:

June 8th, 2005 at 11:05 am

Write a prog to accept a given string in any order and flash error if any of the
character is different. For example : If abc is the input then abc, bca, cba, cab bac
are acceptable but aac or bcd are unacceptable.

program

**************************************************



#define true 1

#define false 0

int* isalreadyread; /* this array is used to make sure that

int main(void) the characters in the original,which r matched with a char

{ in the dup is marked as ‘already read’*/

char* original; /* this string holds the original string like..abc*/

char* dup; /* this string is used to hold the duplicates like acb bac cab cba…*/

int isokay(char* ,char* ); /* this is the function(which intern calls many) which checks
whether the string is okay*/

int origlength;

int flag;

void initilaizing_isalreadyread();

printf(”\n enter the original string”);

scanf(”%s”,original);

origlength=strlen(original);

isalreadyread=(int*) calloc(origlength,sizeof(int));

flag=true;

while(flag)

{

printf(”enter the duplicate string”);scanf(”%s”,dup);

initializing_isread(origlength);

flag=isokay(original,dup);

if(flag)

printf(”%s”,dup);

}

} /* end of main*/

int isokay(char* original,char* dup)

{

int reflength=strlen(original);

int duplength=strlen(dup);

int found(char c,char* str);

if(reflength!=duplength)

return false; /* this is obvious*/

for(int i=0;i



C FAQs Says:

June 10th, 2005 at 5:43 am

Write out a function that prints out all the permutations of a string.

For example, abc would give you abc, acb, bac, bca, cab, cba.



It can be observed that the number of combinations of string, of length N,

is N!. Consider an example:



string: 123

Length: 3

Combination: 3! = 6

Output: 123 132 321 312 231 213



Following is a program to print all the combination a string:



1 /*

2 * str_combi.c - Print all the combinations of a string

3 * Author - Vijay Kumar R Zanvar

4 * Date - Feb 16, 2004

5 */

6

7 #include

8 #include

9 #include

10

11 void

12 string_combi ( char * s, int len )

13 {

14 int i;

15 char tmp;

16 static int j;

17 static char *p;

18

19 if ( !p )

20 p = s;

21

22 for ( i = 1; i 2 )

25 string_combi ( s+1, len-1 );

26 else

27 {

28 j++;

29 printf ( “%d: %s\t”, j, p );

30 if ( !( j%10 ) )

31 puts ( “” );

32 }

33 if ( i



C FAQs Says:

June 10th, 2005 at 5:49 am

The was some problem during the upload of comment 8 above.

See a program to print combination of strings here:



http://www.geocities.com/vijoeyz/faq/c/str_combi.txt



karthikeyan Says:

June 13th, 2005 at 12:07 pm

chinmaya,

ur condition within the while loop is never going to be false if it is a circular

linked list. a break is needed.



Wilson Says:

June 13th, 2005 at 2:50 pm

Got a question that extends on the detecting circular linked list question:

Given the constraints that you cannot modify the struct (or class) of the elements, and
that you have to remove the loop in the cyclic linked list in O(n) time and O(1)
space, how would you do it?

By removing the loop, I mean something like:

_______________________________

__ __ __ _| __ __ __ _|
| | -> | | -> | | -> | | -> | | -> | | -> | | -> | |

— — — — — — — –


Given this linked list, how do you make the last element in the list to point to NULL
in O(n) time and O(1) space?




I couldn’t think of a solution that uses O(1) space without modifying the structure
If I was allowed, I could just have a visited flag inside the struct. I’ll then have 2
pointers, a current and a previous. For every node traversed by the current, I
will set the flag to true, and each traversal, I will check whether that flag is
set to true. If it is, then the previous pointer is the last element of the list,
and I can just set the next to NULL. This will also be in O(n) time.



Any insights on this?



Wilson Says:

June 13th, 2005 at 2:51 pm

The picture of the linked list was kinda screwed up…

Anyway, that picture has 8 elements, with the last element pointing to the 4th element,
thus making a loop in the list.


Jatin Bhateja Says:

June 15th, 2005 at 2:14 am

answer for finding that link list is circular is

int count=0;

while (node)

{

if(node == start && count != 0) {

printf(”Circular”);

exit(0);

}

p = node->next;

q = node->next;

if(node == start)

node->next = null;



Jatin Bhateja Says:

June 15th, 2005 at 2:16 am

answer for finding that link list is circular is

int count=0;

while (node)

{

if(node == start && count != 0) {

printf(”Circular”);

exit(0);

}

p = node->next;

q = node->next;

if(node == start)

node->next = null;

else

node->next = r;

p->next = node;

node = q;

r = p;

count = count + 3;

}



karthikeyan.s Says:

June 16th, 2005 at 11:23 am

iscircular(Node* head) /* check whether a link list is circular */

{



/* assume that linklist has a header which keeps a count of no.

of nodes in the list */



Node* temp=head;



while(head->data–)



temp=temp->next;



if(temp->next=head->next)/*1st node actually is next node to head*/

return TRUE;



return FALSE;

}



bhavin Says:

June 21st, 2005 at 3:15 am

constructor can be static or not?and why? in c++



Dawid Says:

June 22nd, 2005 at 3:37 am

Not to mention the glaring access-violation once pointer2 becomes NULL(though this error
indicates ‘not circular’), the unnecessity of traversing pointer1(though doing
so does not impact numof iterations), and the lack of terminating
conditions(though still technically within the guidlines by only “checking for
circular”), the solution is FLAWED in that it will print “Circular” for non-circular
lists with 1 node!!! (when Pointer1 and Pointer2 are both NULL) I did think it was a
kinda cool idea to weed out the non-circular lists in (num of Nodes)/2 iterations,
but the extra traversal code i think outweighs any benefit.V
My elegant solution, if i do say so myself:



//assert: list is not empty

for(node=head->next; node!=NULL && node!=head; node=node->next);



if(node==NULL) cout



Dawid Says:

June 22nd, 2005 at 3:41 am

oops, that last statement should read:



if(node==NULL) printf(”Non-circular”);

else printf(”Circular”);



karthikeyan Says:

June 23rd, 2005 at 11:25 am

dawid,V
i dont think my code is lack of terminating condition. i have put while(head->data–)

but i should have copied that head->data into a temporary variable. it should look like



int temp1=head->data

while(temp1–)…………



i dont think it will print “circular” for all single node lists.

if the’next’ of the single node is the address of the node…it will print circular.

otherwise it will print “not circular”.



the idea is to get the address in the ‘next’ field of the last node(node which was
inserted latest)

i dont think there is a better way than traversing to reach ‘last’ node.



And…in ur code u assumed that the ‘last’ node’s next point to the Head.

i think its not a good design. it ruins the whole list then.



dawid Says:

June 26th, 2005 at 3:14 pm

Sorry karthikeyan, I should have been more clear: I was referring to the original
solution (by default). It seems to have been torn up enough already, but i wanted to
show off my fancy 1 line traversal.

However, in rebuttal:

-You’re fired! Mistaking an equality operator(==) with an assignment(=) is an offense
punishable by death.

-Your solution is unintelligible with that mangled loop condition. However relying on a
count of num of nodes makes your algorithm possibly unscalable to lists with dummy
nodes, for example.

-A chain of pointers will either end in a NULL pointer(if programmed responsibly), o
you’ll eventually be back where you started again. I don’t see how this testing ruins a list. Your point is noted, though, about a list with a dummy head that is r
bypassed around the circle (Like this: -0 ); but that doesn’t look like a circle tor
me, and I feel that head should point to the first node and any extra r
information should be stored in a wrapping class (because starting at the front ofr
the list would mean dereferencing twice; silly if traversed many times each gamer
loop, for example). However, to address that issue for those smallr
standalone-pointers-as-lists, you would send the first ‘real’ node ( r
head->next ) to this function. It is not completely efficient in that there is nor
specific head to terminate at - you must traverse all the way back around to ther
given node, but it works for any list. My beautiful(concise) function, if i dor
say so myself:r
r


bool isCircular(Node* node1)

{

if(node1==NULL) return false;

for(Node* node2=node1->next; node2!=NULL && node2!=node1; node2=node2->next);

return (node2!=NULL);

}

Regards, Dawid.



karthikeyan S Says:

June 27th, 2005 at 11:01 am

dawid,

ur code looks efficient



Oren Says:

June 29th, 2005 at 2:19 pm

David, your code does not work in case the loop does not begin with the first element.
For example:



A->B->C->D->C



I agree though that the question was “check that a linked list is circular” and not
“check that a linked list contains a circle”.



Somdutta Roy Says:

July 1st, 2005 at 8:54 am

int main(int argc, char* argv[])

{

//Write a prog to accept a given string in any order and flash error if any of

//the character is different. For example : If abc is the input then abc,

//bca, cba, cab bac are acceptable but aac or bcd are unacceptable.

//program


char code[100];

char ip[100];

int i,count,flag=0;

puts(”Enter the string:”);

scanf(”%s”,ip);

puts(”Enter the comparision string:”);

scanf(”%s”,code);

for(i=0;i



SMN Says:

July 5th, 2005 at 1:43 am

I executed the Program uploaded on site: as mentioned in ANS No: 9

But the string are repeated:

For Example following is the programs Output:



Enter String : 123

1: 123

2: 132

3: 231

4: 213

5: 123 (Repeated with 1:)

6: 132 (Repeated with 2:)

Press any key to continue.



The effort to write the program is apperiable. I am also trying to write a program for
it.



mohammad Says:

July 13th, 2005 at 10:09 am

#include

#include

#include

#define MLS 5

typedef struct listnode *p_node;

typedef struct listnode node;

typedef struct listnode{

int data;

p_node link;

};

void print_list (p_node ptr);

void add(p_node*,p_node*,p_node);

int delet(p_node*);

p_node creat_node(void);

void main()

{

clrscr();

int opselect=0;

p_node node1,node2,node3,node4,node5;

printf(”============START=============”);

if(opselect!=99)

{

printf(” \n enter aselect node \n”);

printf(” \n 1 to add \n”);

printf(” \n 2 to delet \n”);

printf(” \n 3 to exit \n”);

if(opselect==1){ add(,); }

if(opselect==2){ delete(); }

if(opselect==3){ printf(” good by the exit “);}

}

node1=creat_node();

node2=creat_node();

node3=creat_node();

node4=creat_node();

node5=creat_node();

//********************//

node1->data=10;

node1->link=node2;

node2->data=11;

node2->link=node3;

node3->data=12;

node3->link=node4;

node4->data=13;

node4->link=node5;

node5->data=14;

node5->link=NULL;

//*******************//

}

//function creat node//

p_node creat_node(void)

{

p_node lptr;

lptr=(p_node)malloc(sizeof(node));

return(lptr);

}

//function add node//

void add(p_node*rear,p_node*front,int data_insert)

{

p_node temp;

temp=(p_node)malloc(sizeof(p_node));

if(is_full(temp)){ printf(”\n the memory is full \n”);

exit(1); }

temp->data=data_insert;

if(*lptr){

temp->link=node->link;

node->link=temp;

}

else{

temp->link=NULL;

*lptr=temp;

}

}

//function delet node//

void delet(p_node ,p_node trial,p_node)

{

*node=trial->link;

if(trial)

trial->link=trial->link->link;

else

*lptr=(*lptr)->link;

}

//function print nodes//

void print_link(p_node lptr)

{

printf(” \n the list contains: \n “);

while(lptr)

{

printf(” \n \t %d”,lptr->data);

lptr=lptr->link;

}

}



Aditya Says:

July 13th, 2005 at 1:36 pm

For printing out all permutations of a string.

Please tell me all ways I can optimize. Any thoughts on a non-recursive algorithm? My
C/C++ isn’t very strong. Raised on Java.



void PrintPermu (char *sBegin, char* sRest)

{

int iLoop;

char cTmp;

char cFLetter[1];

char *sNewBegin;

char *sCur;

int iLen;

static int iCount;


iLen = strlen(sRest);


if (iLen == 2)

{

iCount++;

printf(”%d: %s%s\n”, iCount, sBegin, sRest);


iCount++;

printf(”%d: %s%c%c\n”, iCount, sBegin, sRest[1], sRest[0]);


return;

}

else if (iLen == 1)

{

iCount++;

printf(”%d: %s%s\n”, iCount, sBegin, sRest);

return;

}

else

{

// swap the first character of sRest with each of the remaining chars

// recursively call debug print



sCur = (char*)malloc(iLen);

sNewBegin = (char*)malloc(iLen);


for (iLoop = 0; iLoop


Aditya Says:

July 13th, 2005 at 1:37 pm

For printing out all permutations of a string.

Please tell me all ways I can optimize. Any thoughts on a non-recursive algorithm? My
C/C++ isn’t very strong. Raised on Java.



void PrintPermu (char *sBegin, char* sRest)

{

int iLoop;

char cTmp;

char cFLetter[1];

char *sNewBegin;

char *sCur;

int iLen;

static int iCount;


iLen = strlen(sRest);


if (iLen == 2)

{

iCount++;

printf(”%d: %s%s\n”, iCount, sBegin, sRest);



iCount++;

printf(”%d: %s%c%c\n”, iCount, sBegin, sRest[1], sRest[0]);



return;

}

else if (iLen == 1)

{

iCount++;

printf(”%d: %s%s\n”, iCount, sBegin, sRest);

return;

}

else

{

// swap the first character of sRest with each of the remaining chars

// recursively call debug print



sCur = (char*)malloc(iLen);

sNewBegin = (char*)malloc(iLen);



for (iLoop = 0; iLoop lessthan iLen; iLoop ++)

{



strcpy(sCur, sRest);

strcpy(sNewBegin, sBegin);



cTmp = sCur[iLoop];

sCur[iLoop] = sCur[0];

sCur[0] = cTmp;



sprintf(cFLetter, “%c”, sCur[0]);

strcat(sNewBegin, cFLetter);

debugprint(sNewBegin, sCur+1);



}

}



}



void main()

{



char s[255];

char sIn[255];

printf(”\nEnter a string:”);

scanf(”%s%*c”,sIn);

memset(s,0,255);



PrintPermu(s, sIn);

}



bharadwaja Says:

July 27th, 2005 at 5:54 am

What is the size of the empty class’s object?If it is 1byte why?

please help me.



Benjamin Says:

July 28th, 2005 at 9:49 am

Write out a function that prints out all the permutations of a string.

For example, abc would give you abc, acb, bac, bca, cab, cba



Another solution



#include

#include

#include

#include

using namespace std;



typedef set setchar;

char szPermutation[256];



void permutate(setchar charset, char* szPermute )

{

if (!charset.size())

{

cout > strPermutation;

cout



Ajit Says:

August 2nd, 2005 at 10:37 am

Write a prog to accept a given string in any order and flash error if any of the
character is different. For example : If abc is the input then abc, bca, cba, cab bac
are acceptable but aac or bcd are unacceptable.

program

**************************************************

Simply have an array of 256 elements. Each element of the array corresponds to one
character and stores its count in the original string

**************************************************


#include



int* getCharCounts(char* str)

{

int* result = new int[256];

for(int i=0; i>str1;

cout>str2;



int* c1 = getCharCounts(str1);

int* c2 = getCharCounts(str2);



if(match(c1,c2)) cout


Harshit Kumar Says:

August 7th, 2005 at 4:28 pm

Code to print permutations of a string using Recursion

======================================================


int perm_count = 0;



void swap(char *s, int t, int p)

{

char tmp;

tmp = s[t];

s[t] = s[p];

s[p] = tmp;

}

void permute(char *s, int p, int n)

{

int i,j;



if (p > n)

{

printf(”%s\n”, s);

perm_count++;

return;

}



for (i=p; i







.NET Interview Questions




          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          



TOP








What is .NET?


.NET is essentially a framework for software development. It is similar in nature to any
other software development framework (J2EE etc) in that it provides a set of
runtime containers/capabilities, and a rich set of pre-built functionality in
the form of class libraries and APIs

The .NET Framework is an environment for building, deploying, and running Web Services
and other applications. It consists of three main parts: the Common
Language Runtime, the Framework classes, and ASP.NET.



How many languages .NET is supporting now?


When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl,
etc. The site DotNetLanguages.Net says 44 languages are supported.



How is .NET able to support multiple languages?


A language should comply with the Common Language Runtime standard to become a .NET
language. In .NET, code is compiled to Microsoft Intermediate Language (MSIL for short).
This is called as Managed Code. This Managed code is run in .NET
environment. So after compilation to this IL the language is not a barrier. A code can
call or use a function written in another language.



How ASP .NET different from ASP?


Scripting is separated from the HTML, Code is compiled as a DLL, these DLLs can be
executed on the server.

What is smart navigation?

The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.



What is view state?


The web is stateless. But in ASP.NET, the state of a page is maintained in the in the
page itself automatically. How? The values are encrypted and saved in hidden
controls. this is done automatically by the ASP.NET. This can be switched off / on for a
single control



How do you validate the controls in an ASP .NET page?


Using special validation controls that are meant for this. We have Range Validator,
Email Validator.


Can the validation be done in the server side? Or this can be done only in the Client
side?




Client side is done by default. Server side validation is also possible. We can switch
off the client side and server side can be done.



How to manage pagination in a page?


Using pagination option in DataGrid control. We have to set the number of records for a
page, then it takes care of pagination by itself.



What is ADO .NET and what is difference between ADO and ADO.NET?


ADO.NET is stateless mechanism. I can treat the ADO.Net as a separate in-memory database
where in I can use relationships between the tables and select insert and
updates to the database. I can update the actual database as a batch.






PHP Interview Questions



          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          




TOP








Q:1 What are the different types of errors in PHP?


A:1 Three are three types of errors:1. Notices: These are trivial,

non-critical errors that PHP encounters while executing a script - for

example, accessing a variable that has not yet been defined. By default,

such errors are not displayed to the user at all - although, as you will

see, you can change this default behavior.2. Warnings: These are more serious errors -
for example, attempting

to include() a file which does not exist. By default, these errors are

displayed to the user, but they do not result in script termination.3. Fatal errors:
These are critical errors - for example,

instantiating an object of a non-existent class, or calling a

non-existent function. These errors cause the immediate termination of

the script, and PHP’s default behavior is to display them to the user

when they take place.





Q:2 Who is the father of PHP and explain the changes in PHP versions?



A:2 Rasmus Lerdorf is known as the father of PHP.PHP/FI 2.0 is an early and no longer
supported version of PHP. PHP 3

is the successor to PHP/FI 2.0 and is a lot nicer. PHP 4 is the current

generation of PHP, which uses the

Zend engine

under the

hood. PHP 5 uses

Zend engine 2 which,

among other things, offers many additionalOOP features



Q:3 How can we submit a form without a submit button?


A:3 The main idea behind this is to use Java script submit() function in

order to submit the form without explicitly clicking any submit button.

You can attach the document.formname.submit() method to onclick,

onchange events of different inputs and perform the form submission. you

can even built a timer function where you can automatically submit the

form after xx seconds once the loading is done (can be seen in online

test sites).



Q:4 In how many ways we can retrieve the data in the result set of

MySQL using PHP?


A:4 You can do it by 4 Ways1. mysql_fetch_row.

2. mysql_fetch_array

3. mysql_fetch_object

4. mysql_fetch_assoc



Q:5 What is the difference between mysql_fetch_object and

mysql_fetch_array?


A:5 mysql_fetch_object() is similar tomysql_fetch_array(), with one difference -

an object is returned, instead of an array. Indirectly, that means that

you can only access the data by the field names, and not by their

offsets (numbers are illegal property names).



Q:6 What is the difference between $message and $$message?


A:6 It is a classic example of PHP’s variable variables. take the

following example.$message = “Mizan”;$$message = “is a moderator of PHPXperts.”;$message
is a simple PHP variable that we are used to. But the

$$message is not a very familiar face. It creates a variable name $mizan

with the value “is a moderator of PHPXperts.” assigned. break it like

this${$message} => $mizanSometimes it is convenient to be able to have variable variable

names. That is, a variable name which can be set and used dynamically.



Q:7 How can we extract string ‘abc.com ‘ from a string ‘http://info@abc.com’

using regular expression of PHP?


A:7 preg_match(”/^http:\/\/.+@(.+)$/”,’http://info@abc.com’,$found);

echo $found[1];



Q:8 How can we create a database using PHP and MySQL?


A:8 We can create MySQL database with the use of

mysql_create_db(“Database Name”)



Q:9 What are the differences between require and include,

include_once and require_once?


A:9 The include() statement includes

and evaluates the specified file.The documentation below also applies to

require(). The two constructs

are identical in every way except how they handle

failure. include() produces a

Warning while require() results

in a Fatal Error. In other words, use

require() if you want a missing

file to halt processing of the page.

include() does not behave this way, the script will

continue regardless.



The include_once()

statement includes and evaluates the

specified file during the execution of

the script. This is a behavior similar

to the include()

statement, with the only difference

being that if the code from a file has

already been included, it will not be

included again. As the name suggests, it

will be included just once.include_once()

should be used in cases where the same

file might be included and evaluated

more than once during a particular

execution of a script, and you want to

be sure that it is included exactly once

to avoid problems with function

redefinitions, variable value

reassignments, etc.



require_once()

should be used in cases where the same

file might be included and evaluated

more than once during a particular

execution of a script, and you want to

be sure that it is included exactly once

to avoid problems with function

redefinitions, variable value

reassignments, etc.

Q:10 Can we use include (”abc.PHP”) two times in a PHP page “makeit.PHP”?



A:10 Yes we can use include() more than one time in any page though it is

not a very good practice.



Q:11 What are the different tables present in MySQL, which type of

table is generated when we are creating a table in the following syntax:

create table employee (eno int(2),ename varchar(10)) ?


A:11 Total 5 types of tables we can create

1. MyISAM

2. Heap

3. Merge

4. INNO DB

5. ISAM

MyISAM is the default storage engine as of MySQL 3.23 and as a result if

we do not specify the table name explicitly it will be assigned to the

default engine.



Q:12 Functions in IMAP, POP3 AND LDAP?


A:12 You can find these specific information in PHP Manual.



Q:13 How can I execute a PHP script using command line?


A:13 As of version 4.3.0, PHP supports a new SAPI type (Server

Application Programming Interface) named CLI which means Command Line

Interface. Just run the PHP CLI (Command Line Interface) program and

provide the PHP script file name as the command line argument. For

example, “php myScript.php”, assuming “php” is the command to invoke the

CLI program.

Be aware that if your PHP script was written for the Web CGI interface,

it may not execute properly in command line environment.



Q:14 Suppose your Zend engine supports the mode Then how can u

configure your PHP Zend engine to support mode ?


A:14 In php.ini file:

set

short_open_tag=on

to make PHP support



Q:15 Shopping cart online validation i.e. how can we configure Paypal,

etc.?


A:15 We can find the detail documentation about different paypal

integration process at the following site





PayPal PHP

SDK : http://www.paypaldev.org




Q:16 What is meant by nl2br()?


A:16 Inserts HTML line breaks (
) before all newlines in a string

string nl2br (string); Returns string with ” inserted before all

newlines. For example: echo nl2br(”god bless\n you”) will output “god

bless
you” to your browser.

Q:17 Draw the architecture of Zend engine?


A:17 The Zend Engine is the internal compiler and runtime engine used by

PHP4. Developed by Zeev Suraski and Andi Gutmans, the Zend Engine is an

abbreviation of their names. In the early days of PHP4, it worked as

follows:

The PHP script was loaded by the Zend Engine and compiled into Zend

opcode. Opcodes, short for operation codes, are low level binary

instructions. Then the opcode was executed and the HTML generated sent

to the client. The opcode was flushed from memory after execution.Today, there are a
multitude of products and techniques to help you

speed up this process. In the following diagram, we show the how modern

PHP scripts work; all the shaded boxes are optional.

PHP Scripts are loaded into memory and compiled into Zend opcodes.



Q:18 What are the current versions of apache, PHP, and MySQL?


A:18 As of February, 2007 the current versions arePHP: php5.2.1

MySQL: MySQL 5.2

Apache: Apache 2.2.4Note: visit www.php.net,






Q:19 What are the reasons for selecting lamp (Linux, apache, MySQL,

PHP) instead of combination of other software programs, servers and

operating systems?


A:19 All of those are open source resource. Security of Linux is very

very more than windows. Apache is a better server that IIS both in

functionality and security. MySQL is world most popular open source

database. PHP is more faster that asp or any other scripting language.



Q:20 How can we encrypt and decrypt a data present in a MySQL table

using MySQL?


A:20 AES_ENCRYPT () and AES_DECRYPT ()



Q:21 How can we encrypt the username and password using PHP?


A:21 The functions in this section perform encryption and decryption, and

compression and uncompression:



encryption decryption

AES_ENCRYT() AES_DECRYPT()

ENCODE() DECODE()

DES_ENCRYPT() DES_DECRYPT()

ENCRYPT() Not available

MD5() Not available

OLD_PASSWORD() Not available

PASSWORD() Not available

SHA() or SHA1() Not available

Not available UNCOMPRESSED_LENGTH()





Q:22 What are the features and advantages of object-oriented

programming?


A:22 One of the main advantages of OO programming is its ease of

modification; objects can easily be modified and added to a system there

by reducing maintenance costs. OO programming is also considered to be

better at modeling the real world than is procedural programming. It

allows for more complicated and flexible interactions. OO systems are

also easier for non-technical personnel to understand and easier for

them to participate in the maintenance and enhancement of a system

because it appeals to natural human cognition patterns.

For some systems, an OO approach can speed development time since many

objects are standard across systems and can be reused. Components that

manage dates, shipping, shopping carts, etc. can be purchased and easily

modified for a specific system



Q:23 What are the differences between procedure-oriented languages and

object-oriented languages?


A:23 Traditional programming has the following characteristics:Functions are written
sequentially, so that a change in programming can

affect any code that follows it.

If a function is used multiple times in a system (i.e., a piece of code

that manages the date), it is often simply cut and pasted into each

program (i.e., a change log, order function, fulfillment system, etc).

If a date change is needed (i.e., Y2K when the code needed to be changed

to handle four numerical digits instead of two), all these pieces of

code must be found, modified, and tested.

Code (sequences of computer instructions) and data (information on which

the instructions operates on) are kept separate. Multiple sets of code

can access and modify one set of data. One set of code may rely on data

in multiple places. Multiple sets of code and data are required to work

together. Changes made to any of the code sets and data sets can cause

problems through out the system.Object-Oriented programming takes a radically different
approach:Code and data are merged into one indivisible item – an object
(the
term “component” has also been used to describe an object.) An object is

an abstraction of a set of real-world things (for example, an object may

be created around “date”) The object would contain all information and

functionality for that thing (A date

object it may contain labels like January, February, Tuesday, Wednesday.

It may contain functionality that manages leap years, determines if it

is a business day or a holiday, etc., See Fig. 1). Ideally, information

about a particular thing should reside in only one place in a system.

The information within an object is encapsulated (or hidden) from the

rest of the system.

A system is composed of multiple objects (i.e., date function, reports,

order processing, etc., See Fig 2). When one object needs information

from another object, a request is sent asking for specific information.

(for example, a report object may need to know what today’s date is and

will send a request to the date object) These requests are called

messages and each object has an interface that manages messages.

OO programming languages include features such as “class”, “instance”,

“inheritance”, and “polymorphism” that increase the power and

flexibility of an object.



Q:24 What is the use of friend function?


A:24 Sometimes a function is best shared among a number of different

classes. Such functions can be declared either as member functions of

one class or as global functions. In either case they can be set to be

friends of other classes, by using a friend specifier in the class that

is admitting them. Such functions can use all attributes of the class

which names them as a friend, as if they were themselves members of that

class.

A friend declaration is essentially a prototype for a member function,

but instead of requiring an implementation with the name of that class

attached by the double colon syntax, a global function or member

function of another class provides the match.



Q:25 What are the differences between public, private, protected,

static, transient, final and volatile?


A:25 Public: Public declared items can be accessed everywhere.

Protected: Protected limits access to inherited and parent

classes (and to the class that defines the item).

Private: Private limits visibility only to the class that defines

the item.

Static: A static variable exists only in a local function scope,

but it does not lose its value when program execution leaves this scope.

Final: Final keyword prevents child classes from overriding a

method by prefixing the definition with final. If the class itself is

being defined final then it cannot be extended.

transient: A transient variable is a variable that may not

be serialized.

volatile: a variable that might be concurrently modified by multiple

threads should be declared volatile. Variables declared to be volatile

will not be optimized by the compiler because their value can change at

any time.










          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          




TOP

HTML Interview Questions




#1 How do I add midi music to my web page



This can be done quite simply with the below tag.





This tag will play the music.mid once. If you wanted this song to continue without
stopping, you would use loop="infinite" instead of the loop="1", which will only
play it once. If you needs this to work with Netscape and Internet Explorer, you
can use the embed tag to implement music to your page using code similar tot
he below example.







Which would give you the below example.




#2 How do I make a picture as a background on my web pages?




Point the body background to the name of your image you wish to use as the background
as shown below. This body line should be the first line after your
tag.







You can also have the background image fixed, so it does not move when using the
scroll bar in the browser. To do this add the BGPROPERTIES tag as shown below.




#3 How do I make it so that someone can mail me by just clicking on text?



Use the mailto command in your A HREF link tag as shown below.



Click here to mail ComputerHope



The above example would create a link similar to the one shown below.



Click here to mail ComputerHope



#4 How do I add scrolling text to my page?




Keep in mind not all browsers support scrolling text. however to do this add a tag
similar to the below example.



THIS WOULD SCROLL



The above example would create the below scrolling text. If your browser supports
scrolling text the below example should be scrolling.



THIS WOULD SCROLL


More examples can be found on our main HTML page that lists most of the HTML commands.



#5 How do I do multiple colors of text?




To do the multicolor text adjust the color of your font tag as shown below.



blue



The above example would make the text blue; you can do all the major Colors.
Click here for a list of all valid colors.



#6 How do I make a picture a link?




Use the A HREF link tag around the IMG image tag as shown below.







The above example would give you the below clickable image link.






#7 How can I make my link not have this ugly border?




Add the border="0" command to your IMG SRC tag as shown below.




border="0">




The above code would give you the below example.





#8 How do I make it so that my web page is just one solid color in the background
without using an image file?




Change the BGCOLOR (short for background color) in your body tag as shown below.







The above example would make the background of the page white, like the page you're
viewing now. However, you could do blue, red, or any of these colors are valid



#9 How do I align pictures so that one may be higher or lower than the other?




Use the align statement in your IMG SRC tag as shown below.







Anything that is after that image will be aligned to the top of the image, like the
below example.





Also, instead of align=top you can do align=middle, and align=bottom.



#10 How do I make a link to another web page?




Specify the complete URL in the A HREF tag as shown below.



Visit ComputerHope



Replace our address with the address that you would like to link. Where it says "Visit
ComputerHope" replace this what you want to name the link.










          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          




TOP

FLASH Interview Questions












          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          

TOP

| 0 comments ]



Search Engine Optimization and SEO Tools

| 0 comments ]

250 JOB INTERVIEW QUESTIONS YOULL MOST L by PETER VERUKI BUSINESS & PROFESSIONAL CAREER SEARCH Published by LISTEN & LIVE AUDIO Performed by PETER VERUKI , 210 minutes, Abridged, Compact Disc, $19.95, Your Cost New $15.96 [ Why do you want this job? Why should I hire you? Why do you want to leave your current job? Do you have convincing answers ready for these important questions? Landing a good jo ] is a competitive process and often the final decision is based on your performance at the interview. By

| 0 comments ]

GETTING GOOD ANSWERS TO TOUGH INTERVIEW QUESTIONS Learn how to answer some of the toughest interview questions you may face, and master different techniques that can help you through a tough interview process.

| 0 comments ]

GETTING GOOD ANSWERS TO TOUGH INTERVIEW QUESTIONS Learn how to answer some of the toughest interview questions you may face, and master different techniques that can help you through a tough interview process.

| 0 comments ]

201 Best Questions to Ask on Your Interview [Secure Mobipocket /Microsoft Reader/eReader (recommended)/Adobe Reader 7] Ask the right questions and land the job of your dreams! To really shine in your job interview and to get that dream job, the questions you ask must be at least as memorable as the answers you give. Today it's the questions you ask that set you apart from the dozens­­even hundreds­­of qualified candidates competing for your job. Make your questions demonstrate that you are a superstar, a