We have a deal that I won't disclosure name of this company, but it's one of biggest on the market
1. Answer
(2&5)&&(1|2)
false
2.
Write please result
int i=0;
for(;i<=5;i++);
printf(“%d”,i);
6
3. Where is a problem
char *f()
{
char result[80];
sprintf(result,”%s”,"anything will do");
return(result);
}
result placed on the stack
4.
Where is a problem
int i = 0;
#define N 10
int array[N];
for (i=0;i<N;i++)
array[i] = 0;
no any problem here
5. Is something wrong??
char *str = “12345”;
char *p = (char*)malloc(strlen(str));
strcpy(p, str);
strlen() will return size without \0 (size of ASCII but not a ASCIIZ string), so it will BOF
strlen() will return size without \0 (size of ASCII but not a ASCIIZ string), so it will BOF
int main() {
int x[5];
printf(“%p\n”, x);
printf(“%p\n”, x+1);
printf(“%p\n”, &x);
printf(“%p\n”, &x+1);
return 0;
}
Answer
0x23456787
0x2345678b
0x23456787
0x2345679b
Tell me please about 0x23456787 -> It's unaligned, so ARM will fall, but intel and ppc will eat this crap
7. Result of operations
int a = -1;
Write in the hex form
Write in the hex form
0xfffffff
write result of operation
write result of operation
a >>= 1;
the same things
unsigned int b = (unsigned)-1;
b >>= 1;
tell me please about arithmetic and simple shift, where is a difference?
8. Find all sequences with 3 digit that results in sum M
N - array size
M = 7
9 234 2 4 5 7 2 3 4 6 7 8 8 9 5 3 2 1 2 3 4 5 6 7 9 0 0 0 0 3 4 5
6 7 0 0 0 0 0 0 0
(4,3,0)
(4,3,0) - another 0
(7,0,0)
(-9,2,0)
Give please complexity
O(N^3)
No comments:
Post a Comment