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
C
Correct answer
Explanation
Ajax is built on JavaScript, CSS, HTML, and the XMLHttpRequest object. Java is a backend language that may power the server, but it is not one of the web standards that Ajax is based on in the browser.
-
Common Business Oriented Language
-
Common Business Object Language
-
Common Balls Of Light
-
Common Object Business Oriented LAnguage
A
Correct answer
Explanation
COBOL stands for Common Business Oriented Language, a high-level programming language designed for business applications. It was developed in 1959 and remains widely used in enterprise and government systems for transaction processing and administrative applications.
B
Correct answer
Explanation
In standard SQL operator precedence, multiplication (*) and division (/) have higher precedence than addition (+) and subtraction (-). When operators have equal precedence (like * and /), they are evaluated left-to-right. Among the options, * will be evaluated first assuming it appears before / in the expression.
-
declarations
-
scriptlets
-
expressions
-
All of the above
D
Correct answer
Explanation
JSP scripting elements include declarations (for variable/method declarations), scriptlets (for Java code blocks), and expressions (for outputting values to the response). All three are fundamental JSP scripting constructs.
-
<%– JSP Comment –%>
-
<!– HTML Comment –>
-
Both a and b
-
None of the above
C
Correct answer
Explanation
JSP supports both JSP-style comments <%-- JSP Comment --%> (which are stripped out before compilation) and standard HTML comments `` (which are sent to the client browser). Thus, both are valid types of comments in JSP development.
-
Static Content
-
Dynamic content
-
Both a and b
-
None of the above
C
Correct answer
Explanation
JSP content consists of two types: static content (HTML, plain text that is sent to the browser as-is) and dynamic content (JSP elements, scriptlets, expressions that are executed on the server). Both types are used together in a JSP page.
-
<session-config> <session-timeout>10</session-timeout> </session-config>
-
<session-config> <session-timeout>600</session-timeout> </session-config>
-
<session-time-config> <session-timeout>600</session-timeout> </session-time-config>
-
<session-config> <session-invalid-time>60</ session-invalid-time> </session-config>
A
Correct answer
Explanation
Session timeout in web.xml is specified in MINUTES within the element, not seconds. The value 10 represents 10 minutes, whereas 600 would be 600 minutes (10 hours), which is incorrect for this requirement. The element is the correct parent for session timeout configuration.
-
<% %>
-
<%= %>
-
<%! %>
-
<!-- -->
B
Correct answer
Explanation
JSP (JavaServer Pages) uses specific syntax for different types of code: <%= %> for expressions (evaluated and output), <% %> for scriptlets (Java code), and <%! %> for declarations. Expressions enclosed in <%= %> are evaluated at runtime and their result is sent to the output stream.
-
page
-
include
-
taglib
-
all the above
D
Correct answer
Explanation
JSP provides three main types of directives: page directive (for page-specific settings like content type, session, imports), include directive (for including files at translation time), and taglib directive (for importing custom tag libraries). Each directive type serves a specific purpose in JSP page configuration and behavior control.
-
extends
-
session
-
import
-
language
C
Correct answer
Explanation
The import directive is the only JSP page directive that can be declared multiple times in a single translation unit to import different packages. Other page directives, such as extends, session, or language, define unique page-level attributes and can only be specified once per JSP file.
B
Correct answer
Explanation
In a pest/defect tracking system (PEST likely refers to Project Error/Issue Tracking System), the testing type is a MANDATORY field. Every defect must be categorized by testing type (functional, performance, security, etc.) for proper triage, assignment, and metric analysis. This metadata is essential for defect lifecycle management.
-
mysql_selectDB_server($server,$user,$password)
-
mysql_connection($server,$user,$password)
-
mysql_connect($server,$user,$password)
-
database_connect($mysql,$server,$user,$password,$database)
C
Correct answer
Explanation
mysql_connect() was the standard function in PHP's mysql extension (now deprecated) to establish a connection to a MySQL database server using the server address, username, and password parameters. Note that this extension is deprecated in favor of mysqli or PDO.
-
$object.method()
-
$object->$method()
-
$object:$method()
-
$object->method()
D
Correct answer
Explanation
In PHP, object methods are called using the arrow operator (->), which is the standard syntax for accessing properties and methods of an object. This is distinct from languages like JavaScript or Java that use dot notation.
-
Object attributes are not of any specific data type
-
The constructor of the class is not correctly defined
-
You cannot put an equal when recieving a parameter in the constructor
-
The word function is missing before the class constructor
D
Correct answer
Explanation
In PHP 5, class constructors must be declared with the 'function' keyword before __construct() or the class-name method. The constructor is a special method that's automatically called when an object is instantiated, but it still requires standard function declaration syntax.