Skip to content

Instantly share code, notes, and snippets.

View sumendra14289's full-sized avatar

sumendra14289

View GitHub Profile
@sumendra14289
sumendra14289 / FAQ.txt
Created November 19, 2021 07:58
Inheritance and modules
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. What are modules in ruby?
Ans- Just like classes modules are also containers which have methods, variables and consonants. The only differnce is modules can't be instantiated.
3. Does ruby supoorts multiple inheritance?
@sumendra14289
sumendra14289 / MCQ.txt
Created November 19, 2021 07:07
Classes and objects
1. Which function works as constructor in ruby
a. init
b. construct
c. initialize
d. Same as class name
Ans -c
@sumendra14289
sumendra14289 / FAQ.txt
Created November 19, 2021 06:28
Loops and interpolation
1. How does until loop works in ruby?
Ans - Until loop check the condition for every iteration and if the condition provided is false it executes.
2. What are inclusive and exclusive range in ruby?
Ans - Inclusive range - 0..10
start from 0 and go till 10
Exclusive range - 0..10
start from 0 and go till 9
3. Where can we use each do loop?
@sumendra14289
sumendra14289 / FAQ.txt
Created November 19, 2021 05:58
Functions and Exceptions
1. What is the syntax to define a method in ruby?
Ans - Syntax to define a method in ruby is
def method_name [( [arg [= default]]...[, * arg [, &expr ]])]
expr..
end
2. What is exception handling?
Ans - An exception is a event that occurs during the execution of program that terminates the execution of the program.
Exceptions can occur due to faulty code or wrong user input. Exception handling is used to transfer control to an exception handler when these exceptions occur.
@sumendra14289
sumendra14289 / FAQ.txt
Created November 19, 2021 05:12
Conditionals in Ruby
1. What is the syntax to write case statement in ruby?
Ans- The syntax to write a case statement in ruby is.
case expression
when expression 1
# your code
when expression 2
# your code
@sumendra14289
sumendra14289 / FAQ.txt
Created November 19, 2021 04:22
Introduction to Ruby
1. How to run a ruby file on terminal?
Ans - Move to your directory where the ruby file is stored using CD command and then run the command
Ruby File_Name.rb
2. What will be the default type of Input taken from gets method?
Ans - Input taken using gets method is of type string if you want a integer or float types cast the input using to_i and to_f methods.
3. What are the different modes we can open a file in ruby.
Ans - The different modes to open a file in ruby are.
@sumendra14289
sumendra14289 / FAQ.txt
Created November 11, 2021 10:26
Normalization forms
1. What are prime and non prime attributes?
Ans- Attributes that exist in any candidate key are known as prime attributes.
Attributes that are not part of any candidate key are known as non prime attributes.
2. What is partial dependency?
Ans- Partial dependency occurs when a non prime attribute is dependent on part of a primary key.
e.g if {student_name, course} is a candidate key and course -> faculty_name
then course -> faculty_name is a partial dependency.
3. What is Transitive dependency?
@sumendra14289
sumendra14289 / FAQ.txt
Created November 11, 2021 09:42
Schema
1. What is database schema?
Ans- A database schema defines how data is being organized in a database it can also be called the blueprint of database.
2. What are the types of database schema?
Ans-
1- Physical schema- Physical schema tells how data is physically stored in the database. It talks about things like file locations, access paths.
2- Logical schema- Logical Schema gives the logical view that how different tables are related to each other what are the constraints that need to be applied on the data.
3- View schema- This schema describes the end user interaaction with the database. i.e. how the database will apppear to the end user.
@sumendra14289
sumendra14289 / FAQ.txt
Created November 11, 2021 08:01
Functional dependencies
1. What is functional dependency?
Ans-
The functional dependency is a relationship that exists between two attributes. It typically exists between the primary key and non-key attribute within a table.
X → Y
X - is determinant
Y is dependent
x can uniquely identify y in the table
@sumendra14289
sumendra14289 / FAQ.txt
Created November 11, 2021 07:25
normalization introduction
1. What is Normalization?
Ans- Database normalization is a database schema design technique.
Normalization is used for
· Eliminating redundant (useless) data.
· Ensuring data dependencies make sense i.e data is logically stored.
2. Why do we need normalization?
Ans- Normalization is needed becuase redundant data in table causes anomalies while intserting ,updating or deleting the data.
3. Which type of databases should be normalized?