logo

CuriousTab

CuriousTab

Discussion


Home Technical Questions Programming Comments

  • Question
  • What's the difference between the functions rand(), random(), srand() and randomize()?


  • Correct Answer
  • rand() returns a random number random() returns a random number in a specified range srand() initialise a random number generator with a given seed value randomize() initializes a random number generator with a random value based o time 


  • Programming problems


    Search Results


    • 1. What do the functions atoi(), itoa() and gcvt () do? Show how would you use them in a program.
    • Discuss
    • 2. Point out the error in the following program. main() { char mybuf[] = "Zanzibar" ; char yourbuf[] = " Zienckewiz"; char * const ptr = mybuf; *ptr = 'a'; ptr = yourbuf; }
    • Discuss
    • 3. 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
    • 4. 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
    • 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 will be output when you will execute following c code? #include void main() { switch(2) { case 1L:printf("No"); case 2L:printf("%s","I"); goto Love; case 3L:printf("Please"); case 4L:Love:printf("Hi"); } }

    • Options
    • A. I
    • B. IPleaseHi
    • C. IHi
    • D. Compilation error
    • Discuss
    • 7. Write a c program for linear search.
    • Discuss
    • 8. Rewrite the following set of statements using conditional operators. int a =1, b ; if ( a > 10 ) b = 20;
    • Discuss
    • 9. How many times the following program would print 'Jamboree'? main() { printf ( "\nJamboree"); main (); }
    • Discuss
    • 10. Macro flowchart is also called as

    • Options
    • A. Less Detail flowchart
    • B. More detail flowchart
    • C. Simple detailed flowchart
    • D. None of the above
    • Discuss


    Comments

    There are no comments.

Enter a new Comment