magik language interview questions.txt

Download magik language interview questions.txt

If you can't read please download the document

Upload: bada-sainath

Post on 29-Sep-2015

50 views

Category:

Documents


6 download

TRANSCRIPT

0) IntroductionMagik supports both procedural language and object oriented language.Procedural Language:In procedural language all code is in modular fashion. Each module is a collection of statements. Module takes input and executes all statements step by step and gives output.EX:area > pi*radius * radius _endprocIn the above example ,procedure is taking radius as input and returning the circle area as output value. If we want to calculate area of square again we have to write one more procedure with different procedure name, though the purpose of the procedure is to calculate area. In procedural language, maintenance is headache. We can overcome this in oop language.Object Oriented Programming Language: In oop, both data and functionality is combined in a class. We can write methods with same name in different classes. For example ,we can write method area() in different classes. Methods are accessed via their class name. Ex: Circle Class: def_slotted_exemplar(:circle, {})$_method circle.new() >> _clone.init()_endmethod$_method circle.init() _return _self_endmethod$_method circle.area(r) area > _clone.init()_endmethod$_method square.init() _return _self_endmethod$_method square.area(r) area circle.area(2)$12.57142857ALL INTER VIEW QUESTIONS Which method is used to generate id value?make_sysid(). Posted by shreeLakshmi Poluru at 09:07 Email ThisBlogThis!Share to TwitterShare to FacebookShare to PinterestLabels: interview questions, Magik, smallworldHow to add enumerators values without using the case tool?Using extensible enumerator.Posted by shreeLakshmi Poluru at 09:06 Email ThisBlogThis!Share to TwitterShare to FacebookShare to PinterestLabels: interview questions, Magik, smallworldHow can we add indices to collection using magik code?Add_index() and drop_index() methods are used to add and remove indices from collection.Posted by shreeLakshmi Poluru at 09:05 Email ThisBlogThis!Share to TwitterShare to FacebookShare to PinterestLabels: interview questions, Magik, smallworldWhat is the difference between the detached record and template record?Both detached record and template record returns an object which has same fields and behavior of collection record but it is not an element of collection.In detached record ,fields are not initialized with default value whereas in template record fields are initialized with default values.Creating detached record is faster than the template record.Posted by shreeLakshmi Poluru at 09:04 Email ThisBlogThis!Share to TwitterShare to FacebookShare to PinterestLabels: interview questions, Magik, smallworldElements() vs fast_elements()Elements() returns only valid records.If we are using fast_elements() on the collection in which the records are inserting and deleting, then fast_elements() returns the deleted records also.Posted by shreeLakshmi Poluru at 09:03 Email ThisBlogThis!Share to TwitterShare to FacebookShare to PinterestLabels: interview questions, Magik, smallworldWhen do we get stale record handle?If user tries to refer the deleted object, then stale record handle error will raises.Posted by shreeLakshmi Poluru at 09:01 Email ThisBlogThis!Share to TwitterShare to FacebookShare to PinterestLabels: interview questions, Magik, smallworldsmallworld database is which type of database?Smallworld database is relational databse.Posted by shreeLakshmi Poluru at 09:00 Email ThisBlogThis!Share to TwitterShare to FacebookShare to PinterestLabels: interview questions, Magik, smallworldThursday, 19 February 2015What are the different kinds of objects available in magik?In Magik there are distinct formats for different kinds of object: enumerated: objects that have no data, such as integers and Booleansindexed: objects that have numbered elementsslotted: objects with named fields called slots Posted by shreeLakshmi Poluru at 09:42 Email ThisBlogThis!Share to TwitterShare to FacebookShare to PinterestLabels: interview questions, Magik, smallworldHow to generate magik compile file?Magik compile file is generated using following command magik_rep.compile_file(file_path) : give file full path EX:magik_rep.compile_file(D:\test.magik)After executing the above statement test.magikc file is generated in the D:\Posted by shreeLakshmi Poluru at 09:35 Email ThisBlogThis!Share to TwitterShare to FacebookShare to PinterestLabels: interview questions, Magik, smallworldTuesday, 17 February 2015Interview QuestionsSmallworld application supports which n-tier architecture?Name some executable files present in product bin directory? is user has direct access to these files?Which executable file is used to start a session on windows?Posted by shreeLakshmi Poluru at 08:47 Email ThisBlogThis!Share to TwitterShare to FacebookShare to PinterestLabels: interview questions, Magik, smallworldMonday, 16 February 2015Name some executable files present in product bin directory? is user has direct access to these files?Sw_magik,sw_magik_win32,swdocopen,swsleep etc., Yes, user has direct access to these files.Posted by shreeLakshmi Poluru at 08:36 Email ThisBlogThis!Share to TwitterShare to FacebookShare to PinterestLabels: Magik, smallworldWhich executable file is used to start a session on windows?Sw_magik_win32 is used to start a session with graphics on the windows. Along with this, there are other two executable files.1. sw_magik for a session with no graphics.2. sw_magik_motif for a session with graphics via the motif window system on unix computers.Posted by shreeLakshmi Poluru at 08:34 Email ThisBlogThis!Share to TwitterShare to FacebookShare to PinterestLabels: Magik, smallworldSmallworld application supports which n-tier architecture?Smallworld application supports 3-tier architecture.1. Database server layer2. Application engine layer.3. User interface layer.Posted by shreeLakshmi Poluru at 08:33 Email ThisBlogThis!Share to TwitterShare to FacebookShare to PinterestLabels: Magik, smallworldWednesday, 11 February 2015Method DefinitionsFunctionality of the objects are defined in the methods. Methods are invoked by sending message to the objects.Methods can be defined in the following forms:Standard method definition:[_private] _method . [ () ] _endmethod is the name of the class. is the name of the method. is the list of arguments.If the keyword _private is present, that method can be accessed within the same class and subclasses.EX: _method integer.odd_even() _if _self.odd? _then write("This is an odd number") _else write("This is an even number") _endif _endmethodMethod with brackets is different from the same method name without brackets.Odd_even() is different from odd_even.Field Access method definition:[_private] _method . _endmethod is the name of the class. is the name of the method.EX:_method association.key >> .key_endmethodUsually,field access methods are used to return slot value.Indexing method definitions: [_private] _method '[' ']' _endmethod is the name of the class. EX: _method array_2[n] ... _endmethodAbstract Method: _abstract _method . [ () ] _endmethod EX: _abstract _method hash_helper.match?(thing1, thing2) ## Returns a boolean which is true if thing1 and thing2 should ## be regarded as the same ## Subclasses must provide an implementation of this method _endmethod Subclasses must implement abstract method otherwise error will raise.Posted by shreeLakshmi Poluru at 09:40 Email ThisBlogThis!Share to TwitterShare to FacebookShare to PinterestLabels: Magik, Procedure, smallworldProcedure DefinitionsProcedure is a collection of statements. Procedure invocation is simply calling the procedure with its arguments. Procedure can also be invoked by sending invoke() message on the procedure object.EX: quit() or quit.invoke() Procedure Syntax: _proc [@ ] ( [] ) _endproc @identifier and arguments are optional. @identifier is useful to identify the procedure. Note that the brackets ( ) are required, even if a procedure has no arguments.Defining Procedure with identifier: hello _clone.init()_endmethod$_method circle.init() _return _self_endmethod$_method circle.area(r) area > _clone.init()_endmethod$_method square.init() _return _self_endmethod$_method square.area(r) area circle.area(2)$12.571428571 What are the different kinds of objects available in magik?In Magik there are distinct formats for different kinds of object: enumerated: objects that have no data, such as integers and Booleansindexed: objects that have numbered elementsslotted: objects with named fields called slots 2)What are the different kinds of objects available in magik?In Magik there are distinct formats for different kinds of object: enumerated: objects that have no data, such as integers and Booleansindexed: objects that have numbered elementsslotted: objects with named fields called slots 3) How to generate magik compile file?Magik compile file is generated using following command magik_rep.compile_file(file_path) : give file full path EX:magik_rep.compile_file(D:\test.magik)After executing the above statement test.magikc file is generated in the D:\4) Name some executable files present in product bin directory? is user has direct access to these files?Sw_magik,sw_magik_win32,swdocopen,swsleep etc., Yes, user has direct access to these files5) Which executable file is used to start a session on windows?Sw_magik_win32 is used to start a session with graphics on the windows. Along with this, there are other two executable files.1. sw_magik for a session with no graphics.2. sw_magik_motif for a session with graphics via the motif window system on unix computers.6) Smallworld application supports which n-tier architecture?Smallworld application supports 3-tier architecture.1. Database server layer2. Application engine layer.3. User interface layer.6) Method DefinitionsFunctionality of the objects are defined in the methods. Methods are invoked by sending message to the objects.Methods can be defined in the following forms:Standard method definition:[_private] _method . [ () ] _endmethod is the name of the class. is the name of the method. is the list of arguments.If the keyword _private is present, that method can be accessed within the same class and subclasses.EX: _method integer.odd_even() _if _self.odd? _then write("This is an odd number") _else write("This is an even number") _endif _endmethodMethod with brackets is different from the same method name without brackets.Odd_even() is different from odd_even.Field Access method definition:[_private] _method . _endmethod is the name of the class. is the name of the method.EX:_method association.key >> .key_endmethodUsually,field access methods are used to return slot value.Indexing method definitions: [_private] _method '[' ']' _endmethod is the name of the class. EX: _method array_2[n] ... _endmethodAbstract Method: _abstract _method . [ () ] _endmethod EX: _abstract _method hash_helper.match?(thing1, thing2) ## Returns a boolean which is true if thing1 and thing2 should ## be regarded as the same ## Subclasses must provide an implementation of this method _endmethod Subclasses must implement abstract method otherwise error will raise7) Procedure DefinitionsProcedure is a collection of statements. Procedure invocation is simply calling the procedure with its arguments. Procedure can also be invoked by sending invoke() message on the procedure object.EX: quit() or quit.invoke() Procedure Syntax: _proc [@ ] ( [] ) _endproc @identifier and arguments are optional. @identifier is useful to identify the procedure. Note that the brackets ( ) are required, even if a procedure has no arguments.Defining Procedure with identifier: hello