Skip to content

Instantly share code, notes, and snippets.

@rozer007
rozer007 / Faq.txt
Created December 15, 2021 11:25
File handling and Exception handling in julia
Q1.What is the function of chomp()?
ans: This function is use to remove the newline included while recieving input from the user.
Q2.Is there a finally block in julia?
ans: Yes there is a finally block in julia just like other languages.
Q3.To write a file in what mode does the file has to be opened?
ans: It can we open many ways : append mode,write mode,read write mode etc.
Q4.What does the readline function do?
@rozer007
rozer007 / Faq.txt
Created December 15, 2021 11:04
Enums, Structs and Abstract Type in julia
Q1.How do we define enumeration in julia?
ans: We will use the enum keyword to define a enumerate in julia.
Q2.How can we access the fields of an enum?
ans: we should use :: operator to access the field in an enum.
Q3.How to create an object for a structure?
ans: varname= structure_name(parameter) , this is the syntax for creating an object of a structure.
Q4.What is the use of abstract types in julia?
@rozer007
rozer007 / Faq.txt
Created December 15, 2021 10:35
Functions in julia
Q1.What keyword is use to create a function in julia?
ans: The function keywors is use to create a function in julia.
Q2.What is the syntax for defining a function which accepts varible arguments?
ans: syntax: function name(parameter ...)
#body
end
Q3.What is a higher order function in julia?
ans: A function which takes function as a parameter or return a function.
@rozer007
rozer007 / Faq.txt
Last active December 15, 2021 09:55
Dictionary and set in julia
Q1.Can a key in dictionary can be of any type?
ans: Yes the key can be of any data types and even the values also.
Q2.What is the difference between array and set?
ans: An array is ordered collection of items whereas set is an unordered collection of items.
Q3.Can a set store elements of different data types?
ans: Yes a set can stores elements of multiple data types.
Q4.How can we delete a key from a dictionary?
@rozer007
rozer007 / Faq.txt
Created December 15, 2021 08:11
Arrays and tuples in Julia
Q1. What is the difference between an array and tuples?
ans: Arrays are mutables ordered collection of items whereas tuples are immutables ordered collection of items.
Q2. What is a Array constructor in julia?
ans: Array constructor is function which will help us to create an array of any size or dimension.
Q3.What is the use of splice!() function?
ans: Splice function can be use to remove and add elements in an array.
Q4.What are named tuples?
@rozer007
rozer007 / Faq.txt
Created December 15, 2021 07:29
Loops in julia
Q1. What is the use of global keyword?
ans: Global keyword is use to access the global variable inside a block or a function.
Q2.What does the continue statement do?
ans: The continue statement, when the complier encountered the continue statement it will skip the execution of the rest code inside the loop and next iteration will start.
Q3.What does the break statememt do?
ans: The break statement is used to break out of the loop.
Q4. How can write a do while loop in julia?
@rozer007
rozer007 / Faq.txt
Created December 15, 2021 06:47
String in julia
Q1. Are string mutable in julia?
ans: No They are immutable.
Q2. How is the indexing of string in julia different from other language?
ans: In julia the indexing start from 1 whereas in other languages it start from 0.
Q3.How can we access the last character of a string?
ans: We can use the end keyword to access the last character of a string.
Q4.What is the occurin string use for?
@rozer007
rozer007 / Faq.txt
Created December 15, 2021 06:19
Math and conditional in julia
Q1.Can we use increment(++) or decrement(--) operator in julia?
ans: We can't use increment or decrement operator, instead julia use shorthand assignment opeartor.
Q2.What does the second parameter in the random function defined?
ans: It is use to defined the dimension.
Q3.What is the syntax of ternary operator in Julia?
ans: Syntax: condition ? if true : if false
Q4.What is the exponential operator in julia?
@rozer007
rozer007 / Faq.txt
Created December 15, 2021 05:49
Basics in Julia
Q1. How do we do string interpolation in julia?
ans: We use sigil($) in front of the variable name to interpolate it with the string.
Q2.How can we take input as an integer?
ans: We need to convert the string input to interger using parse function.
Q3.Can we define a global variable explicitly(with data type )in julia?
ans: No we cannot define a global variable explicitly.
Q4.What does the readline function retrun in julia?
@rozer007
rozer007 / Faq.txt
Created December 6, 2021 11:08
Strings in perl
Q1. What is the syntax for multiline strings?
ans: syntax: <<END;
.......
.......
END
Q2.What is the syntax of Substitution operator ( s ):
ans: syntax : s/word/pattern/;
Q3.What operation does rindex function perform?
ans: This function will give the rear/last index of the specific character or a string.