| Back to Questions Page |
| |
| Question |
UINT i,j;
i = j = 0;
i = ( i++ > ++j ) ? i++ : i--;
explain pls.... |
Rank |
Answer Posted By |
|
Question Submitted By :: Boss |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | (i++ > j++) gives 0 because 0 > 0 is false so it return 0.
before returning 0 i is 1 ,but it is overwrite by 0.
In the Conditional operator false means ,it executes i++;
so i is 1.  |
| Chaneswara Reddy |
| |
| |
| Answer | 1.we know that i=j=0 initially
2.then it will checks the non-incremented 'i' value(i.e 0)
with incremented 'j' value(i.e 1). So obviously condition
is falls.
3.now false statement has to be executed i.e (i--),before
executing this 'i' value is (i.e incremented value)'1'
after executing false condition(i.e i--)the value of 'i'
becomes '0'.
4.So the value of 'i' is '0'.  |
| Raj |
| |
| |
| Question |
Given an int variable n that has been initialized to a
positive value and, in addition, int variables k and
total that have already been declared, use a do...while
loop to compute the sum of the cubes of the first n whole
numbers, and store this value in total . Thus if n equals
4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into
total . Use no variables other than n , k , and total .
|
Rank |
Answer Posted By |
|
Question Submitted By :: Andrew Gargani |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | total=0;
k=1;
do
{
total=total+k*k*k;
k++;
}while(k<=n)  |
| C.muruganandham |
| |
| |
|
|
| |
| Question |
Given an int variable n that has already been declared and
initialized to a positive value, and another int variable
j that has already been declared, use a do...while loop to
print a single line consisting of n asterisks. Thus if n
contains 5, five asterisks will be printed. Use no variables
other than n and j .
|
Rank |
Answer Posted By |
|
Question Submitted By :: Andrew Gargani |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | //1st method..
there is no use of j.as explained below
int j,n=psitive value;
do
{
cout<<"*";
n--;
}while(n!=0);
//2nd we can use j..
int j=0;
do
{
cout<<"*";
j++;
}while(j!=n);  |
| Mahfooz |
| |
| |
| Question |
who was the present cheif governor of reserve bank of india |
Rank |
Answer Posted By |
|
Question Submitted By :: Akshay |
| This Interview Question Asked @ SBI |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Mr.Subbarao  |
| Cud_ramesh |
| |
| |
| Question |
void main()
{
int i=1;
printf("%d%d%d",i,++i,i++);
}
Cau u say the output....? |
Rank |
Answer Posted By |
|
Question Submitted By :: Mariaalex007 |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | 3 3 1  |
| Saurabh Mehra |
| |
| |
| Answer | its .....1 2 2  |
| Ajay [PSNCET] |
| |
| |
| Answer | 2 2 1  |
| Rajababu [PSNCET] |
| |
| |
| Answer | 113  |
| Idds [PSNCET] |
| |
| |
| Answer | 1 2 3  |
| Kanshi Ram [PSNCET] |
| |
| |
| Question |
void main()
{
for(int i=0;i<5;i++);
printf("%d",i);
}
What is the output?.. |
Rank |
Answer Posted By |
|
Question Submitted By :: Mariaalex007 |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Answer is 5..........  |
| Mariaalex007 |
| |
| |
| Answer | declaring int i inside for loop is not available in
traditional 'c'  |
| Kumaran [PSNCET] |
| |
| |
| Answer | we can not declare loop condition variable in c..we can do
in c++.  |
| Mahfooz [PSNCET] |
| |
| |
| Question |
write a profram for selection sort
whats the error in it? |
Rank |
Answer Posted By |
|
Question Submitted By :: Joshin |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | //program for selection sort
#include<stdio.h>
#include<conio.h>
#define MX 100
void selection(int [], int);
void selection(int a[],int n)
{
int minindx,t;
int i,j;
for(i=0;i<n-1;i++)
{
minindx=i;
for(j=i+1;i<n;j++)
{
if(a[j]<a[minindx])
minindx=j;
}
if(minindx!=i)
{
t=a[i];
a[i]=a[minindx];
a[minindx]=t;
}
}
}
void main()
{
int a[MX],i,n;
clrscr();
printf("enter total num of elements:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
selection(a,n);
printf("sorted arrau:\n");
for(i=0;i<n;i++)
{
printf("%d \t",a[i]);
}
getch();
}
 |
| Joshin |
| |
| |
| Question |
To generate the series 1+3+5+7+... using C program |
Rank |
Answer Posted By |
|
Question Submitted By :: S.vyasaraj |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | #include<stdio.h>
#include<conio.h>
void main()
{
int n,i=1,sum=0;
clrscr();
printf("enter the value for n:");
scanf("%d",&n);
while(i<=n)
{
sum=sum+i;
i=i+2;
}
printf("the series is =%d");
getch()
}  |
| S.vyasaraj |
| |
| |
| Answer | the series seems to be infinite . so you need to restrict
it to some ceiling.  |
| Parthibanselvaraj |
| |
| |
| Answer | In the answer Printf function is worng here the value for %
d is not mentioned it would like
printf("the series is =%d", sum);  |
| Naresh Kumar |
| |
| |
| Answer | #include"stdio.h"
#include"conio.h"
void main()
{
int s=0;
for(int i=1;i<100;i++)
{
if(i%2==0)
continue;
s=s+i;
}
printf("The answer is...%d",s);
getch();
}  |
| Mariaalex007 |
| |
| |
| Question |
printy(a=3,a=2)
|
Rank |
Answer Posted By |
|
Question Submitted By :: Gordhanram49 |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | if we want to show result as a=3,a=2..then it ll be written
as
printf("a=3,a=2");
 |
| Guest |
| |
| |
| Answer | the printf function canbe redefined by your program using
typedef and try this.  |
| Parthibanselvaraj |
| |
| |
| Answer | this is the user writtern function...... this is function
definition statement..... it wont recoganize this statement
because no memory will be allocated for this a=3 or 2...
since we didnt declare it first of all/.. this may be the
error  |
| Vignesh1988i |
| |
| |
|
| |
|
Back to Questions Page |