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 :: Basic Concepts

Home > C Programming > Basic Concepts > General Questions

31. What is the output of the following C Program?

#include
void main()
{
printf("sizeof (void *) = %d \n", sizeof( void *));
printf("sizeof (int *) = %d \n", sizeof(int *));
printf("sizeof (double *) = %d \n", sizeof(double *));
printf("sizeof(struct unknown *) = %d \n", sizeof(struct unknown *));
}

Answer: Option A

Explanation:

The pointer to any type is of same size.

Workspace


Tags:  No Tags on this question yet!

32. To print out a and b given below, which printf() statement will be used ?

float a = 3.14;
double b = 3.14;

Answer: Option A

Explanation:

Here, in every option we see that there is a missing terminating " character, which will result to an error.

Hence, to print the values of a and b, the code should be-

printf("%f%f",a,b);

This will give the output as 3.1400003.140000.


Workspace


Tags:  No Tags on this question yet!

Answer: Option D

Explanation:

We want to scan float a and double b.

Option A is incorrect because it will scan both the variables as float.

Option B is incorrect as here variable b will be scanned as long-double type, but we want b to be double type.

Option C is incorrect because here both the variables will be scanned as long-double type.

Option D is incorrect because it should be 'scanf' and not 'scan{', which will create an error. If we correct this then variable a will be scanned as float type and variable b will be scanned as double type.

Workspace


Tags:  No Tags on this question yet!

Answer: Option B

Explanation:

Here, 200 is an integer value, and we are printing a character. Hence, the output will be the character corresponding to the given integer value 200.

For ASCII code 200, the printable character will be "╚ ". 

Hence, the correct option is B.

Workspace


Tags:  No Tags on this question yet!

35. C language is available for which of the following Operating System?

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace


Tags:  nagarro

36. How will you print \n on the screen ?

Answer: Option D

Explanation:

The statement printf("\\n"); prints '\n' on the screen.

Workspace


Tags:  nagarro

37. Assignment operator targets to _____

Answer: Option B

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

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

#include

void main() {
printf("ABCDEFG \n");
printf(4+"ABCDEFG\n");
printf("ABCDEFG\n"+4);
printf("%c\n", "ABCDEFG" [4]);
printf("%c\n", 4["ABCDEFG"]);
}

Answer: Option A

Explanation:

Line 3 is simple that it will print ABCDEFG.

Line 4 and 5 will result to the same output, i.e, it will print the characters from 4th index to (n-1)th index or 6th index. Hence, printing EFG for both the lines.

Line 6 and 7 will also result to the same output, i.e, it will print the character at 4th index position. Hence, printing E for both the lines.

Hence, the output will be ABCDEFG EFG EFG E E.  

Workspace


Tags:  No Tags on this question yet!

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

#include
void main( )
{
int i;
printf("%d", scanf("%d", &i));
}
If input of is given by keyboard is 10.

Answer: Option B

Explanation:

Here, no. of values that are scanned is 1, and we know that printf() function returns the no. of characters as argument. Hence, output will be 1.

Workspace


Tags:  No Tags on this question yet!

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

#include
void main() {
int i =400, j = 300;
printf("%d %d %d %d ");
}

Answer: Option A

Explanation:

In the printf() function we are just printing values, but have it's not specified what values are we actually printing. Therefore, in such a case, it is going to print garbage values.

Workspace


Tags:  No Tags on this question yet!



Most Popular Qs.

Latest MCQ Qs.