logo

CuriousTab

CuriousTab

Discussion


Home C Programming Complicated Declarations See What Others Are Saying!
  • Question
  • What will be the output of the program (in Turbo C under DOS)?
    #include<stdio.h>
    
    int main()
    {
        char huge *near *far *ptr1;
        char near *far *huge *ptr2;
        char far *huge *near *ptr3;
        printf("%d, %d, %d\n", sizeof(ptr1), sizeof(ptr2), sizeof(ptr3));
        return 0;
    }
    


  • Options
  • A. 4, 4, 8
  • B. 2, 4, 4
  • C. 4, 4, 2
  • D. 2, 4, 8

  • Correct Answer
  • 4, 4, 2 


  • More questions

    • 1. On executing the below program what will be the contents of 'target.txt' file if the source file contains a line "To err is human"?
      #include<stdio.h>
      
      int main()
      {
          int i, fss;
          char ch, source[20] = "source.txt", target[20]="target.txt", t;
          FILE *fs, *ft;
          fs = fopen(source, "r");
          ft = fopen(target, "w");
          while(1)
          {
              ch=getc(fs);
              if(ch==EOF)
                  break;
              else
              {
                  fseek(fs, 4L, SEEK_CUR);
                  fputc(ch, ft);
              }
          }
          return 0;
      }
      

    • Options
    • A. r n
    • B. Trh
    • C. err
    • D. None of above
    • Discuss
    • 2. What will the function randomize() do in Turbo C under DOS?

    • Options
    • A. returns a random number.
    • B. returns a random number generator in the specified range.
    • C. returns a random number generator with a random value based on time.
    • D. return a random number with a given seed value.
    • Discuss
    • 3. What do the following declaration signify?
      char *scr;

    • Options
    • A. scr is a pointer to pointer variable.
    • B. scr is a function pointer.
    • C. scr is a pointer to char.
    • D. scr is a member of function pointer.
    • Discuss
    • 4. Point out the error in the program?
      #include<stdio.h>
      #include<string.h>
      void modify(struct emp*);
      struct emp
      {
          char name[20];
          int age;
      };
      int main()
      {
          struct emp e = {"Sanjay", 35};
          modify(&e);
          printf("%s %d", e.name, e.age);
          return 0;
      }
      void modify(struct emp *p)
      {
           p ->age=p->age+2;
      }
      

    • Options
    • A. Error: in structure
    • B. Error: in prototype declaration unknown struct emp
    • C. No error
    • D. None of above
    • Discuss
    • 5. What will be the output of the program?
      #include<stdio.h>
      int i;
      int fun();
      
      int main()
      {
          while(i)
          {
              fun();
              main();
          }
          printf("Hello\n");
          return 0;
      }
      int fun()
      {
          printf("Hi");
      }
      

    • Options
    • A. Hello
    • B. Hi Hello
    • C. No output
    • D. Infinite loop
    • Discuss
    • 6. What will you do to treat the constant 3.14 as a long double?

    • Options
    • A. use 3.14LD
    • B. use 3.14L
    • C. use 3.14DL
    • D. use 3.14LF
    • Discuss
    • 7. If a char is 1 byte wide, an integer is 2 bytes wide and a long integer is 4 bytes wide then will the following structure always occupy 7 bytes?
      struct ex
      {
          char ch;
          int i;
          long int a;
      };
      

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 8. If the following program (myproc.c) is present in the directory "C:\TC" then what will be output of the program if run it from DOS shell?
      /* myproc.c */
      #include<stdio.h>
      
      int main(int argc, char *argv[])
      {
          printf("%s", argv[0]);
          return 0;
      }
      

    • Options
    • A. SAMPLE.C
    • B. C:\TC\MYPROC.EXE
    • C. C:\TC
    • D. Error
    • Discuss
    • 9. What will be the output of the program (sample.c) given below if it is executed from the command line?
      cmd> sample Jan Feb Mar
      /* sample.c */
      #include<stdio.h>
      #include<dos.h>
      
      int main(int arc, char *arv[])
      {
          int i;
          for(i=1; i<_argc; i++)
              printf("%s ", _argv[i]);
          return 0;
      }
      

    • Options
    • A. No output
    • B. sample Jan Feb Mar
    • C. Jan Feb Mar
    • D. Error
    • Discuss
    • 10. What will be the output of the program?
      #include<stdio.h>
      int main()
      {
          int i=-3, j=2, k=0, m;
          m = ++i && ++j || ++k;
          printf("%d, %d, %d, %d\n", i, j, k, m);
          return 0;
      }
      

    • Options
    • A. 1, 2, 0, 1
    • B. -3, 2, 0, 1
    • C. -2, 3, 0, 1
    • D. 2, 3, 1, 1
    • Discuss


    Comments

    There are no comments.

Enter a new Comment