Talisma Placement Paper |   775

Talisma Placement Paper

                                  Talisma - Model Placement Paper

Technical Questions:

1.
main()
{
char *str;
str=char*malloc(20*sizeof(char));
strcpy(str,"test");
strcat(str,,!,);
printf("%s",str);
}

2. How many times main is get called :
main()
{
printf("Jumboree");
main();
}
ans: till stack overflow.

3. Which statement is true about main :

(i) Varible no. of Arguments can be passed main.
For Jobs Anywhere In India, Register At http://jobspert.com
For Placement Papers & Interview Questions Of Other Companies, Register At http://jobspert.com
(ii) Main can be called from main();
(iii) We can,t pass arguments are passed in main
(iv) main always returns an int

4. Output ?
main()
{
int i,j;
for(i=0,j=0;i<5,j<25;i++,j++);
printf("%d %d",i,j);
}

5.main()
{
int i;
if(i=0) //it,s assisnment not logical operator
printf(" Hell ");
else
printf("Heaven");
}

6.choose correct
(i)stack is automatically cleared
(ii)heap is automatically cleared
(iii)user has to clear stack and heap
(iv)system takes care of ----------

7. What will be the output:
main()
{char *a,*f();
a=f();
printf("%s",a);
}
char *f()
{
return("Hello World");
}

8.What will be the output:
main()
For Jobs Anywhere In India, Register At http://jobspert.com
For Placement Papers & Interview Questions Of Other Companies, Register At http://jobspert.com
{char*a,*f();
a=char*malloc(20*sizeof(char));
a=f();
printf("%s",a);
}
char *f()
{char n[20];
strcpy(n,"Hello World");
return(n);
}

9.What is the error :
main()
{
int j=10;
switch(j)

case 20:
pritnf("Less than 20");
break;
case 30:
printf("Less than 30");
break;
default:
printf("hello");
}

10.which is valid :
(i)char arr[10];
arr="hello";
(ii) char arr[]="hello";

11.what does p in
const char *p
stands for
p can be changed like this

12.main()
{
sturct date {
char name[20];
int age ;
float sal;
};
sturct data d ={"rajesh"};
printf("%d%f",d.age,d.sal);
}
tell the output

13.main()
{
int i=7;
printf("%d"i++*i++);
}
output

14.void main()
{
int d ;
int i=10;
d =sizeof(++i);
printf("%d");
}
output

15. main()
{
int n=39,count=0;
while( i & 1) //some condition like this
{
count++;
i>>1;
}
}
value of count?
ans:4

16. #define max 10
main()
{
printf("\n%d",max++);
}
ans:compiler error

17. main()
{
int a[]={1,2,9,8,6,3,5,7,8,9};
int *p=a+1;
int *q=a+6;
printf("\n%d",q-p);
}
ans:5

18.
#include <stdio.h>
void temp(int i)
{
if(i == 10) return;
i++ ;
temp(i);
printf("%d" , i);
}
int main()
{
temp(1);
}
Output :

19.
int func (int (*)(int) , int);
int cube(int n)
{
return (n*n*n);
}
int main()
{
prinf("%d" , func(cube , 4));
}
int func(int (*tmp)(int in) , int n)
{
int res , i;
for(i = 1 ; i <= n ; i++)
res += *(tmp)(i);
return res;
}
Output :

20. What is the output of the program
#include<stdio.h>
#include<conio.h>
void main()
{
int i=1*4/3-27%3^2+100*0.5-(4>3?1:2);
clrscr();
printf("%d",i);
getch();
}
// A. 49
// B. compile error
// c. 51
// D. 48
Ans: b

feedback