Languages-C & C Plus Plus [3i Infotech Placement]: Sample Questions 138 - 140 of 354

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 138

C & C Plus Plus
Edit

Write in Short

Short Answer▾

What is the output of the following program?

  1. main ()
  2. {
  3.     charnot;
  4.     not =! 2;
  5.     printf ( “%d” not);
  6. }

Explanation

In a program

Table Shows the Program
char not;Given the character variable
not = ! 2;
  • ! Is a logical operator.
  • In C the value 0 is considered to be the Boolean value FALSE, and any non-zero value is considered to be the Boolean value TRUE.
  • Here 2 is a non-zero value so TRUE.
  • ! TRUE is FALSE (0)
printf ( “% d” not) ;This prints 0.

Question 139

C & C Plus Plus
Edit

Write in Short

Short Answer▾

What is the maximum combined length of command line arguments including the space between adjacent argument?

Explanation

  • It may vary from one operating system to another.
  • C does not impose any limits on command line on length or number of command line arguments.
  • Actual value of INT_MAX and SIZE_MAX are implementation defined by the OS.

Question 140

C & C Plus Plus
Edit

Describe in Detail

Essay▾

What is the output of the following program?

  1. main ()
  2. {
  3.     floatf =5, g =10;
  4.     enum { i =10, j =20, k =50};
  5.     printf ( “%d” ++ k);
  6.     printf ( “%f” f2);
  7.     printf ( “%lf” f%g);
  8.     printf ( “%lf” fmod (f, g) );
  9. }

Explanation

Line no 5: Error: L value required

Line no 6: Cannot apply leftshift to float

Line no 7: Cannot apply mod to float

In the program

Table Shows the Program
float f = 5, g = 10;
  • Define the floating variable f and g and value is 5 and 10 continue
enum {i = 10, j = 20, k = 50} ;
  • Define the enumeration constants
printf ( “% d” ++ k) ;
  • Enumeration constants cannot be modified, so you cannot apply ++ .
printf ( “% f” f << 2) ;

printf ( “% lf” f % g) ;

  • Bit-wise operators and % operators cannot be applied on float values.
printf ( “% lf” fmod (f, g) ) ;
  • fmod () is to find the modulus values for floats as % operator is for ints.
Lvalues and Rvalues in Image

Developed by: