MCQs on Introduction to Lua | Lua

1. What is Lua?

  1. Lua is a:
    • a) Low-level programming language
    • b) High-level scripting language
    • c) Database query language
    • d) Operating system
  2. Who created Lua?
    • a) Dennis Ritchie
    • b) Guido van Rossum
    • c) Roberto Ierusalimschy and team
    • d) James Gosling
  3. What does the word “Lua” mean?
    • a) Code
    • b) Moon
    • c) Light
    • d) Star
  4. Lua was primarily designed for:
    • a) Web development
    • b) Embedded systems
    • c) Artificial Intelligence
    • d) Database management
  5. Lua’s first version was released in:
    • a) 1990
    • b) 1993
    • c) 2000
    • d) 2010

2. Lua’s Applications and Features

  1. Which industry heavily uses Lua?
    • a) Aerospace
    • b) Gaming
    • c) Biotechnology
    • d) Real Estate
  2. Which of these is NOT a key feature of Lua?
    • a) Portability
    • b) Garbage collection
    • c) Built-in GUI library
    • d) Extensibility
  3. Lua is commonly used in game engines like:
    • a) Unreal Engine
    • b) CryEngine
    • c) Roblox and Corona SDK
    • d) Flutter
  4. Lua’s syntax is inspired by which language?
    • a) C
    • b) Python
    • c) JavaScript
    • d) SQL
  5. What makes Lua efficient for embedding?
    • a) Its large size
    • b) Complex architecture
    • c) Lightweight and simple design
    • d) Strong typing system

3. Setting Up Lua Environment

  1. To run Lua scripts, you need:
    • a) Lua interpreter
    • b) Python interpreter
    • c) Java JDK
    • d) Node.js
  2. What command is used to check Lua’s version in the terminal?
    • a) lua --info
    • b) lua -v
    • c) lua --help
    • d) lua -version
  3. What file extension is used for Lua scripts?
    • a) .lua
    • b) .py
    • c) .rb
    • d) .js
  4. Which popular IDE supports Lua scripting?
    • a) Visual Studio Code
    • b) NetBeans
    • c) PyCharm
    • d) Xcode
  5. What is required to embed Lua in another application?
    • a) Lua compiler
    • b) Lua interpreter and C API
    • c) Lua GUI framework
    • d) Lua virtual machine

4. Writing and Running Your First Lua Script

  1. How do you print “Hello, World!” in Lua?
    • a) System.print("Hello, World!")
    • b) print("Hello, World!")
    • c) console.log("Hello, World!")
    • d) output("Hello, World!")
  2. What does print() do in Lua?
    • a) Reads input
    • b) Displays output
    • c) Creates files
    • d) Terminates the program
  3. Lua’s scripts are executed in:
    • a) Sequential order
    • b) Random order
    • c) Reverse order
    • d) Parallel threads
  4. Which command runs a Lua script in the terminal?
    • a) lua run <scriptname.lua>
    • b) execute <scriptname.lua>
    • c) lua <scriptname.lua>
    • d) python <scriptname.lua>
  5. Lua uses which type of typing?
    • a) Static typing
    • b) Dynamic typing
    • c) Weak typing
    • d) Strong typing

5. Miscellaneous Questions

  1. Lua is implemented in:
    • a) Python
    • b) C
    • c) JavaScript
    • d) Java
  2. Lua’s core library includes support for:
    • a) Networking protocols
    • b) Mathematical functions
    • c) Machine learning
    • d) Database transactions
  3. Lua’s garbage collector is:
    • a) Manual
    • b) Automatic
    • c) Semi-automatic
    • d) Non-existent
  4. How does Lua handle errors by default?
    • a) Silently ignores them
    • b) Crashes the program
    • c) Throws exceptions
    • d) Prints an error message
  5. Lua can be used alongside:
    • a) SQL and MongoDB
    • b) JavaScript and Python
    • c) C and C++
    • d) All of the above
  6. Lua’s table structure is equivalent to:
    • a) Arrays
    • b) Hash maps
    • c) Both arrays and hash maps
    • d) Stacks
  7. What syntax is used to define a function in Lua?
    • a) function() {}
    • b) def func()
    • c) function name() end
    • d) fn name() ->
  8. Lua’s standard I/O functions are part of:
    • a) The math library
    • b) The string library
    • c) The base library
    • d) The debug library
  9. Lua handles strings as:
    • a) Immutable objects
    • b) Mutable objects
    • c) References
    • d) Arrays of characters
  10. Lua supports comments in the form of:
    • a) #
    • b) //
    • c) --
    • d) /* */

Answers

QnoAnswer
1b) High-level scripting language
2c) Roberto Ierusalimschy and team
3b) Moon
4b) Embedded systems
5b) 1993
6b) Gaming
7c) Built-in GUI library
8c) Roblox and Corona SDK
9a) C
10c) Lightweight and simple design
11a) Lua interpreter
12b) lua -v
13a) .lua
14a) Visual Studio Code
15b) Lua interpreter and C API
16b) print("Hello, World!")
17b) Displays output
18a) Sequential order
19c) lua <scriptname.lua>
20b) Dynamic typing
21b) C
22b) Mathematical functions
23b) Automatic
24d) Prints an error message
25d) All of the above
26c) Both arrays and hash maps
27c) function name() end
28c) The base library
29a) Immutable objects
30c) --

Use a Blank Sheet, Note your Answers and Finally tally with our answer at last. Give Yourself Score.

X
error: Content is protected !!
Scroll to Top