Friday, March 18, 2011

CrazyEngineers Forum - Computer Science & IT Engineering

CrazyEngineers Forum - Computer Science & IT Engineering


IT skills

Posted: 17 Mar 2011 11:45 PM PDT

the It branch has different technologies included in it where it is more useful for the development of the softwares.
<snipped>

Enhance your debugging skills!

Posted: 17 Mar 2011 09:50 AM PDT

Hi CEans

If you think that you are good at debugging then why dont you try some of the debugging questions posted below.Post your output along with the correct code.The one who answers for more number of questions will get a prize from me.I will post more questions as soon as i get the answers for these questions.

1.Please dont use thanks,good,bad etc.Use "like" button if you think that it is good.
2.Dont use sms language.
3.The one who gives correct answer with the executable code will be taken first.
4.Please enclose your program using code tag.

1.what is the output??
Code:

#include<stdio.h>
#include<conio.h>
int main()
{
  char name[]="paradigm";
  fprintf(stdin,"hi");
  scanf("%s",name);
  printf("%s",name);
  getch();
  return 0;
}

2.2.Consider a database 'employees' containing the attributes name,dept_id,salary.. Which of the following subqueries will work?
A) Select * from employees where salary>(select min(salary) from employees group by dept_id));
B) Select * from employees where salary=(select avg(salary) from employees group by dept_id));
C) Select distinct dept_id from employees where salary> any (Select avg(salary) from employees group by dept_id)
D) Select dept_id from employees where salary>all(Select avg(salary) from employees group by dept_id));
E) select name from employees where salary>any(select max(salary) from employees group by dept_id));
F) Select dept_id from employees where salary>all(Select avg(salary) from employees group by avg(salary))
3.what is the output?
Code:

#include<stdio.h>
#include <setjmp.h>
jmp_buf buf;
#include <setjmp.h>
banana() {
printf("3 ");
longjmp(buf, 1);
printf("4 ");
}
main()
{
if (setjmp(buf))
printf("1 ");
else {
printf("2 ");
banana();
}
}

4.what is the output??
Code:

#include<stdio.h>
main ()
{
char *table[] = {“jan”,”feb”,”march”};
char **ptr = &table [1];
printf (“%c”, (*++*--ptr));
}

5.what is the output??
Code:

#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
    int a=20;
    printf("%d,%d",sizeof(++a),++a);
    getch();
    return 0;
}

No comments:

Post a Comment