Advanced C | Summary Test

  1. The setjmp() function behaves as it had:

    • one entry and one exit
    • more than one entry and one exit
    • one entry and more then one exit
    • more than one entry and more than one exit
  2. The following code:

    #include <stdio.h>
    #include <complex.h>
    int main(void){
        float _Complex cplx = 1 + 1i;
        return 0;
    }
    • will be successfully compiled by ANSI C compatible compiler
    • will be successfully compiled by C90 compatible compiler
    • in invalid 
    • will be successfully compiled by C11 compatible compiler
  3. The difference between stat() and lstat() function lies in:

    • different approach to symbolic links
    • result types
    • parameters numbers
    • different approach to directly names
  4. The normalized float value:

    • has the highest significand’s bit set to 0
    • has the highest exponent’s bit set to 0
    • has the highest significand’s bit set to 1
    • has the highest exponent’s bit set to 0
  5. The va_copy() function is designed to copy:

    • one instance of va_list to another 
    • one variadic parameter to another 
    • one variadic argument to another 
    • one variadic function to another
  6. The FP_SUBNORMAL flag marks a float value that:

    • exceeds any of IEEE defined limits
    • has to be normalized
    • has been successfully normalized
    • cannot be normalized
  7. The SSIZE_MAX symbol determines a maximum:

    • length of source file
    • size of any array
    • value of short int data
    • length of data transferred by read() and write() functions
  8. The memory block allocated by realloc():

    • is fully filled with zeros
    • retains its previous content and fills the newly allocated part with zeros
    • is fully filled with random value
    • retains its previous content and does not initialize then newly allocated part
  9. The ioctl() function is used to:

    • set and unset environment variable 
    • communicate with devices at OS level
    • evaluate mantissa length 
    • setting scanf() / printf() conversion modes
  10. The va_arg, an entity coming from <stdarg.h> , actually is a:

    • type
    • macro
    • variable 
    • function
  11. Assuming that the x variable is of type int , the following condition:

    x < x +1
    • is invalid 
    • is always false 
    • is always true
    • is unpredictable
  12. What is the expected output of the following code?

    #include <stdarg.h>
    #include <stdio.h>
    int f(int n, ...){
         va_list list;
         va_start(list,n);
         char c;
         while(va_arg(list, int) != 0)
              c = va_arg(list, int);
         va_end(list);
         return c;
    }
    int main(void) {
        printf("[%c]\n", f('a', 'b', 'c', '\0'));
        return 0;
    }
    • b
    • c
    • an empty line
    • a
  13. The atexit() function:

    • may not be invoked more than once
    • may be invoked more than once
    • may not be invoked when the _Exit() function is utilized
    • may not be invoked when the exit() function is utilized 
  14. Which of the following pairs present valid way of coding UNICODE code-points using hexadecimals?

    • \u1234 and \U1234ABCD
    • \w1234abcd and \w1234
    • the code falls in an infinitive loop
    • \u1234abcd and \U1234
  15. In MS Windows environment the thread’s text has to be placed in a function using the following header:

    • void thread(LPVOID data)
    • DWORD WINAPI thread(LPVOID data)
    • void thread(void)
    • DWORD WINAPI thread(void)
  16. To force the compiler to store the variable inside CPU instead of RAM you can use:

    • the external specifier
    • the const specifier
    • the register specifier
    • the static specifier
  17. The so-called” calling convention ” determines:

    • the way in which the programmer builds functions’ interface
    • the possible argument names
    • the way in which the arguments are put on and cleared off the stack
    • the possible function names
  18. The following invocation:

    sendto(sockfd, buf, len, flags, NULL, 0);
    • is an equivalent of send(sockfd, buf, len);
    • is an equivalent of send(sockfd, buf, len, flags);
    • is an equivalent of send(scokfd, buf);
    • is an equivalent of send(sockfd);
  19. The “st_dev” filed of “struct stat” in MS Windows environments reflects:

    • device location
    • the drive number
    • 32 bit long device identifier 
    • device vendor’s name
  20. Current rounding mode may be determined by means of the:

    • fegetround() function
    • roundmode() function
    • feroundmode() function
    • getround() function
  21. The volatile specifier:

    • tells the compiler to not use the variable
    • is obsolete
    • suggest the compiler to store the variable in one of CPU registers
    • forces the compiler to fetch the variable from memory each time it is read
  22. Passing the NULL values as the first strtok() argument causes

    • runtime error
    • the function to iterate through the string
    • the function to repeat last find
    • the function to start the find process
  23. The recvfrom() function retains received data in input buffers if it is invoked with flag:

    • MSG_WAIT
    • MSG_HOLD
    • MSG_KEEP
    • MSG_PEEK
  24. One of the following snippet is valid-which one?

    • void f{return __func__;}
    • char f{return __func__;}
    • double f{return __func__;}
    • char f{return __func__[0];}
  25. Assuming that the code was compiled and ran in Unix/Linux environment what is its expected output?

    #include <sys/types.h>
    #include <sys/wait.h>
    #include <stdio.h>
    #include <unistd.h>
    int x = 0;
    int main(void) {
        if(fork()){
          wait(NULL);
             printf("%d", x);
          return 0;
        }else{
                x++;
              return 0;
        }
    }
    • 2
    • 1
    • 0
    • an empty line
  26. The MSG_DONTWAIT flag  makes the sendto() function:

    • to be invoked in asynchronous way
    • return immediately
    • scan sent data for specified patterns
    • wait for confirmation
  27. The structure defined in the following way reflects the content of a system file named:

    struct <?> {
          char *s_name;
          char **s_aliases;
          int s_port;
          char *s_proto;
    }
    • protocols
    • services
    • password
    • hosts
  28. A part of a code which may not be executed in more than one thread in the same time is called:

    • one-way thread
    • subthread
    • critical section
    • mutexed code
  29. The so-called “designated initializer” is a way of initializing:

    • vectors
    • functions
    • indices
    • structures
  30. If you put a pin in a random place of number line, the distance to closet representable float value is:

    • greater than ULP
    • not greater than half of ULP
    • equal to ULP
    • equal to half of ULP
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments