arka bandyopadhyay


{ City } kolkatta
< Country > india
* Profession * student
User No # 101046
Total Questions Posted # 0
Total Answers Posted # 5

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 13
Users Marked my Answers as Wrong # 12
Questions / { arka bandyopadhyay }
Questions Answers Category Views Company eMail




Answers / { arka bandyopadhyay }

Question { TCS, 17532 }

program to print upper & lower triangle of a matrix


Answer

#include
#include
void main()
{
int arr[5][5],i,j;
clrscr();
printf("\n");
//upper triangle matrix
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
arr[i][j]=(i+j);
}
}
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
if(j<4-i)
{printf(" ");
}
else printf("%d",arr[i][j]);
}
printf("\n");
}
printf("\n");
//lower triangle matrix
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
if(j>=4-i)
{printf(" ");
}
else printf("%d",arr[i][j]);
}
printf("\n");
}

getch();
}

Is This Answer Correct ?    6 Yes 9 No

Question { TCS, 4150 }

what is d pitfalls of registers variables


Answer

1-As the value of the register variable is to be stored under the processor register which is limited and if processor is of 16 bit we cannot store float values and higher data type values as 2pow(4bytes)=16bits which a 16 bit processor's registor cannot store hence the variable will now act as an automatic variable


2-Register might be busy in some other operation then also register might not be accessible and hence will act as an automatic variable

Is This Answer Correct ?    1 Yes 0 No


Question { CSC, 6736 }

what is the output of the below program & why ?
#include
void main()
{
int a=10,b=20,c=30;
printf("%d",scanf("%d%d%d",&a,&b,&c));
}


Answer

for Gcc compiler the code is producing error infact DevC++ just crashed . But using ANSI turbo C++ Ans is 3 ,
As the number of parameters in the printf() function is 3

Is This Answer Correct ?    1 Yes 0 No

Question { Google, 3314 }

what is the purpose of the code, and is there any problem
with it.

unsigned int v[10];
unsigned int i = 0;
while (i < 10)
v[i] = i++;


Answer

Basically it's a tricky question and the values of v[i] cannot be predicted as there is "i++" which means 'use than change'
that is error associated with the program so using ++i will give us the correct result.

Is This Answer Correct ?    4 Yes 3 No

Question { 3665 }

how to write a cprogram yo get output in the form
*
***
*****
*******
*********
*******
*****
***
*


Answer

#include
#include
void main()
{ int i,j,k,a=4;

k=1;
clrscr();
printf("\n");
for(i=8;i>=0;i--)
{
for(j=0;j<=8 ;j++)


{
if(i>=4)
{
if(j(9-a-1) )
printf(" ");
else
printf(" *");



}
else
{
if(j>(8-k)||j< k)
printf(" ");
else
printf(" *");
}
}
--a;

if(i<4)k++;
printf("\n");
}


getch();
}

Is This Answer Correct ?    1 Yes 0 No