Code Snippets Interview Questions

int swap(int *a,int *b) { *a=*a+*b;*b=*a-*b;*a=*a-*b; } main() { int x=10,y=20; swap(&x,&y); printf("x= %d y = %d\n",x,y); }

2647

main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }

22884

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

1977

main() { char *p = “ayqm”; char c; c = ++*p++; printf(“%c”,c); }

2753

int aaa() {printf(“Hi”);} int bbb(){printf(“hello”);} iny ccc(){printf(“bye”);} main() { int ( * ptr[3]) (); ptr[0] = aaa; ptr[1] = bbb; ptr[2] =ccc; ptr[2](); }

3172

main() { int i=5; printf(“%d”,i=++i ==6); }

2272

main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }

5224

void ( * abc( int, void ( *def) () ) ) ();

2520

main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }

2763

main() { char str1[] = {‘s’,’o’,’m’,’e’}; char str2[] = {‘s’,’o’,’m’,’e’,’\0’}; while (strcmp(str1,str2)) printf(“Strings are not equal\n”); }

2327

main() { int i = 3; for (;i++=0;) printf(“%d”,i); }

CSC,

6353

void main() { int *mptr, *cptr; mptr = (int*)malloc(sizeof(int)); printf(“%d”,*mptr); int *cptr = (int*)calloc(sizeof(int),1); printf(“%d”,*cptr); }

2222

void main() { static int i; while(i<=10) (i>2)?i++:i--; printf(“%d”, i); }

5955

main() { int i=10,j=20; j = i, j?(i,j)?i:j:j; printf("%d %d",i,j); }

11682

1. const char *a; 2. char* const a; 3. char const *a; -Differentiate the above declarations.

2497

Un-Answered Questions { Code Snippets }

938

Ask the user to input three positive integers M, N and q. Make the 2 dimensional array of integers with size MxN, where all the elements of I (I = 1,…,M) line will be members of geometrical progression with first element equal to the number of line (I) and denominator q.

2453

Code for Document Validation in XML.NET?

1141

Can we run Applet in Web browser with security policy files

1242

how to create a Draggable element

1029

exception org.apache.jasper.JasperException: java.lang.NullPointerException org.apache.jasper.servlet.JspServletWrapper.handleJs pException(JspServletWrapper.java:491) org.apache.jasper.servlet.JspServletWrapper.service( JspServletWrapper.java:419) org.apache.jasper.servlet.JspServlet.serviceJspFile( JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServ let.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.j ava:717) root cause java.lang.NullPointerException org.apache.struts.taglib.TagUtils.retrieveMessageRes ources(TagUtils.java:1175) org.apache.struts.taglib.TagUtils.message(TagUtils.j ava:1038) org.apache.struts.taglib.bean.MessageTag.doStartTag( MessageTag.java:224) org.apache.jsp.register_jsp._jspx_meth_bean_005fmess age_005f0(register_jsp.java:138) org.apache.jsp.register_jsp._jspService(register_jsp .java:94) org.apache.jasper.runtime.HttpJspBase.service(HttpJs pBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.j ava:717) org.apache.jasper.servlet.JspServletWrapper.service( JspServletWrapper.java:377) org.apache.jasper.servlet.JspServlet.serviceJspFile( JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServ let.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.j ava:717)

2303

How to add flash or *.gif file in edit panel in java?

1296

how to test the orientation of the layout in android.to note any changes in the ui design when change orientation

1767

3. Program to find the Sum of give series. a. (1)+(1+2)+(1+2+3)+(1+2+3+4)+……………………………….. b. 1/1+1/9+1/25+1/49+……………...

3450

an on-line examination application using html jsp servlet and jdbc. including session management and cookies

3231

how to create a Custom Scrollbar

1271

plzzzzzzzzz xplain this code import java.awt.*; import java.awt.event.*; public class Link extends Frame implements ActionListener { Label l1; Button b1; public static void main(String sr[]) { new Link().setVisible(true); } public Link() { super("Warning"); setSize(500,500); setBackground(Color.lightGray); setLayout(null); l1=new Label("There is no Link"); l1.setBounds(0,0,500,460); l1.setFont(new Font("TimesRoman",Font.BOLD,35)); l1.setAlignment(Label.CENTER); add(l1); b1=new Button("QUIT"); b1.setBackground(Color.orange); b1.setBounds(0,460,500,40); b1.addActionListener(this); add(b1); } public void actionPerformed(ActionEvent e) { this.dispose(); } }

884

How can you relate the function with the structure? Explain with an appropriate example.

1770

Code for Searching for Multiple Matches with the MatchCollection Class?

2115

What is the functionality of EnumWindows?

366