logo

CuriousTab

CuriousTab

Discussion


Home C Programming Strings See What Others Are Saying!
  • Question
  • How will you print \n on the screen?


  • Options
  • A. printf("\n");
  • B. echo "\\n";
  • C. printf('\n');
  • D. printf("\\n");

  • Correct Answer
  • printf("\\n"); 

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

    More questions

    • 1. To print out a and b given below, which of the following printf() statement will you use?
      #include<stdio.h>
      
      float a=3.14;
      double b=3.14;
      

    • Options
    • A. printf("%f %lf", a, b);
    • B. printf("%Lf %f", a, b);
    • C. printf("%Lf %Lf", a, b);
    • D. printf("%f %Lf", a, b);
    • Discuss
    • 2. Which of the following function is more appropriate for reading in a multi-word string?

    • Options
    • A. printf();
    • B. scanf();
    • C. gets();
    • D. puts();
    • Discuss
    • 3. What will be the output of the program if the array begins at address 65486?
      #include<stdio.h>
      
      int main()
      {
          int arr[] = {12, 14, 15, 23, 45};
          printf("%u, %u\n", arr, &arr);
          return 0;
      }
      

    • Options
    • A. 65486, 65488
    • B. 65486, 65486
    • C. 65486, 65490
    • D. 65486, 65487
    • Discuss
    • 4. What will be the output of the program in Turbo C (under DOS)?
      #include<stdio.h>
      
      int main()
      {
          struct emp
          {
              char *n;
              int age;
          };
          struct emp e1 = {"Dravid", 23};
          struct emp e2 = e1;
          strupr(e2.n);
          printf("%s\n", e1.n);
          return 0;
      }
      

    • Options
    • A. Error: Invalid structure assignment
    • B. DRAVID
    • C. Dravid
    • D. No output
    • Discuss
    • 5. Does there any function exist to convert the int or float to a string?

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 6. Which of the following special symbol allowed in a variable name?

    • Options
    • A. * (asterisk)
    • B. | (pipeline)
    • C. - (hyphen)
    • D. _ (underscore)
    • Discuss
    • 7. What will be the output of the program?
      #include<stdio.h>
      typedef unsigned long int uli;
      typedef uli u;
      
      int main()
      {
          uli a;
          u b = -1;
          a = -1;
          printf("%lu, %lu", a, b);
          return 0;
      }
      

    • Options
    • A. 4343445454, 4343445454
    • B. 4545455434, 4545455434
    • C. 4294967295, 4294967295
    • D. Garbage values
    • Discuss
    • 8. Which of the following statements are correct about the program?
      #include<stdio.h>
      int main()
      {
          int x = 30, y = 40;
          if(x == y)
              printf("x is equal to y\n");
      
          else if(x > y)
              printf("x is greater than y\n");
      
          else if(x < y)
              printf("x is less than y\n")
          return 0;
      }
      

    • Options
    • A. Error: Statement missing
    • B. Error: Expression syntax
    • C. Error: Lvalue required
    • D. Error: Rvalue required
    • Discuss
    • 9. What will be the output of the program?
      #define P printf("%d\n", -1^~0);
      #define M(P) int main()\
                   {\
                      P\
                      return 0;\
                   }
      M(P)
      

    • Options
    • A. 1
    • B. 0
    • C. -1
    • D. 2
    • Discuss
    • 10. Can the fixed arguments passed to the function that accepts variable argument list, occur at the end?

    • Options
    • A. Yes
    • B. No
    • Discuss


    Comments

    There are no comments.

Enter a new Comment