New Quiz
#1

The original topic got moved, so I'm reposting these here. I wanted to make my own advanced quiz after reading a pretty bad one (apparently the NGRP application quiz, but it itself is wrong in places). Note that I love trick questions and questions relating to code theory - most people know how to program basic PAWN so there's no point testing that. This is more a bit of fun, Slice suggested making a website for it but I've not yet, I may also add a few more questions as I think of them.

  1. When including the streamer plugin[№], what licensing restrictions are applied to the rest of your code?

  2. What is the best way of adding a user system to your mode?

  3. Which of the following are valid PAWN keywords: stock, inline, state, char, case, and, *then, const, #elif.

  4. Give two reasons why a macro might be used instead of a function, and two reasons why a function might be more appropriate.

  5. "defined" is a keyword which can be used with what type of statement: "#if" or "if"?

  6. Match following code with their correct descriptors, for example "1a, 2b, 3c". Note that some may be covered by multiple descriptions, in which case choose the most specific:

    1)
    pawn Code:
    #define A 5
    a) Conditional
    2)
    pawn Code:
    #define B(%0) ((%0) * 42)
    b) Operator
    3)
    pawn Code:
    a > 5
    c) Empty statement
    4)
    pawn Code:
    a = 5;
    d) Statement
    5)
    pawn Code:
    ;
    e) Macro
    6)
    pawn Code:
    {}
    f) State
    7)
    pawn Code:
    b * 7
    g) Directive
    8)
    pawn Code:
    =
    h) Expression
    9)
    pawn Code:
    <g : g_on>
    i) Declaration
    10)
    pawn Code:
    #pragma semicolon
    j) Definition
    11)
    pawn Code:
    new c;
    k) Invalid empty statement

  7. What is an API and an ABI?

  8. What do the compiler flags "-d", "-O", and "-a" do?

  9. Describe in detail the difference between these pieces of code:

    pawn Code:
    enum E_DATA
    {
        E_DATA_A,
        E_DATA_B[4],
        E_DATA_C,
        E_DATA_D
    }

    new gData[E_DATA];
    pawn Code:
    #define E_DATA 4
    #define E_DATA_A 0
    #define E_DATA_B 1
    #define E_DATA_C 2
    #define E_DATA_D 3

    new gData[E_DATA];
    pawn Code:
    #define E_DATA (e_DATA:7)
    #define E_DATA_A (e_DATA:0)
    #define E_DATA_B (e_DATA:1)
    #define E_DATA_C (e_DATA:5)
    #define E_DATA_D (e_DATA:6)

    new gData[E_DATA];

  10. When would "static stock const" be appropriate as a symbol declaration?

  11. What does this code do:

    pawn Code:
    while (a --> 0)
    {
    }

  12. Iterators in "foreach" use a "linked list" structure - what does this mean?

  13. I wish to run two different pieces of code, each once per second. Should they be combined in to a single timer, run as two separate timers, or done in some other manner? Explain your answer.

  14. pawn Code:
    main()
    {
        new a[] = "hi", b = 42;
        Func(a, b, 7);
    }

    Func(a[], &b, c)
    {
        new d = numargs();
        // HERE.
    }
    Describe the current "frame" at the point marked "HERE". Include references to the stack, the heap, and registers.

  15. Write an implementation of "numargs" in pawn.
[№]Or any other GPL script.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)