Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.


Please wait...

C Programming :: Declarations and Initializations

21. Which of the following operators in 'C' programming language takes only integer operands?

Answer: Option D

Explanation:

% is the answer cause it always takes both the inputs as integers in c language.

Workspace


Tags:  No Tags on this question yet!

22. Which of the following option is correct for the below program?

#include
void main()
{
int a,b,c;
b=2;
a= 2*(b++);
c = 2*(++b);
}

Answer: Option D

Explanation:

b=2;   

a= 2*(b );..........a=2*2=4   Here post increment of b will take place and b value after this line has executed will become 2 1= 3.

c = 2*( b);  Here pre increment will take place and before the excecution of this line b value will become 3 1=4 hence c= 2*4=8



so o/p= a=4 and c=8.

Workspace


Tags:  No Tags on this question yet!

23. What is the output of the program?

#include
int main () {
int ( *Commprintf) (const char*, ... ) = printf;
Commprintf ( "Hello World");
return 0;
}

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace


Tags:  Commvault

Answer: Option D

Explanation:

A function with the same name cannot have different signatures.



 int func(int); double func(int);



A function with the same name cannot have different return types. 



double func(int);

int func(float);



  A function with the same name cannot have a different number of parameters



.int func(int);int func(float);



 

ShortCut By :: VIKAS KUMAR singh

A function with the same name cannot have different signatures.



 int func(int); double func(int);



A function with the same name cannot have different return types. 



double func(int);

int func(float);



  A function with the same name cannot have a different number of parameters



.int func(int);int func(float);



 

Workspace


Tags:  nagarro

25. What is the output of the following code?

include
void main()
{
int a=0, b=0;
a = (b =75)+9;
printf("\n%d, %d ",a,b);
}

Answer: Option C

Explanation:

a = (b =75) 9;......b value is assigned to 75 so a value will become 75+9= 84.



final value will become a=84 and b=75

Workspace


Tags:  nagarro

Answer: Option A

Explanation:

Assignment operators are used to assign the the values present on the right-hand side to whatever is present on the left-hand side of the operator. The left-hand side can be a variable or a pointer, and the right-hand side can be a variable, a constant, an expression or a function call.

For example-

a=5;    //assigns '5' to 'a'.

On the other hand, 5=a;    //error.

Very often in C, we use the terminology of l-value in error messages. It basically refers to the operands present on the left-hand side of the assignment operator. It can be a variable or a pointer, but should not be a constant.

Hence, from the above theory, we can conclude for sure that assignment operator targets to L-value.

Workspace


Tags:  Wipro

27. What will be output of the following "c" code?

#include
void main()
{
100;
printf("%d",100);
}

Answer: Option B

Explanation:

100;  ...........there was no use of this 100. Its only to confuse the students.

printf("%d",100);  ...... its as simple as to print hello world.  hence 100 is printed.

Workspace


Tags:  No Tags on this question yet!

28.  What will be output of the following "c" code?

#include
void main()
{
int i=10;
i=!i>14;
printf("%d", i);
}

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

29. What will be output of the following "c" code?

#include
void main ( )
{
int i;
for( i=0; i<10; i++,printf("%d", i));
}

Answer: Option D

Explanation:

In a for loop, first the initialization part is checked, then the test condition. If the test condition is true then the body of the loop gets executed. Then, updation part is done, again the test condition is checked. If true then again the body gets executed, and this process goes on until the test condition becomes false.

Now, let's dry run this particular code-

Value of i                        Condition(i<10)                    Updation                        Status

i=0                                    True                                       i=0+1=1                  1 gets printed

i=1                                    True                                       i=1+1=2                  2 gets printed

i=2                                    True                                       i=2+1=3                  3 gets printed

i=3                                    True                                       i=3+1=4                  4 gets printed

i=4                                    True                                       i=4+1=5                  5 gets printed

i=5                                    True                                       i=5+1=6                  6 gets printed          

i=6                                    True                                       i=6+1=7                  7 gets printed

i=7                                    True                                       i=7+1=8                  8 gets printed

i=8                                    True                                       i=8+1=9                  9 gets printed

i=9                                    True                                       i=9+1=10                10 gets printed

i=10                                  False                                            --                               --

Hence, the output will be 12345678910




Workspace


Tags:  No Tags on this question yet!

30. What will be output of the following "c" code?

#include
void main ( )
{
int a=500, b=100,c;
if( !(a>=400))
b=200;
c=200;
printf( "%d %d", b,c);
}

Answer: Option B

Explanation:

In line no 4, a and b are initialized with values 500 and 100 respectively.

In the next line, we have an if condition, let's try to analyze it-

a>=400, which is true as 500>400, so the result is 1, but !1 results to 0. So, the 'if' part now becomes something like if(0), which is false. So, the 'if' part is not executed, which means b is not updated to 200. b remains 100 as it was.

c gets initialzed to 200.

So, the output will be 100 200.

Workspace


Tags:  No Tags on this question yet!



Most Popular Qs.

Latest MCQ Qs.