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
-
Page.User.Identity
-
Page.User.IsInRole
-
Page.User.Name
-
None of the Above
A
Correct answer
Explanation
In ASP.NET, the Page.User.Identity object contains the authentication information for the current user, including their name. The User property exposes an IPrincipal interface, and its Identity property holds the IIdentity object with details like Name and IsAuthenticated. IsInRole is a method for checking role membership, not a container for user name.
-
< allow >
-
< deny >
-
Both A) and B)
-
None of the Above
C
Correct answer
Explanation
The section in ASP.NET configuration contains both and elements for controlling access rules. These elements define which users or roles are permitted or denied access to specific resources. Both elements work together to create comprehensive authorization rules.
-
Load ( )
-
Fill( )
-
DataList
-
DataBind
B
Correct answer
Explanation
The Fill() method is used to populate a DataSet with data from a data source in ADO.NET. It executes the query and retrieves rows into the DataSet. Load() is not a standard DataAdapter method, DataList is a UI control, and DataBind is for web controls.
-
RowUpdating, AfterUpdate
-
BeforeUpdate, RowUpdating
-
RowUpdating, RowUpdated
-
BeforeUpdate, AfterUpdate
-
BeforeUpdate, RowUpdated
C
Correct answer
Explanation
The DataAdapter in ADO.NET fires two events for each row during database updates: RowUpdating (before the update action) and RowUpdated (after the update completes). These events allow developers to intervene in the update process for validation, logging, or error handling. The prefix 'Row' is consistent for both events.
-
Application.Exit();
-
System.Environment.Exit(0)
-
System.Environment.Exit(1)
-
All the above
D
Correct answer
Explanation
All listed methods can terminate a C# application. Application.Exit() informs all message loops to terminate, which is suitable for Windows Forms. System.Environment.Exit(0) and System.Environment.Exit(1) terminate the process immediately and return exit codes to the operating system, representing success and failure respectively.
-
ReadAllLine()
-
ReadAllBytes()
-
ReadAllTexts()
-
WriteAllLine()
-
WriteAllTexts()
B
Correct answer
Explanation
In the C# System.IO.File class, ReadAllBytes() is a valid built-in method. The other options are incorrect because they use incorrect naming: the correct framework methods are plural ReadAllLines(), singular ReadAllText(), plural WriteAllLines(), and singular WriteAllText(). C# is case-sensitive and strict about method signatures.
-
SQL Data Source
-
XML Data Source
-
Object.
-
ODBC
A,B,C
Correct answer
Explanation
ASP.NET 2.0 introduced SqlDataSource, XmlDataSource, and ObjectDataSource controls to simplify data binding. These were new declarative data source controls that eliminated much of the code required in previous versions. ODBC data sources existed prior to 2.0.
-
ExecuteNonQuery & ExecuteScalar
-
ExecuteQuery & ExecuteScalar
-
ExecuteParameter
-
None
A
Correct answer
Explanation
In ADO.NET, the SqlCommand class provides methods like ExecuteNonQuery (for INSERT, UPDATE, DELETE) and ExecuteScalar (for single-value lookups). ExecuteQuery and ExecuteParameter are not standard ADO.NET command object methods.
-
Data
-
Message
-
StackTrace
-
Source
C
Correct answer
Explanation
The StackTrace property provides a detailed call stack that shows the sequence of method calls that led to the exception, including the exact line numbers where the exception originated. This is precisely what a developer needs to locate the problematic code. The Message property only contains a description of the error, while Data contains arbitrary additional information, and Source indicates the application name - none provide the specific line location like StackTrace does.
A
Correct answer
Explanation
ilasm (IL Assembler) is the tool that converts IL (Intermediate Language) code into executable portable executable (PE) format. ildasm is the reverse: it disassembles .NET assemblies into IL code. The CLR (Common Language Runtime) executes the assembled code but does not assemble it.
-
a) Bit Mapping Support
-
b) Basic Mapping Standard
-
c) Basic Mapping Support
-
d) None of the above
-
e) Neither (a) nor (b)
C,E
Correct answer
Explanation
Basic Mapping Support (BMS) is the CICS facility used to define screens via assembler-level macro instructions. Both option C (which names BMS) and option E (neither a nor b) are correct since options A and B are incorrect terms.
-
Practical Extraction and Report Language
-
Practice for Exclusive and Report Language
-
Practical Extraction and Report Learning
-
Practical Exclusive and Report Language
A
Correct answer
Explanation
Perl is an acronym for 'Practical Extraction and Report Language'. This name reflects its original purpose for text processing, report generation, and system administration tasks.
-
name.length
-
name.size
-
size(name)
-
length(name)
A,B
Correct answer
Explanation
In Ruby, both length and size are valid methods to get the number of elements in an array. They are aliases and return the same result. Options C and D are incorrect because size(name) and length(name) are not valid Ruby syntax - these methods must be called on the array object itself, not with the array as an argument.
A
Correct answer
Explanation
In Ruby, the index method (also called find_index) returns the position of the first occurrence of the specified element in the array. For days.index("Saturday"), this would return 5 (zero-indexed) or 6 (one-indexed position), which is the correct way to find an element's index.
-
Structured
-
Hierarchical
-
Reporting
-
onject oriented
A,C
Correct answer
Explanation
Natural programming language features two execution modes: Structured and Reporting. Structured mode is designed for structured coding with strict syntax validation, while Reporting mode allows quick, flexible data extraction and generation of reports with fewer syntax restrictions.