Evolution of C – from past to eternity M1 Test

  1. The _Pragma keyword may be used in the following syntax context:

    • _Pragma( string_literal
    • _Pragma( )
    • _Pragma( variable_name )
    • _Pragma( integer_constant )
  2. The following statement:

    %:include <stdio.h>

    • is invalid
    • contains a specialized preprocessor directive
    • contains reserved identifiers
    • contain a digraph
  3. If the compiler conforms to the ISO standard, its preprocessor defines a symbol named:

    • __ISO_C__
    • __STD_C__
    • __STDC__
    • __ISOC__
  4. The following symbol may(in certain circumstances) be taken as an equivalent of:

    <:

    • a hash
    • a tilde
    • a parenthesis
    • a bracket
  5. The two following declarations of the main() function:

    int main(void) { ... }
    int main() { ... }
    • aren’t equivalent and the latter is highly recommended
    • aren’t the same, but are equivalent
    • are the same
    • aren’t equivalent and the former is highly recommended
  6. Using the older style of function declaration (as below) is:

    float sinf(x) float x; { ... }

    • very convenient as it is more concise than the modern style
    • highly recommended as it is more elegant
    • very risky as the compiler checks neither the number of arguments nor their types
    • a matter of tradition and good taste
  7. Which of the following statements is true?

    • trigraphs are not recognized inside string literals, but digraphs are
    • both trigraphs and digraphs are not recognized inside string literals
    • both trigraphs and digraphs are recognized inside string literals
    • trigraphs are recognized inside string literals, but digraphs aren’t
  8. The term “EBCDIC” refers to data of type:

    • float
    • double
    • void
    • char
  9. Values of the _Bool data type behave as:

    • signed ints
    • signed long ints
    • unsigned ints
    • unsigned long ints
  10. The atexit() function:

    • may not be invoked when the _Exit() function is utilized
    • may not be invoked when the  exit() function is utilized
    • may not be invoked more than once 
    • may be invoked more than once
  11. The following symbol may(in certain circumstances) be taken as an equivalent of:

    ??-

    • a hash
    • a bar
    • a tilde
    • an underscore
  12. Which of the given examples is an older equivalent of the function declaration?

    void f(int n, int m) { return n * m; }

    • void f(n, m) int, int { return n * m; }
    • void f(int, int) n,m { return n * m; }
    • void f(n,m) int n; int m; { return n * m; }
    • void f(int n, m) { return n * m; }
  13. Which of the following statements is true?

    • trigraphs are recognized inside string literals, but digraphs aren’t
    • trigraphs are not recognized inside string literals, but digraphs are
    • both trigraphs and digraphs  are not recognized inside string literals
    • both trigraphs and digraphs  are recognized inside string literals
  14. An empty pair of parentheses put in a function declaration denotes that the function:

    void f(int n, int m) {return n * m;}
    • should be invoked with exactly one argument
    • should be invoked without any arguments
    • should be invoked with no more than three arguments
    • may be invoked with any number of arguments
  15. The size of the following structure is:

    struct stru{
          char a;
          double b;
    };
    • equal to the greater of these two: sizeof(char), sizeof(double)
    • equal to sizeof(char) + sizeof(double)
    • equal to or greater than sizeof(char) + sizeof(double)
    • equal to the lesser of these two sizeof(char), sizeof(double)
  16. The __func__ symbol is a:

    • constant
    • variable 
    • function
    • preprocessor symbol
  17. The use of trigraphs may be necessary if:

    • you write a program for a nob Latin writing system, like Kanji
    • you write a program for a non English speaking customer
    • the encoding system used by your hardware doesn’t contain some of the needed symbols
    • your hardware is too old to adopt modern removable media
  18. The result of the following expression:

    int n ='z' 'a';
    • depends on the encoding system used by a specific hardware platform
    • is always 26
    • is always 25
    • is always 27
  19. Hardware using little endian representation will store a 16-bit long int  value equal to 17 as (bytes at lower addresses are presented first, all bytes in hex):

    • 11 00
    • 10 10 
    • 00 11
    • 01 01 
  20. If a function does not return to its invoker, is should  be declared with the following specifier:

    • Noreturn
    • noreturn
    • _Noreturn
    • _noreturn
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments