logo

CuriousTab

CuriousTab

Programming problems


  • 1. How many times i value is checked in the below code? #include int main() { int i = 0; do { i++; printf( "In while loopn" ); } while (i < 3); }

  • Options
  • A. 2
  • B. 3
  • C. 4
  • D. 1
  • Discuss
  • 2. void main() { char good *better, *best; printf( "%d..%d", sizeof(better), sizeof(best) ); }

  • Options
  • A. 1..2
  • B. 4..4
  • C. 4..2
  • D. 2..2
  • Discuss
  • 3. Output of the Program : main() { int i = 1; while (i <= 5) { printf( "%d", i ); if (i > 2) goto here; i++; } } fun() { here : printf( "PP" ); }

  • Options
  • A. 1
  • B. 2
  • C. Compilation error
  • D. Exception occurs
  • Discuss
  • 4. Which Of The Following Statements Is Most Accurate For The Declaration X = Circle()?

  • Options
  • A. x contains a reference to a Circle object
  • B. You can assign an int value to x
  • C. x contains an object of the Circle type
  • D. x contains an int value
  • Also asked in: Database Administrator, IT Trainer, Project Manager, Software Architect

  • Discuss
  • 5. What is the output of this C code? #include void main() { int y = 3; int x = 5 % 2 * 3 / 2; printf("Value of x is %d", x); }

  • Options
  • A. Value of x is 1
  • B. Value of x is 2
  • C. Value of x is 3
  • D. Compile time error
  • Discuss
  • 6. What is the output of this C code? #include void main() { int x = 1, z = 3; int y = x << 3; printf( "%dn", y ); }

  • Options
  • A. -2147483648
  • B. -1
  • C. Run time error
  • D. 8
  • Discuss
  • 7. What would be the output of the following program ? main() { const int x = 5; int *ptrx; ptrx = &x; *ptr = 10; printf ("%d", x); }

  • Options
  • A. 5
  • B. 10
  • C. Error
  • D. Garbage value
  • Discuss
  • 8. Point out the error in the following program. main() { char mybuf[] = "Zanzibar" ; char yourbuf[] = " Zienckewiz"; char * const ptr = mybuf; *ptr = 'a'; ptr = yourbuf; }
  • Discuss
  • 9. What do the functions atoi(), itoa() and gcvt () do? Show how would you use them in a program.
  • Discuss
  • 10. What's the difference between the functions rand(), random(), srand() and randomize()?
  • Discuss

First 3 4 5 ... 7 .. 9 10 Last