Code Snippets Interview Questions
Questions Answers Views Company eMail

main() { int i=5,j=10; i=i&=j&&10; printf("%d %d",i,j); }

1 5282

main() { int i=4,j=7; j = j || i++ && printf("YOU CAN"); printf("%d %d", i, j); }

1 4192

main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }

3 4733




main() { float i=1.5; switch(i) { case 1: printf("1"); case 2: printf("2"); default : printf("0"); } }

2 3910

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

1 2380

main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; printf("\n%d %d %d",a,*f1,*f2); }

6 7597

main() { char *p="GOOD"; char a[ ]="GOOD"; printf("\n sizeof(p) = %d, sizeof(*p) = %d, strlen(p) = %d", sizeof(p), sizeof(*p), strlen(p)); printf("\n sizeof(a) = %d, strlen(a) = %d", sizeof(a), strlen(a)); }

1 2698

#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr, int)); }

1 4291

int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr)); }

CSC,

2 6085

main() { static int a[3][3]={1,2,3,4,5,6,7,8,9}; int i,j; static *p[]={a,a+1,a+2}; for(i=0;i<3;i++) { for(j=0;j<3;j++) printf("%d\t%d\t%d\t%d\n",*(*(p+i)+j), *(*(j+p)+i),*(*(i+p)+j),*(*(p+j)+i)); } }

1 7811

main() { void swap(); int x=10,y=8; swap(&x,&y); printf("x=%d y=%d",x,y); } void swap(int *a, int *b) { *a ^= *b, *b ^= *a, *a ^= *b; }

2 4504

main() { int i = 257; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }

CSC,

1 5275

main() { int i = 258; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }

1 4244

main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }

CSC,

4 12482

#include main() { char * str = "hello"; char * ptr = str; char least = 127; while (*ptr++) least = (*ptr 1 3212








Un-Answered Questions { Code Snippets }

What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?

2581


how to Scroll a DIV content

1531


Create a program to read two random data set in two files named data1.txt and data2.txt manifold contains integer numbers, whereas data2.txt file contains the float type numbers. Simpanlahmasing each into 2 pieces of data that is an array of type integer array and an array of type float, then calculate the average numbers in the second array.

1400


can any one give me code to keyed a flat file and used chain in RPGLE to search any item

1057


How can I Create a C program in splitting set of characters to specific subsets. Example: INPUT SET OF CHARACTERS: Therefore, my dear brothers and sisters, stand firm. Let nothing move you. Always give yourselves fully to the work of the Lord, because you know that your labor in the Lord is not in vain. SPLIT INTO HOW MANY CHARACTERS PER SUBSETS: 10 OUTPUT: Therefore, my dear b rothers an d sisters, stand fir m. Let not hing move you. Alway s give you rselves fu lly to the work of t he Lord, b ecause you know that your labo r in the L ord is not in vain.

1030






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

3629


Can we run Applet in Web browser with security policy files

1396


How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?

1135


output for printf("printf");

1012


snippet to prevent submission of form when certain/any validations got failed

960


How to add a value from textBox over an existing certain column in SQL Server

1612


How to get the version(major,minor,revision ) of VB6.0 delphi code .I am able to fetch dll file of vb6.0 but not vba file .Can u send me the code snippet in delphi to get the value for vb6.0.

2641


Coding for Synchronizing Cache Access in ASP.NET?

2363


How to Get File Extension?

411


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

4415