Computer Knowledge
Programming Languages and Compilers
2,284 Questions
Programming languages and compilers involve the rules, syntax, and semantics used to write and execute software programs. Key areas include scripting languages, object oriented concepts, and parsing algorithms like top down parsers. Practice these computer science questions to build proficiency for technical and computer knowledge exams.
Object oriented languagesScripting languagesCompilers and parsersProgramming syntax
Programming Languages and Compilers Questions
-
A research institute
-
A numerical computing environment
-
A fifth generation programming language
-
A virtual laboratory
-
A science fiction
B
Correct answer
Explanation
MATLAB (matrix laboratory) is a numerical computing environment and fourth-generation programming language.
-
Names
-
Integrity
-
Visibility
-
Execution
-
Correctness
B
Correct answer
Explanation
This semantic rule in UML shows how things properly and consistently relate to one another.
D
Correct answer
Explanation
UML stands for Unified Modeling Language, also known as graphical modeling language that provides us with syntax for describing the major elements of software systems.
B
Correct answer
Explanation
PHP supports three comment styles: single-line comments using // and #, and multi-line comments using /* */. The syntax is not a valid PHP comment style - it resembles HTML comments but is incorrect for PHP code.
-
<?php?>
-
<script language=php> </script>
-
<? ?>
-
<?% %>
D
Correct answer
Explanation
PHP supports multiple tag styles: standard , short tags ?>, and script tags . The ASP-style tags <% %> were supported in older PHP versions with asp_tags enabled but were removed in PHP 7.0, making them the most incorrect option among modern PHP installations.
-
client side
-
server side
-
client/server side
-
none of above
B
Correct answer
Explanation
PHP is a server-side scripting language that executes on the web server before sending HTML to the client's browser. Unlike JavaScript (client-side), PHP code runs entirely on the server and the browser never sees the PHP source.
-
array([key=>] value,.......)
-
array)key=>value,.........)
-
Both (1) and (2)
-
None of these
A
Correct answer
Explanation
PHP arrays are created using array() with optional key-value pairs: array('key' => 'value', 'key2' => 'value2'). The => operator associates keys with values. Modern PHP also supports the shorter [] syntax.
-
arrange(arrayname)
-
array_value(arrayname)
-
reindexed(arrayname)
-
none of these
-
func_get_arg
-
func_get_args
-
func_num_args
-
none of these
B
Correct answer
Explanation
func_get_args() returns an array containing all arguments passed to the current function. This is useful for variable-length argument lists. Related functions: func_num_args() returns count, func_get_arg(n) returns single argument at position n.
-
func_get_arg
-
func_get_args
-
func_num_args
-
none of these
C
Correct answer
Explanation
func_num_args() returns the total number of arguments passed to a user-defined function. Unlike func_get_arg() (which gets a specific argument by index) or func_get_args() (which returns the entire array of arguments), this function only returns the count.
-
isset
-
set
-
exist
-
none of these
A
Correct answer
Explanation
isset() is a PHP language construct that determines whether a variable is set and is not NULL. It returns true if the variable exists and has a value other than NULL. This is commonly used to check if form fields or array keys have been initialized before using them.
-
Assign
-
Include
-
List
-
All of the above
C
Correct answer
Explanation
The list() construct in PHP assigns array elements to variables in a single operation, treating the array values as if they were being assigned to individual variables. It's commonly used with arrays that have numeric indices. For example: list($a, $b) = array(1, 2) assigns 1 to $a and 2 to $b.
-
array_funct
-
array_walk
-
array_apply
-
in_array
B
Correct answer
Explanation
array_walk() applies a user-defined callback function to each element of an array. This is useful for performing operations on every array element, such as formatting, validation, or transformation. The callback function receives the element's value and optionally its key and index.
-
require()
-
require_once()
-
both (1) and (2)
-
include
C
Correct answer
Explanation
Both require() and require_once() cause fatal errors and terminate the script if the included file cannot be found or cannot be opened. This is different from include() and include_once(), which only generate warnings and allow the script to continue. The '_once' variants ensure the file is included only once even if called multiple times.
-
call
-
include
-
access
-
both (1) and (2)
B
Correct answer
Explanation
The include() function (and its variants include_once(), require(), require_once()) allows you to insert the contents of one PHP file into another before the server executes it. This enables code reuse and modular design by separating PHP code into multiple files and including them as needed.