logo

CuriousTab

CuriousTab

Discussion


Home Technical Questions Programming Comments

  • Question
  • main() { char s[ ] = "man"; int i; for( i=0; s[ i ]; i++) printf( "n%c%c%c%c", s[ i ], *(s+i), *(i+s), i[s] ); }


  • Options
  • A. mmmm aaaa nnnn
  • B. aaaa mmmm nnnn
  • C. nnnn aaaa mmmm
  • D. None

  • Correct Answer
  • mmmm aaaa nnnn 

    Explanation

    s[i], *(i+s), *(s+i), i[s] are all different ways of expressing the same idea.Generally array name is the base address for that array. Here s is the base address. i is the index number/displacement from the base address. So, indirecting it with * is same as s[i]. i[s] may be surprising. But in the case of C it is same as s[i].


  • Programming problems


    Search Results


    • 1. Which among the following is a system call used for process management

    • Options
    • A. fork()
    • B. exec()
    • C. getppid()
    • D. All the above
    • Discuss
    • 2. main() { fork(); printf(?Hello World!?); } Output for the above unix program is

    • Options
    • A. Hello World!
    • B. Hello World!Hello World!
    • C. Hello World
    • D. None
    • Discuss
    • 3. Which among the following are not the children of Swapper or Scheduler?

    • Options
    • A. Process Dispatcher
    • B. Vhand
    • C. Dbflush
    • D. All the above
    • Discuss
    • 4. What is pre-emptive and non-preemptive scheduling?
    • Discuss
    • 5. What is a daemon?
    • Discuss
    • 6. What will be output of following c code? #include int main() { int x=123; int i={ printf("c" "++") }; for(x=0;x<=i;x++){ printf("%x ",x); } return 0; }
    • Discuss
    • 7. A source program is the program written in which level language ?

    • Options
    • A. Alpha Numeric
    • B. High-Level
    • C. Symbolic
    • D. Machine
    • Discuss
    • 8. main() { char *p; p = "Hello"; printf ("%cn", *&*p); }

    • Options
    • A. H
    • B. Hello
    • C. Compilation error
    • D. H E L L O
    • Discuss
    • 9. Which of the following is not a valid escape code?

    • Options
    • A. "
    • B. \
    • C. '
    • D. =
    • Discuss
    • 10. #define clrscr() 100 main() { clrscr(); printf( "%dn", clrscr() ); }

    • Options
    • A. 100
    • B. 0
    • C. Compilation error
    • D. Exception occurs
    • Discuss


    Comments

    There are no comments.

Enter a new Comment