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

Multiple choice
  1. Machine-specific code

  2. Java code

  3. Machine-independent code

  4. None of the above is correct

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. Machine-specific code

  2. Java code

  3. Machine-independent code

  4. None of the above is correct

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. 1 and 3

  2. 2 and 4

  3. 3 and 5

  4. 4 and 6

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. pre-processor named standard input-output

  2. user defined data type named Standard input-output

  3. header file named Standard input-output

  4. header file named Studio input-output

  5. header file named Standard integer output

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

It is a header file, which controls input and output.

Multiple choice
  1. Both procedural and OOP are supported in Java.

  2. Java supports only procedural approach towards programming.

  3. Java supports only OOP approach.

  4. None of the above.

Reveal answer Fill a bubble to check yourself
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.

Multiple choice
  1. The malloc() function takes a single argument.

  2. The calloc() function takes two arguments.

  3. The calloc() function initialises memory to the allocated memory blocks but malloc() does not initialise the memory to the allocated blocks.

  4. The realloc() function can increase or decrease the size of the allocated memory.

  5. None of the above

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

Yes, all of the above options are the true statements.

Multiple choice
  1. $fruit= array(Apple, Mango, Banana);
  2. var fruit=new array(Apple, Mango, Banana);

  3. $rate=array(Apple=>50,Mango=>20,Banana=>40);
  4. $fruit=array ( array(Apple,50,60), array(Mango,20,25), array(Banana,40,45) );
  5. (1), (3), and (4) are valid.

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

Yes, these three are the true initializations of the array in php.