Code Snippets Interview Questions
Questions Answers Views Company eMail

void main() { printf(“sizeof (void *) = %d \n“, sizeof( void *)); printf(“sizeof (int *) = %d \n”, sizeof(int *)); printf(“sizeof (double *) = %d \n”, sizeof(double *)); printf(“sizeof(struct unknown *) = %d \n”, sizeof(struct unknown *)); }

1 7790

char inputString[100] = {0}; To get string input from the keyboard which one of the following is better? 1) gets(inputString) 2) fgets(inputString, sizeof(inputString), fp)

1 4366

Which version do you prefer of the following two, 1) printf(“%s”,str); // or the more curt one 2) printf(str);

1 4980

void main() { int i=10, j=2; int *ip= &i, *jp = &j; int k = *ip/*jp; printf(“%d”,k); }

1 7304

void main() { char ch; for(ch=0;ch<=127;ch++) printf(“%c %d \n“, ch, ch); }

1 11165

Is this code legal? int *ptr; ptr = (int *) 0x400;

1 7592

main() { char a[4]="HELLO"; printf("%s",a); }

CSC,

3 10712

main() { int a=10,*j; void *k; j=k=&a; j++; k++; printf("\n %u %u ",j,k); }

1 13172

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

1 7854

Printf can be implemented by using __________ list.

3 10404

char *someFun() { char *temp = “string constant"; return temp; } int main() { puts(someFun()); }

1 6963

char *someFun1() { char temp[ ] = “string"; return temp; } char *someFun2() { char temp[ ] = {‘s’, ‘t’,’r’,’i’,’n’,’g’}; return temp; } int main() { puts(someFun1()); puts(someFun2()); }

2 8975

main() { char a[4]="HELL"; printf("%s",a); }

Wipro,

3 9715

what mean void creat_object?in public class in this code class A{ public: int x; A(){ cout << endl<< "Constructor A";} ~A(){ cout << endl<< "Destructor A, x is\t"<< x;} }; void create_object(); void main() { A a; a.x=10; { A c; c.x=20; } create_object(); } void create_object() { A b; b.x=30; }

2052

How we print the table of 2 using for loop in c programing?

HCL, Wipro,

14 100360


Un-Answered Questions { Code Snippets }

function to combine two or more arrays

1689


Hello I am hosting remoting within IIS. Everything works just fine as long as I allow anonymous access at the IIS level. When I allow only Windows Authenticated sessions, something very strange happens: If the client activates the remote object with IP address - works fine If the client activates it using a machine name - get http 401 exception is thrown. The exception is thrown when the client calls the remote method. I set the channel's useDefaultCredentials property to true. Any idea how to allow Windows Authentication? Here is the call stack: System.Net.WebException: The remote server returned an error: (401) Unauthorized .. ---> System.ComponentModel.Win32Exception: The target principal name is incorrect at System.Net.NTAuthentication.GetOutgoingBlob(Byte[] incomingBlob, Boolean handshakeComplete) at System.Net.NTAuthentication.GetOutgoingBlob(String incomingBlob, Boolean handshakeComplete) at System.Net.NegotiateClient.DoAuthenticate(String challenge, WebRequest webRequest, ICredentials credentials, Boolean preAuthenticate) at System.Net.NegotiateClient.DoAuthenticate(String challenge, WebRequest webRequest, ICredentials credentials, Boolean preAuthenticate) at System.Net.NegotiateClient.Authenticate(String challenge, WebRequest webRequest, ICredentials credentials) at System.Net.AuthenticationManager.Authenticate(String challenge, WebRequest request, ICredentials credentials) at System.Net.AuthenticationState.AttemptAuthenticate (HttpWebRequest httpWebRequest, ICredentials authInfo) --- End of inner exception stack trace ---

4224


plzzzzzzzzz xplain this code import java.awt.*; import java.awt.event.*; //import java.awt.MenuItem.*; public class MenuForm extends Frame implements ActionListener { MenuBar mb=new MenuBar(); Menu m1=new Menu("Master"); Menu m2 =new Menu("Transactions"); Menu m3=new Menu("Queries"); Menu m4=new Menu("Reports"); Menu m5=new Menu("Daily/Weekly"); Menu m6=new Menu("Housekeeping"); Menu m7=new Menu("About"); Menu m8=new Menu("Utilities/Tools"); Menu m9=new Menu("exit"); MenuItem m11=new MenuItem("consumer master"); MenuItem m12=new MenuItem(""); MenuItem m13=new MenuItem(""); MenuItem m21=new MenuItem("New Connection"); MenuItem m22=new MenuItem("Refill Booking"); MenuItem m23=new MenuItem("Shop Delivery"); MenuItem m51=new MenuItem("Mrk Dlry"); MenuItem m91=new MenuItem("Quit"); /*MenuItem m131=new MenuItem(" "); MenuItem m132=new MenuItem(" "); MenuItem m134=new MenuItem(" ");*/ Font f=new Font("TimesRoman",Font.BOLD,16); Frame f1; public static void main(String args[]) { new MenuForm().setVisible(true); } public MenuForm() { super("Gas Agency Main Menu"); setSize(1280,800); setBackground(Color.lightGray); setLayout(null); setMenuBar(mb); /*m1.setFont(new Font("TimesRoman", Font.BOLD,16)); m2.setFont(new Font("TimesRoman", Font.BOLD,16)); m3.setFont(new Font("TimesRoman", Font.BOLD,16));*/ mb.add(m1); mb.add(m2); mb.add(m3); mb.add(m4); mb.add(m5); mb.add(m6); mb.add(m7); mb.add(m8); mb.add(m9); m1.add(m11); m1.add(m12); m1.add(m13); m2.add(m21); m2.add(m22); m2.add(m23); m5.add(m51); m9.add(m91); //m3.add(m31); /*m13.setEnabled(false); m13.add(m131); m13.add(m132); m13.add(m133); m13.add(m134); m13.add(m135);*/ setVisible(true); /*m11.addActionListener(this); m12.addActionListener(this); m13.addActionListener(this); m2.addActionListener(this); m3.addActionListener(this);*/ m21.addActionListener(this); m22.addActionListener(this); m23.addActionListener(this); /*m31.addActionListener(this); m131.addActionListener(this); m132.addActionListener(this); m133.addActionListener(this); m134.addActionListener(this); m135.addActionListener(this);*/ m51.addActionListener(this); m91.addActionListener(this); } public void actionPerformed(ActionEvent e) { /*if(e.getSource()==m11) { } if(e.getSource()==m12) { } if( (e.getSource()==m131) || (e.getSource() ==m132) || (e.getSource()==m133) || (e.getSource()==m134) || (e.getSource()==m135) ) { }*/ if(e.getSource()==m21) { NewConnection nc=new NewConnection (); nc.setVisible(true); this.dispose(); } if(e.getSource()==m22) { RefillBooking rb=new RefillBooking (); rb.setVisible(true); this.dispose(); } if(e.getSource()==m23) { ShopDelivery sd=new ShopDelivery(); sd.setVisible(true); this.dispose(); } if(e.getSource()==m51) { MarkDelivery mrk=new MarkDelivery(); mrk.setVisible (true); this.dispose(); } if(e.getSource()==m91) { this.dispose(); System.exit(0); } } }

1653


write a program that can LOCATE and INSERT elements in array using c++ programming languages.

3414


Can we run Applet in Web browser with security policy files

2071






Write a program to find sum of the digits of a number in python?

477


I have multiple datasets and I have to search a particular string in all of them at a single time. Please suggest a full jcl or rexx tool for it.

690


How we use ajax in asp.net through javaScript. Please givee me an example.

2488


In a gymnastic competition, scoring is based on the average of all scores given by the judges excluding the maximum and minimum scores. Let the user input the number of judges, after that, input the scores from the judges. Output the average score. Note: In case, more than two judges give the same score and it happens that score is the maximum or minimum then just eliminate two scores. For example, if the number of judges is 5 and all of them give 10 points each. Then the maximum and minimum score is 10. So the computation would be 10+10+10, this time. The output should be 10 because 30/3 is 10.

2361


plzzzzzzzzz xplain this code import java.awt.*; import java.awt.event.*; public class Agency extends Frame implements ActionListener { Label l1,l2,l3,l4; Button b1; TextField t1,t2; String s1,s2,s3,s4; public static void main(String args[]) { new Agency().setVisible(true); } public Agency() { super("Gas Agency Package"); setSize(1280,800); setBackground(Color.lightGray); setLayout(null); // setLayout(new BorderLayout()); t1=new TextField(20); t1.setBounds(440,150,200,30); t1.setBackground(Color.white); t2=new TextField(20); t2.setBounds(440,180,200,30); t2.setBackground(Color.white); t2.setEchoChar('*'); l1=new Label("Gas Agency Package"); l1.setBounds(400,30,300,50); l1.setFont(new Font("TimesRoman",Font.BOLD,25)); l1.setAlignment(Label.CENTER); l2=new Label("Enter your ID and Passoword"); l2.setFont(new Font("TimesRoman",Font.BOLD,20)); l2.setBounds(270,80,300,50); l3=new Label("Enter ID"); l2.setFont(new Font ("TimesRoman",Font.BOLD,20)); l3.setBounds(270,150,120,50); l4=new Label("Enter Passoword"); l2.setFont(new Font ("TimesRoman",Font.BOLD,20)); l4.setBounds(270,180,140,50); add(l1); add(l2); add(l3); add(t1); add(l4); add(t2); b1=new Button("Login"); b1.setBackground(Color.white); b1.setBounds(400,280,100,70); b1.addActionListener(this); add(b1); } public void actionPerformed(ActionEvent e) { if(e.getSource()==b1) { s3="svce"; s4="svce"; s1=t1.getText(); s2=t2.getText(); if(s1.equals(s3) && s2.equals(s4)) { //System.out.println("password is correct"); MenuForm m= new MenuForm(); m.setVisible(true); //this.dispose(); } else { System.out.println("password not correct"); } this.dispose(); } } } plzzzzzzzzz xplain this code

1537


You have been asked to install a servlet engine (tomcat, glassfish, etc.) for a companies servlets. Assuming the company has an existing web/DBMS server (which may or may not be on the same server), explain in detail how would you implement the development project and a deployment solution.

2119


Pls provide basic funtionality Winrunner scripts for Health care domain and Phishing

1150


What is the output, suppose list1 is [1, 3, 2], what is list1 * 2 ?

918


What is a markup language?

369


hai, i want to know how the connectionpool manager work in the java or netbeans.Anybody having the exact code plz give to me i have no idea about that so help me plz

2594