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 technology programming languages
  1. Compilation Error

  2. Some Unknown Random Number

  3. 5

  4. I Dont Know

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

The printf statement uses %u format specifier with ThatsMyFunction without parentheses, so it prints the function's memory address (a random-looking number) instead of calling it. To print the return value 5, you need ThatsMyFunction(). The %u format expects unsigned int, and a function pointer address fits this.

Multiple choice technology programming languages
  1. HelloA

  2. HelloB

  3. HelloABCD

  4. HelloD

  5. HelloC

  6. Compilation Error

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

Multi-character constants like 'ABCD' store multiple bytes in an int. The value is implementation-defined, but most compilers store characters in memory order, so 'ABCD' typically evaluates to the last character 'D' (or the integer representing the bytes). The switch matches case 'D', printing HelloD.

Multiple choice technology programming languages
  1. Compilation Error - Cannot define Function inside Function

  2. 50

  3. Cant say

  4. Some Random Number

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

Nested functions (functions defined inside other functions) are a GCC extension, not standard C. When compiled with GCC, this code works correctly and prints 50. Standard C compilers would reject this, but the question assumes GCC compilation based on the correct answer being 50.

Multiple choice technology programming languages
  1. I have started hating C now!!

  2. Hello

  3. Compilation Error - Cannot return when return type is Void

  4. Hello World

  5. Segmentation fault

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

The printf("Hello") executes first, printing Hello. The return 5 statement then exits the function immediately - code after return is unreachable. While standard C prohibits return with a value in void functions, GCC allows it as an extension. The output is just Hello.

Multiple choice technology programming languages
  1. Clear

  2. Write

  3. Execute

  4. Flush

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

The Response object in ASP.NET includes Clear, Write, Flush, Redirect, and End methods, but Execute is not a member. Execute is actually a method of the Server object (Server.Execute) which transfers execution to another page. The Response object handles sending output to the client, while Server.Execute handles page transfer. This distinction is important for understanding ASP.NET's object model.

Multiple choice technology web technology
  1. $_GET
  2. $_POSTS
  3. $_GETS
  4. All the above

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

$_GET is the PHP superglobal array that contains query parameters passed through the URL after the ? character. The other options are wrong - $_POST (not $_POSTS) contains POST request data, and $_GETS doesn't exist as a PHP superglobal. Query parameters in URLs are automatically parsed into $_GET.

Multiple choice technology web technology
  1. session_start()

  2. session_init()

  3. session_boot()

  4. None of the Above

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

session_start() is the correct PHP function to initialize a session - it must be called before any output is sent to the browser. The other options don't exist - session_init() and session_boot() are not valid PHP functions. Once started, session data becomes available through the $_SESSION superglobal.