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
-
Machine-specific code
-
Java code
-
Machine-independent code
-
None of the above is correct
C
Correct answer
Explanation
Java bytecode is machine-independent code that runs on any platform with a JVM. It's an intermediate representation between Java source code and machine code, allowing Java's 'write once, run anywhere' capability. Option A is incorrect because bytecode is not machine-specific, and B is wrong because Java source code must be compiled to bytecode first.
-
Machine-specific code
-
Java code
-
Machine-independent code
-
None of the above is correct
C
Correct answer
Explanation
Java bytecode is an intermediate, machine-independent code that runs on the Java Virtual Machine (JVM). This 'write once, run anywhere' design allows Java programs to run on any platform with a JVM without recompilation. The JVM interprets or compiles bytecode into machine-specific instructions.
-
1 and 3
-
2 and 4
-
3 and 5
-
4 and 6
A
Correct answer
Explanation
Switch statements are based on integer expressions and since both bytes and chars can implicitly be widened to an integer, these can also be used. Also short data types can be used. Short and Long are wrapper classes and reference types can not be used as variables.
-
Java
-
C#
-
C++
-
Both (2) and (3)
-
None of the above
E
Correct answer
Explanation
This is the correct choice as all the first three options are object-oriented languages.
-
Java Script
-
PHP
-
ASP .Net
-
Both (2) and (3)
-
(1), (2) and (3) all are true
-
pre-processor named standard input-output
-
user defined data type named Standard input-output
-
header file named Standard input-output
-
header file named Studio input-output
-
header file named Standard integer output
C
Correct answer
Explanation
It is a header file, which controls input and output.
A
Correct answer
Explanation
ASMX files (ASP.NET web services) can contain code written in any .NET-compatible language, and different languages can even be mixed within the same ASMX file. This is because all .NET languages compile to the same Intermediate Language (IL).
-
Both procedural and OOP are supported in Java.
-
Java supports only procedural approach towards programming.
-
Java supports only OOP approach.
-
None of the above.
A
Correct answer
Explanation
Java is a hybrid language that supports both procedural and object-oriented programming paradigms. While primarily designed as an OOP language with classes, objects, inheritance, and polymorphism, Java also supports procedural programming through static methods and primitive types. You can write procedural-style code in Java, especially in the main method or utility classes.
A
Correct answer
Explanation
This is the correct option as the modular division holds the remainder as the result which is nothing but 0.
-
Java beans
-
Java applet
-
Visibroker for java
-
Java IDL
-
Stock
D
Correct answer
Explanation
Java IDL enables objects to interact regardless of whether they are written in the java programming language or another language such as C, C++ etc.
-
The malloc() function takes a single argument.
-
The calloc() function takes two arguments.
-
The calloc() function initialises memory to the allocated memory blocks but malloc() does not initialise the memory to the allocated blocks.
-
The realloc() function can increase or decrease the size of the allocated memory.
-
None of the above
E
Correct answer
Explanation
Yes, all of the above options are the true statements.
-
$fruit= array(Apple, Mango, Banana);
-
var fruit=new array(Apple, Mango, Banana);
-
$rate=array(Apple=>50,Mango=>20,Banana=>40);
-
$fruit=array ( array(Apple,50,60), array(Mango,20,25), array(Banana,40,45) );
-
(1), (3), and (4) are valid.
E
Correct answer
Explanation
Yes, these three are the true initializations of the array in php.
-
Memory management
-
Security
-
Exception handling
-
Garbage collection
-
All of the above
E
Correct answer
Explanation
Yes, all of the above are the true statements.
-
Resources
-
Type metadata
-
Assembly manifest
-
MSIL source code
-
None of the above
E
Correct answer
Explanation
All of the above are the components of the assembly in .net framework.
-
Console applications
-
Windows services
-
Windows Presentation foundation (WPF) applications
-
All of the above
-
Only (1) and (3)
D
Correct answer
Explanation
Yes, all of the above three statements are true.