Code Snippets Interview Questions
Questions Answers Views Company eMail

#include main() { int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} }; int *p,*q; p=&a[2][2][2]; *q=***a; printf("%d----%d",*p,*q); }

1 5174

#include main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s; printf("%d",s->x); printf("%s",s->name); }

Hexaware,

3 15126

#include main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }

1 5345

main() { printf("\nab"); printf("\bsi"); printf("\rha"); }

3 32095

main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); }

7 51049

#define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }

Google, HCL, Quick Heal, WTF,

4 36346

main() { char *p="hai friends",*p1; p1=p; while(*p!='\0') ++*p++; printf("%s %s",p,p1); }

3 13847

#include #define a 10 main() { #define a 50 printf("%d",a); }

2 16766

#define clrscr() 100 main() { clrscr(); printf("%d\n",clrscr()); }

2 18894

main() { 41printf("%p",main); }8

1 5347

main() { clrscr(); } clrscr();

2 4449

enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }

2 7108

void main() { char far *farther,*farthest; printf("%d..%d",sizeof(farther),sizeof(farthest)); }

2 7847

main() { int i=400,j=300; printf("%d..%d"); }

3 6474

main() { char *p; p="Hello"; printf("%c\n",*&*p); }

1 5599


Un-Answered Questions { Code Snippets }

Code for IP Address Comparison and Conversion in C#?

4176


program to bring a window to the front

1770


Write a program that implements a date class containing day, month and year as data members. Implement assignment operator and copy constructor in this class.

694


write a simple calculator c program to perform addition, subtraction, mul and div.

3395


What output does the following code generate? Why? What output does it generate if you make A::Foo() a pure virtual function? class A { A() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; class B : public A { B() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; int main(int, char**) { A objectA; B objectB; return 0; }

861


#include int main(void) { int a=4, b=2; a=b<>2 ; printf("%d",a); return 0; }

1303


code to images to rollover

2034


code to detect availability of cookies

1939


i have a gird with columns all are coming from database,this will bind in item templete in gridview as textboxex.and i have button below named Update.i want to update all the records in the grid,but if user change the value of one textbox,what is the easy way 2 do this

2319


write a program to input a natural number less than and display it in words.test your program on the sample data and some random data sample input= 29 sample output= Twenty nine sample input=17001 sample output= out of range sample input=119 sample output =one hundred and nineteen sample input=500 sample output=five hundred

3878


How to Check if File Exists?

522


Write a code snippet to display an integer in a binary format?

647


I have a file which contains so many lines and variable number of lines are treated as a record. For example *first ooooo xxxxx ttttt mmmm vvvvvvv *end uuu bbbb *first kkkkvvvvvv nnnn mmmmm kkkkk fffff gggg ffff kkkk lllll *end. Here the lines from *first to *end are treated as a record. The number of lines between *first and *end is not same for all the records. Suppose there are 100 records (or number of records are not predefined)like the format given in the above example. Now the entire file needs to split into two files, first having 40 and remaining in the second file. Can we split using sort utility? If possible then what is the sort card?

1916


How to Check if Folder Exists?

564


Reading which Non-Character Key was pressed

1892