A PHP Error was encountered

Severity: Warning

Message: fopen(/var/lib/php/sessions/ci_session3ne7v6oe9tgrjnpck1jkjjka148o1420): failed to open stream: No space left on device

Filename: drivers/Session_files_driver.php

Line Number: 176

Backtrace:

File: /var/www/interviewmania.com/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_start(): Failed to read session data: user (path: /var/lib/php/sessions)

Filename: Session/Session.php

Line Number: 143

Backtrace:

File: /var/www/interviewmania.com/index.php
Line: 315
Function: require_once

C-Library-Functions Easy Questions and Answers | Page - 6

C-Library-Functions


  1. Which of these is a correct way to generate numbers between 0 to 1(inclusive) randomly?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    rand() % 2


  1. In the following C program everytime program is run different numbers are generated.
    #include <stdio.h>
    int main()
    {
    srand(time(NULL));
    printf("%d\n", rand());
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    True



  1. In the below program everytime program is run different numbers are generated.
    #include <stdio.h>
    #include <stdlib.h>
    int main()
    {
    printf("%d\n", rand());
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    False


  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    srand(time(NULL));
    printf("%d\n", rand());
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    An integer in the range 0 to RAND_MAX



  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    printf("%d\n", srand(12000))
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Compilation Error

    main.c: In function ‘main’:
    main.c:4:24: warning: implicit declaration of function ‘srand’; did you mean ‘scanf’? [-Wimplicit-function-declaration]
    printf("%d\n", srand(12000))
    ^~~~~
    scanf
    main.c:5:9: error: expected ‘;’ before ‘return’
    return 0;
    ^~~~~~