-->



Samsung Placement Paper



1.What is the value of EOF? ans=-1

2.
class test{ };
int main()
{
cout<<sizeof(test);
return 0;
}
ans=1

3.
class test
{
static int x;
int* ptr;
}
int main()
{ test t1;
cout<<sizeof(t1)<<sizeof(test);return 0;
}
Ans: 4 4

4.
char* str="hello\0world\0";
main()
{
printf("%s",str);
str=str+5;
printf("%s",str);
str=str+7;
printf("%s",str);
}
check the output
in some ques there may be error also.

5.
char* fun()
{ return("samsung india");
}
main()
{
printf("%s",printf("electronics")+fun());
}
Ans: electronicsia

6.main()
{
char* ptr={"samsung","electronics","india"};
char**ptr1;
ptr1=ptr;
now some operations were done on ptr1 and printf was used.i don't remember exactly What ws it.it was like *ptr1++, ++*ptr1 etc.try at ur own.

7.main()
{
extern int i;
{
int i=20;
printf("%d",i);
}
}
Ans: linker error

8.one ques ws frm void pointer.increment operation ws performed on void pointer in a small code given.ans ws it ws error in code.we can't increment void pointer.
9.struct book arr[10];
How to access the next elemnent in arr.
since arr is an array of 10 variables of book type, so to access the next alement add the sizeof(struct) in the base address of the arr.

10. main()
{
int i=10;
switch(i)
{
printf("something here");
case 10:
printf("case10");
break;
case 5*2:
printf("another case 10");
break;
default:
printf("its default");
}}
Ans: case statement cannot have expressions in it. so error

Samsung placement paper

Samsung
placement paper-1

Samsung placement paper

Samsung
placement paper-3