var keywordlocal or without any keywordlet keyworddef keywordnil0x = 1, 2, 3x, y, z = 1, 2, 3x: 1, y: 2, z: 3x = {1, 2, 3}local keyword do?
1varvar-name_var1truenil data type represent in Lua?
false in Lua?
nil and false0""nil and 0number type can represent:
typeof()getType()type()checkType()+&..concat()falsenil0undefinedtype(nil) return?
"undefined""null""nil""void""") in Lua?
true or false1 or 0on or offnil with another value using ==?
truefalseconst keywordconstant keywordglobal variableconst_local variable to make it constant in Lua?
local__newindex_nil__add__index__newindex__callconst.PI = 3.14 do if PI is protected by a metatable?
number?
constlocalglobal const| Qno | Answer |
|---|---|
| 1 | b) A storage location identified by a name |
| 2 | b) Using local or without any keyword |
| 3 | b) Variable types can change at runtime |
| 4 | b) It returns nil |
| 5 | b) x, y, z = 1, 2, 3 |
| 6 | b) Declares a block-scoped variable |
| 7 | c) _var1 |
| 8 | c) Array |
| 9 | a) An undefined value |
| 10 | a) nil and false |
| 11 | c) Both integers and floating-point numbers |
| 12 | c) type() |
| 13 | c) Using .. |
| 14 | b) nil |
| 15 | c) "nil" |
| 16 | a) 0 |
| 17 | a) true or false |
| 18 | b) It always returns false |
| 19 | b) No, but it can be implemented through metatables |
| 20 | b) Using metatables to restrict modifications |
| 21 | a) No |
| 22 | c) It throws an error |
| 23 | a) Hold reusable values |
| 24 | b) Use metatables with __newindex |
| 25 | a) Storing configuration settings |
| 26 | c) __newindex |
| 27 | c) Throw an error |
| 28 | b) No, unless using a metatable wrapper |
| 29 | a) Encapsulating values in a function |
| 30 | d) All of the above |