This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q1. How to create a empty tables in lua? | |
ans: table_name = { } , this will create a empty table. | |
Q2.What will be the values of an unassigned index in tables? | |
ans: nil | |
Q3. Are tables mutables? | |
ans Yes,tables are mutables. | |
Q4.Are there arrays and vectors in lua? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q1) Can't we use the + operator to concatenate two strings? | |
Ans: No ,In lua to concatenate two strings we should .. operator. eg. st1..st2. | |
Q2) How can we find the length of a string without using the string length function ? | |
ans: We can use # symbol in front of the string to find the length of the string. | |
Q3) Can we access the character of a string using thier indexes? | |
ans: No we can't and if we try to access it will nil value. | |
Q4) what is gmatch function in string? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q1. Does lua have continue keyword ? | |
ans : NO,we can use goto to work like a continue keyword. | |
Q2. What does break statement do? | |
ans: This will terminate the loop. | |
Q3. What type of loop in lua is similar to do while loop in other language? | |
ans: repeat until loop is pretty muat similar to do while since it check the condition after the execution. | |
Q4. what is the syntax of foreach loop in lua for iterating a table? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q1. How can we generate a same random number all the time? | |
ans: We will have to set the randomseed(constant) value to some constant then it will generate same random all the time. | |
Q2. how can we create a local variable in lua? | |
ans: we have use local keyword to create a local variable in lua. eg local x=10. | |
Q3.What is the syntax of ternary operator in lua? | |
ans: var_name = condition and <if true> or <if false> eg. bool=1>10 "right" or "wrong" | |
Q4.What is the math function to find the maximum between two numbers? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q1.How can we accept a integer value from a user ? | |
ans : we use tonumber() function to convert the string input from the user to numbers. | |
Q2.what is the synax for multiline comment in lua? | |
ans: --[[ comments --]] | |
Q3.What will be the default value when we create any variable? | |
ans: nil | |
Q4.How can we check the type of a variable in lua? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q1) What is an elvis operator? | |
ans: It is an operator that give a default value when the original value is null. | |
Q2) Why do we use interface ? | |
ans: We use interface to achieve total abstraction. | |
Q3) Why can't we assign null to a normal variable? | |
ans: Because to eliminate the danger of null references. | |
Q4)What will happen if we assigned null to a normal variable? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q1 can a static method associated with a class having same parameter and retunn typecall delegate? | |
ans : yes , it can be call just the return typr and parameter must be satisfied. | |
Q2 What is a lambda operator? | |
ans: this "=>" is known as the lambda operator in c#. | |
Q3. How can we know that we have reach the end of a file while reading file? | |
ans: we just need to check if the file.ReadLine == null, if null then it had reached the end. | |
Q4 What is anonymous function? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q1 What is the correct way of defining a generic class with only one variable? | |
a. class class_name<T> | |
b. class class_name<Tkey> | |
c. None of the above | |
d. Both a and b | |
ans d | |
Q2 what keyword is use to define enumeration in c# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q1 What type of method is define in interface? | |
ans: Only abstact method can be define in an interface. | |
Q2 Can we write the body of the function in simple method in abstract class. | |
ans : yes we can write the body of the simlpe method but we cannot write for the abstract method. | |
Q3.What type of polymorphism is operator overloading? | |
ans:It is a compile time polymorphism. | |
Q4 what keyword is use to access the abstract method from the abstract class? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What is the need of inheritance? | |
Ans- We use inheritance because it provides us code reusability and reduces our code. It also reduces data redundancy and duplicacy. | |
2. Does C# supoorts multiple inheritance? | |
Ans- No C# only doesn't support multiple inheritance but we can use modules to implement multiple inheritance. | |
3. How can we create a method to override the method in base class | |
ans: we will use the new keyword use the function name while declaring a function for overriding. |