300+ [REAL TIME] Euphoria Programming Language Interview Questions

  1. 1. Is There A Tool To Help Find Bugs Or Perform Static Analysis?

    TEST (all) Parses the code only and issues any warnings or errors to STDOUT. On error the exit code will be 1, otherwise 0. If an error was found, the normal “Press Enter” prompt will not be presented when using the -TEST parameter which enables many editor/IDE programs to test the syntax of your Euphoria source in real time.

  2. 2. How Do You Set A Global Variable In A Function?

    Assign a value to it.

  3. Principles of Programming Languages Interview Questions

  4. 3. How Do I Share Global Variables Across Modules?

    Use the “global” variable definition.

  5. 4. How Do I Write A Function With Output Parameters (call By Reference)?

    Euphoria doesn’t support call by reference. If you want your function to modify a variable, assign the return value of the function to that variable.

  6. Go (programming language) Tutorial

  7. 5. How Do I Copy An Object In Euphoria?

    a=b

  8. Mac OS X Deployment Interview Questions

  9. 6. How Can I Find The Methods Or Attributes Of An Object?

    Euphoria isn’t object oriented.

  10. 7. How Can My Code Discover The Name Of An Object?

    Euphoria isn’t an object oriented language.

  11. D Programming Language Tutorial
    Go (programming language) Interview Questions

  12. 8. How Do I Specify Hexadecimal And Octal Integers?

    For hexadecimal, use the ‘#’ symbol (#FE, #A000, etc.). It is not possible to input octal values, but it is possible to output them. See printf().

  13. 9. How Do I Convert A String To A Number?

    Use the value() function.

  14. Berkeley Software Distribution (BSD) Interview Questions

  15. 10. How Do I Convert A Number To A String?

    Use the sprint() orsprintf() function.

  16. Lua (programming language) Tutorial

  17. 11. How Do I Modify A String In Place?

    Just do it. name = “Abe Lincoln” name = “Abraham Lincoln”

  18. D Programming Language Interview Questions

  19. 12. How Are Arguments Passed?

    All arguments are passed by value.

  20. Principles of Programming Languages Interview Questions

  21. 13. Does The Value Of A Constant Ever Change?

    No. The value of a constant is fixed when it’s defined for the life of the program.

  22. 14. Does Euphoria Support Keyword Arguments?

    No. There are ways to simulate keyword arguments, however, using functions in the std library.

  23. 15. What Does $ Mean?

    The symbol ‘$’ in Euphoria version 2.5 and later means “length(of_sequence).”

    sequence s, i  
    s = “My Sequence”  
    i = s[$] — i = “e”  
    i = s[4..$] — i = “Sequence”  
    i = s[$-5] — i = “q” 

  24. Lua (programming language) Interview Questions

  25. 16. Does Euphoria Have Exception Handling?

    No.

  26. 17. What’s A Negative Index?

    Negative index is a mis-named feature of Python and some other languages. If the index is n, and n = -1, then this means, to python, in English, “the last”. In Euphoria, this would be x[length(x)], or in a more convenient shorthand x[$]. In Python, -2 would mean “next to last”. In Euphoria x[length(x)-1] or x[$-1].

  27. Advanced Linux Interview Questions

  28. 18. How Do I Iterate Over A Sequence In Reverse Order?

    Use a for..loop, like so

    sequence s  
    for t=length(s) to 1 by -1 do  
        — do something with s[t]  
    end for 

  29. Mac OS X Deployment Interview Questions

  30. 19. How Do You Make An Array In Euphoria?

    Sequences are arrays. You create them by first declaring a variable as sequence, then assigning elements to the sequence. For example

    sequence s  
    s = { 1, 2, 3 } — s is a 3-element sequence  
    s = repeat(0,20) — s is a 20-element sequence of zeroes  
    s = repeat(repeat(1,10),20) — s is a 20-element sequence of 10-element sequences 

  31. 20. How Do You Refer To Individual Elements In An Array?

    You get the value from a sequence with bracketed values. For instance,

    ?s[5][3] — prints the third element of the fifth sequence (a multi-dimensional sequence)

  32. Win32 Api Interview Questions

  33. 21. I Want To Do A Complicated Sort: Can You Do A Schwartzian Transform In Euphoria?

    The term “Schwartzian transform” is the perl name for a sorting algorithm which can be written in almost any turing-complete programming language, including Euphoria. Euphoria is likely to be faster than perl.

  34. 22. How Can I Process A File And Update Its Contents?

    One way to do this is:

    1. Use read_lines() to read in the contents of a file.
    2. Manipulate the sequence of lines as desired
    3. Use write_lines() to write the sequence back to a file.
  35. 23. Should I Feel Uneasy If I Don’t Close A File?

    You should always close any files you no longer need open. However, Euphoria will automatically close any still-open files when your program terminates.

  36. Dart programming language Interview Questions

  37. 24. How Can I Control Output Buffering?

    flush.

  38. Go (programming language) Interview Questions

  39. 25. How Can I Use A Library Written In C From Euphoria?

    You can access shared libraries from a Euphoria program.

    You can use code from a shared library uing open_dll(libname). This returns an atom which you’ll have to reuse to access individual variables or functions.

    You can access a function in a previously opened shared library by calling define_c_function(entry_point,func_name,type_arglist,return_type). This return an id that you can use with call_func().

    define_c_proc() and define_c_var() work in the same way, but require less arguments for obvious reasons. You can define a function as a procedure if you’ll never care about the returned value. You can access executable machine code using the above. Use “” as an entry point, and the address as name.

    You can call(address) so that code at address gets executed. The code must be a routine that returns using the near ret instructions (opcode #C3). All used registers must be restored upon return. You’ll have to set up the memory area which you’ll call() into by coding some machine code into a sequence, allocate() a memory block of the right size and poke()ing the sequence first.

    You must be aware that the code will run in 32 bit protected mode at privilege 3, and that call() requires two task switches, penalizing performance unless the asm code has a lot of work to perform. (1)

  40. 26. How Can I Count The Number Of Lines In A File?

    Here’s one way:

    include std/io.e 
    sequence fname = “GtkEngine.e” 
    object lines = read_lines(fname) 
    printf(1,”There are %d lines in file %sn”,{length(lines),fname}) 

  41. 27. How Can I Sum The Elements In An Array?

    Here’s one way:

    include std/math.e 
    sequence a = {1,2,3,4,5,6,7,8}  
    ? sum(a) 

  42. Berkeley Software Distribution (BSD) Interview Questions

  43. 28. Is There A Cgi Module For Euphoria?

    There is no standard CGI module that gets distributed with the Euphoria base package. However, there is code available for doing CGI with Euphoria (obviously, because this entire website is being served by a Euphoria CGI program). You can also get specific information for running Euphoria as CGI here and at the official Euphoria web site.

  44. 29. Does Euphoria Support Object Oriented Programming?

    Vanilla Euphoria does not “support” OO programming, though there are OO libraries in the archive, and Matthew Lewis has created a Euphoria interpreter with built-in object-oriented features.

  45. 30. Why Does My Program Take Longer To Load?

    Symbol scope and resolution has changed in v4. Most v3 code will work correctly with respect to include files and global symbols, but if you use a global symbol without including the file in which it was defined (or another file that includes the correct file) then euphoria will take a little longer to resolve that reference. It is advised that if you use any variable or routine from some file or library, that each using file include the file or library that defines the symbols being used.