Code Snippets Interview Questions
Questions Answers Views Company eMail

void main() { int const * p=5; printf("%d",++(*p)); }

Infosys, Made Easy, State Bank Of India SBI,

3 34545

main() { char s[ ]="man"; int i; for(i=0;s[ i ];i++) printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]); }

DCE,

1 16217

main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }

1 8581

main() { static int var = 5; printf("%d ",var--); if(var) main(); }

1 26966

main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }

1 31240

main() { extern int i; i=20; printf("%d",i); }

Value Labs,

1 13815

main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); }

1 24497

main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }

6 20516

main() { int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }

1 14361

main() { printf("%x",-1<<4); }

HCL, Sokrati, Zoho,

3 43144

main() { char string[]="Hello World"; display(string); } void display(char *string) { printf("%s",string); }

Wipro,

2 10279

main() { int c=- -2; printf("c=%d",c); }

TCS,

1 19258

#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }

1 31341

main() { int i=10; i=!i>14; Printf ("i=%d",i); }

1 26742

#include main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }

1 4004


Un-Answered Questions { Code Snippets }

plz send code for Ecorps in j2ee frontend:J2EE Backend: DB2 Express

2392


How to get Dynamically Linked Comboboxes Set?

2016


i really need help about this.. write a program to display the set of odd and even numbers separately. find the highest and lowest value of the given numbers.

1961


What is SAX in XML?

359


code to create a new window

1747






Financial: credit card number validation) Credit card numbers follow certain patterns. A credit card number must have between 13 and 16 digits. It must start with: ■ 4 for Visa cards ■ 5 for Master cards ■ 37 for American Express cards ■ 6 for Discover cards In 1954, Hans Luhn of IBM proposed an algorithm for validating credit card numbers. The algorithm is useful to determine whether a card number is entered correctly or whether a credit card is scanned correctly by a scanner. All credit card numbers are generated following this validity check, commonly known as the Luhn check or the Mod 10 check, which can be described as follows (for illustration, consider the card number 4388576018402626): 1. Double every second digit from right to left. If doubling of a digit results in a two-digit number, add up the two digits to get a single-digit number. 2 * 2 = 4 2 * 2 = 4 4 * 2 = 8 1 * 2 = 2 6 * 2 = 12 (1 + 2 = 3) 5 * 2 = 10 (1 + 0 = 1) 8 * 2 = 16 (1 + 6 = 7) 4 * 2 = 8 2. Now add all single-digit numbers from Step 1. 4 + 4 + 8 + 2 + 3 + 1 + 7 + 8 = 37 3. Add all digits in the odd places from right to left in the card number. 6 + 6 + 0 + 8 + 0 + 7 + 8 + 3 = 38 4. Sum the results from Step 2 and Step 3. 37 + 38 = 75 5. If the result from Step 4 is divisible by 10, the card number is valid; otherwise, it is invalid. For example, the number 4388576018402626 is invalid, but the number 4388576018410707 is valid. Write a program that prompts the user to enter a credit card number as a long integer. Display whether the number is valid or invalid. Design your program to use the following methods: /** Return true if the card number is valid */ public static boolean isValid(long number) /** Get the result from Step 2 */ public static int sumOfDoubleEvenPlace(long number) /** Return this number if it is a single digit, otherwise, return * the sum of the two digits */ public static int getDigit(int number) /** Return sum of odd place digits in number */ public static int sumOfOddPlace(long number) /** Return true if the digit d is a prefix for number */ public static boolean prefixMatched(long number, int d) /** Return the number of digits in d */ public static int getSize(long d) /** Return the first k number of digits from number. If the * number of digits in number is less than k, return

5748


code to keep a page Out of the browser history

1648


What is GUID anyway?

573


How to Link Different Data Sources Together?

1789


write a program that prompt the user to enter his height and weight,then calculate the body mass index and show the algorithm used

4294


Devise a program to implement the Fibonacci sequence.

527


Hello Sir, Thanks for the Solution but, can you pls. Explain the coding for the Static Function & static variable from the below coding....waiting for Ans. class fact { public static void Main() { fact f=new fact(); int x=1; //Declaration of x as 1 int k=Convert.ToInt32(Console.ReadLine()); for(int i=1;i<=k;i++) { x= x *i; } System.Console.WriteLine(x); } }

2021


write a program that reverses the input number of n.Formulate an equation to come up with the answer.

7016


design a class car having variables model, yr_of_manufacture, owner,reg_no. Design methods for assigning the values, Printing the values( you decide gui,control, any other methods if require)

1827


A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect

2391