C Language - Functions

You Are Here :: Home > C Language > Functions - General Questions

 
31.

#incude

int main(){
int a=5,b=10;
swap(&a,&b);
printf("%d %d",a,b);
return 0;
}
void swap(int *a,int *b){
int *temp;
*temp =*a;

A. 5 10 B. 10 5
C. 5 5 D. 10 10




32.

void main()

{
int a=1,b=5,c;
clrscr();
c=operation(a,b);
printf("%d",c);
getch();
}
int operation(int a,int b)
{
int c;
c=++a * ++a * b++;
return c;
}
*a=*b;
*b=*temp;
}

A. 35 B. 40
C. 45 D. 55




33.

void swap(int,int);
void main()
{
int a=10,b=15;
clrscr();
printf("Befor swap a=%d ,b=%d",a,b);
swap(a,b);
printf("\nAfter swap a=%d ,b=%d",a,b);
getch();
}
void swap(int a,int b)
{
int c;
c=a;
a=b;
b=c;
}

A. Before swap a=10,b=15
After swap a=10,b=20
B. Before swap a=10,b=15
After swap a=10,b=15
C. Before swap a=10,b=15
After swap a=15,b=20
D. Before swap a=10,b=15
After swap a=15,b=10




34.

#include

int i;
int fun();
int main()
{
while(i)
{
fun();
main();
}
printf("Hello\n");
return 0;
}
int fun()
{
printf("Hi");
}

A. Hello B. Hi Hello
C. No output D. Infinite loop




35.

What is the output of this program?

#include
using namespace std;
class Box
{
double width;
public:
friend void printWidth( Box box );
void setWidth( double wid );
};
void Box::setWidth( double wid )
{
width = wid;
}
void printWidth( Box box )
{
box.width = box.width * 2;
cout << "Width of box : " << box.width << endl;
}
int main( )
{
Box box;
box.setWidth(10.0);
printWidth( box );
return 0;
}

A. 40 B. 5
C. 10 D. 20




36.

What will be output if you will compile and execute the following c code?

void main(){
int a=10;
printf("%d %d %d",a,a++,++a);
}

A. 12 11 11 B. 12 10 10
C. 11 11 12 D. 10 10 12




« previous

1

2

3

4

5

6

7

8

9

...

next »

 
 
 



© 2013 freshersindia.in ® | Copyrights | Terms & Conditions
   Designed by Freshers India
Catch Us on