IBM Coding Technical Test Papers
IBM Coding Papers |
main()
{
printf("hello");
main();
}
how many times it will print?
what will be the o/p?
int main()
{
char a,b;
printf(“%d%d%d%d”,sizeof(‘A’), sizeof(‘NULL’), sizeof(‘a’), sizeof(main));
}
main(){
main();
}
ans.stack overflow.
enum number { a= -1, b= 4,c,d,e} What is the value of e ?
(a) 7
(b) 4
(c) 5
(d) 15
(e) 3
Which of the choices is true for the mentioned declaration ?
const char *p; and
char * const p;
a) You can't change the character in both
b) First : You can't change the characterr & Second : You can;t change the pointer
c) You can't change the pointer in both
d) First : You can't change the pointer & Second : You can't chanage the character
e) None
A trigger is (a) a statement ..start of database.. (b)statements that r executed as a side effect to the modification to the database (c)... (d)... ans (b)
What will be the result of the following program ?
char *gxxx()
{static char xxx[1024];
return xxx;
}
main()
{char *g="string";
strcpy(gxxx(),g);
g = gxxx();
strcpy(g,"oldstring");
printf("The string is : %s",gxxx());
}
a) The string is : string
b) The string is :Oldstring
c) Run time error/Core dump
d) Syntax error during compilation
e) None of these
Ans. (b)
What will be result of the following program?
void myalloc(char *x, int n)
{x= (char *)malloc(n*sizeof(char));
memset(x,\0,n*sizeof(char));
}
main()
{char *g="String";
myalloc(g,20);
strcpy(g,"Oldstring");
printf("The string is %s",g);
}
a) The string is : String
b) Run time error/Core dump
c) The string is : Oldstring
d) Syntax error during compilation
e) None of these
What does the following statement mean? int (*a)[4] (a)'a' is a pointer to an array of 4 integers (b)'a' is an array of pointers to integer (c)'a' is a pointer to function returning an integer (d)... ans:a
Best method to find out whether a given array already sorted,is sorted or not in min. time ans. insertion sort (check)
A primary key in one table also present in some other table is called (a)foreign key (b)secondary key (c)subordinate key (d)... ans. foreign key
What will the following program do?
void main()
{
int i;
char a[]="String";
char *p="New Sring";
char *Temp;
Temp=a;
a=malloc(strlen(p) + 1);
strcpy(a,p); //Line number:9//
p = malloc(strlen(Temp) + 1);
strcpy(p,Temp);
printf("(%s, %s)",a,p);
free(p);
free(a);
} //Line number 15//
a) Swap contents of p & a and print:(New string, string)
b) Generate compilation error in line number 8
c) Generate compilation error in line number 5
d) Generate compilation error in line number 7
e) Generate compilation error in line number 1
Ans. (b)
In the following code segment what will be the result of the function,value of x , value of y
{unsigned int x=-1;
int y;
y = ~0;
if(x == y)
printf("same");
else
printf("not same");
}
a) same, MAXINT, -1
b) not same, MAXINT, -MAXINT
c) same , MAXUNIT, -1
d) same, MAXUNIT, MAXUNIT
e) not same, MAXINT, MAXUNIT
Ans. (a)
IBM Coding Technical Test Papers
Reviewed by @NA
on
1:12:00 AM
Rating:
No comments: