ABB Technical Sample Questions
ABB Technical Sample Questions
#include
main()
extern int a;
printf("%d",a);;
int a=20;
main()
https://www.freshersnow.com/
int a[5]={2,3};
printf("\n %d %d %d",a[2],a[3],a[4]);
main()
inti=-3,j=2,k=0,m;
m=++i&&++j||++k;
printf("\n %d %d %d %d",i,j,k,m);
https://www.freshersnow.com/
main()
int a,b;
a=sumdig(123);
b=sumdig(123);
printf("%d %d",a,b);
sumdig(int n)
int d;
if(n!=0)
https://www.freshersnow.com/
d=n%10;
n=(n-d)/10;
s=s+d;
sumdig(n);
else return(s);
main()
int a,b=3;
https://www.freshersnow.com/
a=CUBE(b++);
printf("\n %d %d",a,b);
main()
printf("%d",x);
get()
return(20);
https://www.freshersnow.com/
}
(a) int **a; (b) int a; (c) int *a; (d) int a=5;
main()
int l=1;
for(;;)
https://www.freshersnow.com/
printf("%d",l++);
if(l>10)
break;
(a) The condition in the for loop is a must (b) The two semicolons should be dropped
(c) The for loop should be replaced by awhile loop (d) No error
int main(void)
char strA[10]="compile",strB[10];
my_strcpy(strB,strA);
puts(strB);
https://www.freshersnow.com/
}
char *p=destination;
while(*source!='\0')
*p++=*source++;
*p='\0';
return destination;
(a) Compilation will only give a warning but will proceed to execute & will display "compile"
(b) The compilation error char *(char *,char *) differs in levels of indirection from 'int()' will
occur
https://www.freshersnow.com/
(c) Yes & it will print compile on the screen (d) None of the above
#include
main()
char str[5]="fast";
printf("%s",ptr_to_array);
(a) Compilation will only give a warning but will proceed to execute & will display "fast"
(b) display "fast" on screen (c) will give a compilation error (d) none of the above
main()
https://www.freshersnow.com/
{
int num,*p;
num=5;
p=#
printf("%d",*p);
main()
int a[3]={2,3,4};
char *p;
p=a;
https://www.freshersnow.com/
p=(char *)((int *)p+1);
printf("%d",p);
main()
int i=10;
fn(i);
printf("%d",i);
fn(int i)
https://www.freshersnow.com/
return ++i;
14. What will be the value of i & j after the loop isexecuted?
for(i=0,j=0;i<5,j<25;i++,j++)
main()
int i,j;
i=10;
j=sizeof(++i);
printf("%d",i);
https://www.freshersnow.com/
}
main()
int i=7;
printf("%d\n",i++*i++);
main()
char *p,*f();
https://www.freshersnow.com/
p=f();
printf("f() returns:%s\n",p);
char *f()
char result[80];
return (result);
(c) compilation error (d) The printf statement is not going to be executed
main()
https://www.freshersnow.com/
{
printf("\n Jamboree");
main();
(c) 65535 times (d) till the stack does not overflow
19.Notice the error in the default statement in the code snippet below.Will it give a compilation
error?
main()
int a=10,j;
j=fn(a);
switch(j)
https://www.freshersnow.com/
case 30: printf("the value is 30");
break;
break;
fn(int a)
return (++a);
(a) Will display "the value is 30" (b) Will display "The value is not 30 or 50"
https://www.freshersnow.com/
(d) No compilation errors but there will be no output on the screen
main()
struct emp
char name[20];
int age;
float sal;
};
printf("\n %d %f",e.age,e.sal);
https://www.freshersnow.com/
(a) 0 0.000000 (b) Garbage values (c) Error (d) none of the above
https://www.freshersnow.com/