13.04.2013, 10:41
(
Last edited by Y_Less; 13/04/2013 at 11:27 AM.
)
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.
- When including the streamer plugin[№], what licensing restrictions are applied to the rest of your code?
- What is the best way of adding a user system to your mode?
- Which of the following are valid PAWN keywords: stock, inline, state, char, case, and, *then, const, #elif.
- Give two reasons why a macro might be used instead of a function, and two reasons why a function might be more appropriate.
- "defined" is a keyword which can be used with what type of statement: "#if" or "if"?
- 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 5a) Conditional 2) pawn Code:#define B(%0) ((%0) * 42)b) Operator 3) pawn Code:a > 5c) Empty statement 4) pawn Code:a = 5;d) Statement 5) pawn Code:;e) Macro 6) pawn Code:{}f) State 7) pawn Code:b * 7g) Directive 8) pawn Code:=h) Expression 9) pawn Code:<g : g_on>i) Declaration 10) pawn Code:#pragma semicolonj) Definition 11) pawn Code:new c;k) Invalid empty statement - What is an API and an ABI?
- What do the compiler flags "-d", "-O", and "-a" do?
- 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]; - When would "static stock const" be appropriate as a symbol declaration?
- What does this code do:
pawn Code:while (a --> 0)
{
} - Iterators in "foreach" use a "linked list" structure - what does this mean?
- 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.
-
pawn Code:main()
{
new a[] = "hi", b = 42;
Func(a, b, 7);
}
Func(a[], &b, c)
{
new d = numargs();
// HERE.
}
- Write an implementation of "numargs" in pawn.