Interview Quizz Logo

 
  • Home
  • About Us
  • Electronics
  • Computer Science
  • Physics
  • History
  • Contact Us
  • ☰
  1. Computer Science
  2. Programming Technologies
  3. Terra Interview Question with Answer

Terra Questions and Answers for Viva

Frequently asked questions and answers of Terra in Programming Technologies of Computer Science to enhance your skills, knowledge on the selected topic. We have compiled the best Terra Interview question and answer, trivia quiz, mcq questions, viva question, quizzes to prepare. Download Terra FAQs in PDF form online for academic course, jobs preparations and for certification exams .

Intervew Quizz is an online portal with frequently asked interview, viva and trivia questions and answers on various subjects, topics of kids, school, engineering students, medical aspirants, business management academics and software professionals.




Interview Question and Answer of Terra


Question-1. What is Terra?

Answer-1: Terra is a low-level system programming language that is embedded in and meta-programmed by Lua.



Question-2. Who developed Terra?

Answer-2: Terra was developed by Zachary DeVito and collaborators at Stanford University.



Question-3. How do you install Terra?

Answer-3: You can install Terra from source or use a prebuilt binary from its official repository.



Question-4. How does Terra relate to Lua?

Answer-4: Terra extends Lua, allowing you to write and compile high-performance code using Lua as a meta-programming layer.



Question-5. How do you define a function in Terra?

Answer-5: Using terra function_name(args) body end.



Question-6. How do you call a Terra function from Lua?

Answer-6: By invoking the function like a regular Lua function.



Question-7. How do you print output in Terra?

Answer-7: Using C.printf("Hello, World!\n").



Question-8. How do you declare variables in Terra?

Answer-8: Using var x : int = 10.



Question-9. What types does Terra support?

Answer-9: It supports primitive types like int, double, bool, and structures.



Question-10. How do you perform arithmetic operations in Terra?

Answer-10: Using +, -, *, and / operators like in C.



Question-11. How do you define a structure in Terra?

Answer-11: Using struct Name { field1 : type, field2 : type }.



Question-12. How do you create an array in Terra?

Answer-12: Using var arr : int[10].



Question-13. How do you allocate memory in Terra?

Answer-13: Using C.malloc(size).



Question-14. How do you free allocated memory in Terra?

Answer-14: Using C.free(pointer).



Question-15. How do you perform loops in Terra?

Answer-15: Using for i = 0, N do body end.



Question-16. How do you use if conditions in Terra?

Answer-16: Using if condition then body end.



Question-17. How do you use elseif in Terra?

Answer-17: Using if condition then body elseif other_condition then other_body end.



Question-18. How do you define a Terra function returning a value?

Answer-18: Using terra function_name(args) : return_type body end.



Question-19. How do you pass parameters to a Terra function?

Answer-19: As function arguments, e.g., terra add(a : int, b : int) : int return a + b end.



Question-20. How do you return multiple values in Terra?

Answer-20: Using return value1, value2.



Question-21. What is the role of C.printf in Terra?

Answer-21: It allows calling C?s printf function for formatted output.



Question-22. How do you include C libraries in Terra?

Answer-22: Using C.include("library.h").



Question-23. How do you interact with Lua from Terra?

Answer-23: By using lua to call Lua functions or access Lua variables.



Question-24. How do you define a global variable in Terra?

Answer-24: Using global name : type = value.



Question-25. How do you create a function pointer in Terra?

Answer-25: Using var ptr : &FunctionType = function_name.



Question-26. How do you cast types in Terra?

Answer-26: Using @expression, e.g., @int(3.5).



Question-27. What is JIT compilation in Terra?

Answer-27: Terra functions are JIT-compiled, meaning they are compiled at runtime for efficiency.



Question-28. How do you use metaprogramming in Terra?

Answer-28: By writing Lua code that generates Terra code dynamically.



Question-29. How do you create a macro in Terra?

Answer-29: Using macro function_name(args) return terra code end.



Question-30. How do you interface Terra with existing C code?

Answer-30: By using C.include("header.h") and C.function_name().



Question-31. How do you create a function in Terra that works like a C function?

Answer-31: By defining functions similar to C syntax but using Terra?s features.



Question-32. What is the terra keyword used for?

Answer-32: It defines a function in Terra that can be JIT-compiled.



Question-33. How do you include external C functions in Terra?

Answer-33: Using C.declare("int myfunc(int)");.



Question-34. How do you optimize performance in Terra?

Answer-34: By using low-level memory management and metaprogramming.



Question-35. How do you run Terra code inside Lua?

Answer-35: By using terra.loadstring("terra code")().



Question-36. What is the difference between Terra and Lua?

Answer-36: Lua is an interpreted scripting language, while Terra is a compiled low-level language.



Question-37. Can Terra generate standalone executables?

Answer-37: No, but it can generate compiled object files or libraries.



Question-38. How do you compile a Terra function?

Answer-38: By calling .compile() on the function.



Question-39. How do you call a Terra function from Lua?

Answer-39: By treating it like a Lua function.



Question-40. How do you create an anonymous function in Terra?

Answer-40: Using terra (args) body end.



Question-41. What is type inference in Terra?

Answer-41: Terra can automatically infer types based on usage.



Question-42. How do you use an and condition in Terra?

Answer-42: Using if (a and b) then body end.



Question-43. How do you handle errors in Terra?

Answer-43: By checking return values and using Lua error handling.



Question-44. What is the default integer size in Terra?

Answer-44: The default size is platform-dependent but usually int32.



Question-45. How do you link multiple Terra files?

Answer-45: Using require("filename").



Question-46. How do you generate assembly from Terra code?

Answer-46: Using .printpretty().



Question-47. How do you interact with hardware in Terra?

Answer-47: By using low-level memory operations and calling C libraries.



Question-48. Can Terra work with GPUs?

Answer-48: Yes, by using CUDA or OpenCL libraries.



Question-49. How do you write a recursive function in Terra?

Answer-49: Using terra function_name(args) return function_name(new_args) end.



Question-50. Why use Terra over C?

Answer-50: Terra provides metaprogramming capabilities while maintaining C-like performance.




Tags

Frequently Asked Question and Answer on Terra

Terra Interview Questions and Answers in PDF form Online

Terra Questions with Answers

Terra Trivia MCQ Quiz

FAQ Questions Sidebar

Related Topics


  • API Testing
  • Python
  • AWS Amazon Web Services
  • Java
  • C++
  • JavaScript
  • C#
  • PHP
  • Swift
  • Ruby
  • Kotlin
  • TypeScript
  • Go Golang
  • Rust
  • SQL
  • R
  • MATLAB
  • Perl
  • Scala
  • Dart
  • Haskell
  • Objective-C
  • Shell Scripting Bash
  • Visual Basic VB
  • Lua
  • Groovy
  • F#
  • Julia
  • COBOL
  • Fortran
  • Assembly Language
  • PL/SQL
  • Scratch
  • D
  • Erlang
  • Elixir
  • Clojure
  • Pascal
  • Ada
  • Lisp Common Lisp, Scheme
  • Prolog
  • Apex Salesforce
  • ActionScript
  • ABAP SAP
  • Racket
  • Nim
  • Crystal
  • Smalltalk
  • VHDL
  • Verilog
  • SASS Syntactically Awesome Style Sheets
  • Less CSS Preprocessor
  • CoffeeScript
  • J Sharp
  • Tcl (Tool Command Language)
  • XQuery
  • XSLT
  • OpenCL
  • CUDA
  • OpenGL Shader Language (GLSL)
  • VBScript
  • Solidity (Blockchain/Smart Contracts)
  • Yaml
  • JSON
  • XML
  • GDScript (Godot Engine)
  • UnrealScript (Unreal Engine)
  • Maple
  • Mathematica
  • Max/MSP
  • AutoLISP
  • LabVIEW
  • ScratchJr
  • AWK
  • sed (Stream Editor)
  • PostScript
  • Xojo
  • Q Sharp
  • Ring
  • ActionScript 3
  • OpenEdge ABL
  • RPG (IBM)
  • Inform
  • Modula-3
  • Rebol
  • Tcl/Tk
  • Haxe
  • SML (Standard ML)
  • Eiffel
  • Chapel
  • Red
  • MUMPS
  • PASCAL ABC
  • Icon
  • BCPL
  • Simula
  • SNOBOL
  • Hack (Meta)
  • PowerShell
  • Batch Script
  • AppleScript
  • Glue
  • Oz
  • Io
  • Mercury
  • Wren
  • Genie
  • PureScript
  • MoonScript
  • Turing
  • ALGOL
  • Seed7
  • Kotlin Native
  • Kotlin Multiplatform
  • Elm
  • PureBasic
  • QB64 (QuickBASIC)
  • Nemerle
  • Ocaml
  • Alloy
  • Cobra
  • Forth
  • Ballerina
  • Deno (JavaScript Runtime)
  • WASM (WebAssembly)
  • Z shell (Zsh)
  • Fish Shell
  • Redscript
  • Felix
  • ReScript
  • Agda
  • Idris
  • Coq
  • SPARK
  • Vala
  • PicoLisp
  • Wolfram Language
  • BASH (Bourne Again Shell)
  • Hy (Lisp-like for Python)
  • Terra
  • Boo
  • ATS
  • K (Kdb+)
  • Picat
  • Nimrod
  • Pawn
  • Papyrus (Bethesda Games)
  • J Programming Language
  • X++
  • MQL4/MQL5 (MetaTrader)
  • Transact-SQL (T-SQL)
  • BASH Shell Scripting

More Subjects


  • Computer Fundamentals
  • Data Structure
  • Programming Technologies
  • Software Engineering
  • Artificial Intelligence and Machine Learning
  • Cloud Computing

All Categories


  • Physics
  • Electronics Engineering
  • Electrical Engineering
  • General Knowledge
  • NCERT CBSE
  • Kids
  • History
  • Industry
  • World
  • Computer Science
  • Chemistry

Can't Find Your Question?

If you cannot find a question and answer in the knowledge base, then we request you to share details of your queries to us Suggest a Question for further help and we will add it shortly in our education database.
© 2025 Copyright InterviewQuizz. Developed by Techgadgetpro.com
Privacy Policy