Top Code Snippets Interview Questions :: ALLInterview.com http://www.allinterview.com Top Code Snippets Interview Questions en-us How to swap two variables, without using third variable ? http://www.allinterview.com/showanswers/17145.html Hi this question was asked in my interview. Ans is : a=a+b; b=a-b; a=a-b; Any other solution? What is the main difference between STRUCTURE and UNION? http://www.allinterview.com/showanswers/72739.html All the members of the structure can be accessed at once,where as in an union only one member can be used at a time. Another important difference is in the size allocated to a structure and an union. for eg: struct example { int integer; How to reverse a String without using C functions ? http://www.allinterview.com/showanswers/58562.html my_strrev(char str[Max]){ int i; // pointing to base adress int l; //pointing to last address strlen(str) -1th position char temp; for(i=0,l=strlen(str)-1;i<=l; i++ ,j--) { temp=str[i]; str[i]=str[l]; Write a function to find the depth of a binary tree. http://www.allinterview.com/showanswers/17140.html int Depth(struct Node*node,int level) { if(Node!=NULL) { if(level<depth) depth=level; Depth(Node->leftchild,level+1); Depth(Node->rightchild,level+1); } return(depth); } how can u draw a rectangle in C http://www.allinterview.com/showanswers/23031.html BY USING PRINTF AND SCANF 1)how i get the current system time using php? http://www.allinterview.com/showanswers/61489.html U can done it by using current timestamp option. program to find the roots of a quadratic equation http://www.allinterview.com/showanswers/75398.html #include<stdio.h> #include<conio.h> #include<math.h> #include<process.h> void main() { float a,b,c,x1,x2,disc; clrscr(); printf("Enter the co-efficients\n"); scanf("%f%f%f",&a,&b,&c); program to Reverse a linked list http://www.allinterview.com/showanswers/17137.html node *reverse(node *first) { node *cur,*temp; cur=NULL; while(first!=NULL) {temp=first; first=first->link; temp->link=cur; cur=temp; } return cur; } How to return multiple values from a function? http://www.allinterview.com/showanswers/18241.html Make array of values and return the array address as long. Now using pointer traverse through the value. To Write a C program to remove the repeated characters in the entere http://www.allinterview.com/showanswers/59171.html int remove_duplicates(char *str) { int char_check=0; int i,j; char ch; if(str == NULL) return 0; /* check from 1st character in the string */ while(str[char_check]) { ch = str[char_check]; how to check whether a linked list is circular. http://www.allinterview.com/showanswers/17148.html 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 How to create and run runnable jar file of a Java Project. http://www.allinterview.com/showanswers/65167.html Common Examples ---------------- Let's say I have a Java application consisting of three source files that I wish to distribute: One.javaTwo.javaThree.java I also want to call my JAR file example.jar. To make a JAR file with just One How to convert string containing decimal point into integer in java? http://www.allinterview.com/showanswers/68913.html /* How to convert string containing decimal point into integer in java? For example given a string like "3.14" as input how to get integer 3 as result. */ String myStr = "3.14"; Int myInt = Float.valueOf(myStr).intvalue(); Program to find the largest sum of contiguous integers in the array. http://www.allinterview.com/showanswers/17157.html #include <iostream.h> #include<conio.h> main() { int s=-1,m=1,n,max=0,e=-1,sum=0,i,a[20]; cout<<"enter n:"; cin>>n; cout<<"enter elements:"; for(i=0;i<n;i++) cin>>a[i]; for(i=0;i< How to send e-mail from an ASP.NET application? http://www.allinterview.com/showanswers/23045.html MailMessage message = new MailMessage (); message.From = <email>; message.To = <email>; message.Subject = "Scheduled Power Outage"; message.Body = "Our servers will be down tonight."