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
-
setElapsedTime()
-
Timeout()
-
setTimeout()
-
setTime()
-
Check for the presence of certain characters
-
Check the position of substrings
-
Test the length of data
-
Check the variable type of the strings
-
Either ABC
E
Correct answer
Explanation
Form validation using string methods typically involves checking character presence (indexOf/includes), substring positions (indexOf/search), and testing data length (length property). All three techniques are commonly used together for robust validation.
-
Version 1.2
-
Version 1.1
-
Version 1.3
-
Version 1.4
-
All of the above
E
Correct answer
Explanation
JavaScript versions 1.0 through 1.5 were released during the Netscape era. Versions 1.1, 1.2, 1.3, and 1.4 all existed as incremental improvements to the language specification.
-
C
-
C++
-
Pascal
-
PHP
-
Either A & C
E
Correct answer
Explanation
JavaScript's syntax shares C-like characteristics with C (curly braces, operators) and Pascal (block structure, some statement keywords). C++ adds OOP concepts not intrinsic to core JavaScript, and PHP is server-side with different paradigms.
-
Events
-
Classes
-
Objects
-
DLL
-
Components
A
Correct answer
Explanation
JavaScript programs are event-driven, meaning they respond to user actions like clicks, keystrokes, and page loads. The core execution model is based on event handlers and callbacks rather than classes, DLLs, or traditional component architectures.
-
It is based on object creation
-
It focuses on component building
-
It focuses on logic flow
-
It emphasis on SCRIPTING
D
Correct answer
Explanation
JavaScript is primarily a client-side scripting language designed for web browsers, hence its emphasis on SCRIPTING. Unlike compiled languages focused on object creation or component building, JavaScript's main purpose is adding interactivity to web pages through scripts.
D
Correct answer
Explanation
ASN.1 defines the structure and syntax of MIB objects, providing a standardized way to describe managed objects. BER encodes these defined objects into binary format for network transmission. SNMP uses both: ASN.1 for specification, BER for wire encoding.
B
Correct answer
Explanation
CGI (Common Gateway Interface) is NOT a programming language - it's a protocol or standard for web servers to execute external programs and generate dynamic web content. CGI programs can be written in Perl, Python, C, or any other language that the server supports. The interface itself is language-agnostic.
-
normal
-
aborted
-
timeout
-
All of the above
D
Correct answer
Explanation
PHP connection states track the status of a client connection to the server. Normal means the connection is active, aborted means the client disconnected, and timeout means the connection exceeded the time limit. All three states are valid connection states in PHP, making option D correct.
-
<?php>...</?>
-
<?php…?>
-
<script>...</script>
-
<&>...</&>
B
Correct answer
Explanation
PHP code is embedded in HTML using opening delimiters. This tells the server to parse everything between these tags as PHP code. The correct syntax is without any angle brackets on the closing tag. Option B shows the correct delimiter syntax.
-
"Hello World";
-
echo "Hello World";
-
Document.Write("Hello World");
-
response.write("Hello World")
B
Correct answer
Explanation
The echo statement is the most common way to output text to the browser in PHP. Option 4371 is just a string literal without an output command. 4373 is JavaScript syntax, and 4374 is ASP syntax. PHP requires an explicit command like echo or print to generate output.
-
mysql_open("localhost");
-
connect_mysql("localhost");
-
dbopen("localhost");
-
mysql_connect("localhost");
D
Correct answer
Explanation
mysql_connect() was the standard function to connect to MySQL databases in PHP 4 and early PHP 5 (before PDO or mysqli were introduced). Options A, B, and C use non-existent function names. Note that mysql_* functions are deprecated in PHP 5.5+ and removed in PHP 7.0.
B
Correct answer
Explanation
In PHP 5, MySQL support was NOT enabled by default. It had to be explicitly enabled in php.ini by uncommenting or adding extension=php_mysql.so (Unix) or extension=php_mysql.dll (Windows). This was a common source of confusion for beginners.
-
It requires short tags and this is not compatible with XML
-
There is no problem
-
This syntax doesn't even exist It requires a special PHP library that may not always be available
A
Correct answer
Explanation
The short echo syntax =$expression ?> requires short_open_tag to be enabled in php.ini. This conflicts with XML declarations which also start with . Since PHP 5.4, short echo tags are always available regardless of short_open_tag setting, but full short tags ?> still conflict with XML and are discouraged for portable code.
-
ArrayList
-
Queue
-
DictionaryList
-
Stack
C
Correct answer
Explanation
ArrayList, Queue, and Stack are all classes in the System.Collections namespace. 'DictionaryList' does not exist in the .NET Framework; the dictionary class is 'Dictionary' (generics) or 'Hashtable' (non-generic).