New Quiz - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Discussion (
https://sampforum.blast.hk/forumdisplay.php?fid=84)
+---- Thread: New Quiz (
/showthread.php?tid=430265)
New Quiz -
Y_Less - 13.04.2013
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) | a) Conditional |
2) pawn Code: #define B(%0) ((%0) * 42)
| b) Operator |
3) | c) Empty statement |
4) | d) Statement |
5) | e) Macro |
6) | f) State |
7) | g) Directive |
8) | h) Expression |
9) | i) Declaration |
10) | j) Definition |
11) | 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:
- 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.
}
Describe the current "frame" at the point marked "HERE". Include references to the stack, the heap, and registers.
- Write an implementation of "numargs" in pawn.
[№]Or any other GPL script.