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
D
Correct answer
Explanation
QTP (QuickTest Professional, now UFT) uses VBScript as its scripting language. 'VB' is correct as it refers to VBScript. TSL is for WinRunner, SQA Basic is for SQA Robot, and PERL is unrelated.
A
Correct answer
Explanation
Ruby's reference implementation (MRI) is written in C. This allows Ruby to be portable and performant. Other implementations exist (JRuby in Java, IronRuby in C#), but the core Ruby interpreter is C-based.
C
Correct answer
Explanation
Ruby on Rails is a web framework written in Ruby. Rails leverages Ruby's metaprogramming capabilities and follows Ruby conventions - it cannot be written in Java, C, or COBOL as it depends on Ruby's language features.
-
Mongrel
-
Apache
-
Webrick
-
Tomcat
C
Correct answer
Explanation
WEBrick is Ruby's built-in HTTP server library and serves as the default development server for Rails applications. While production environments typically use more performant servers like Puma or Unicorn, WEBrick is included with Ruby and requires no additional configuration for development work.
B
Correct answer
Explanation
Ruby is the programming language itself, while Ruby on Rails is a web application framework built using Ruby. The question incorrectly states that Ruby on Rails is a general-purpose language; Rails is specifically designed for web development, whereas Ruby is the general-purpose object-oriented language.
-
It is a Programming Language
-
Its is a frame work
-
Its is a tool
-
None of the above
A
Correct answer
Explanation
Ruby is a dynamic, object-oriented programming language created by Yukihiro Matsumoto. It emphasizes simplicity and productivity, with an elegant syntax that is natural to read and easy to write. Ruby on Rails is a framework built using Ruby, not the language itself.
-
It is a Programming Language
-
Its is a frame work
-
Its is a tool
-
None of the above
B
Correct answer
Explanation
Rails is a web application framework written in Ruby. It provides structure for database, web service, and web page development. A programming language (A) is what you write code IN, not what gives you web scaffolding.
A
Correct answer
Explanation
Ruby's reference implementation (MRI) is written in C. This allows Ruby to run on any platform with a C compiler. Java, C#, and COBOL are not the implementation language of Ruby.
C
Correct answer
Explanation
Rails is written in Ruby itself (a 'self-hosting' framework). The Rails codebase is pure Ruby, which contributes to its expressiveness and developer productivity.
-
Mongrel
-
Apache
-
Webrick
-
Tomcat
C
Correct answer
Explanation
WEBrick (included in Ruby's standard library) is the default development server for Rails. Mongrel (A) was popular historically, Apache (B) is production-grade, Tomcat (D) is for Java.
-
It is a Programming Language
-
Its is a frame work
-
Its is a tool
-
None of the above
A
Correct answer
Explanation
Ruby is a general-purpose, object-oriented programming language. It can be used for web development, scripting, data processing, and more. A framework (B) provides structure for specific types of applications.
-
It is a Programming Language
-
Its is a frame work
-
Its is a tool
-
None of the above
B
Correct answer
Explanation
Rails is a web application framework that provides structure for building database-backed web applications. It is not a programming language (A) - you write Ruby code that uses the Rails framework.
B
Correct answer
Explanation
In C, adjacent string literals are concatenated during compilation. 'Kumar' 'Singh' becomes 'KumarSingh', and 'Bittoo' 'Roshan' becomes 'BittooRoshan'. The array contains: 'Ritesh', 'KumarSingh', 'Happy', 'BittooRoshan', 'Go' = 5 elements.
-
p = realloc( ptr, 10 * sizeof( struct ritesh));
-
realloc( ptr, 9 * sizeof( struct ritesh) );
-
p+= malloc( 9 * sizeof( struct ritesh) );
-
p = realloc( ptr, 9 * sizeof( struct ritesh) );
A
Correct answer
Explanation
realloc expands existing allocation. Option A correctly uses realloc to resize ptr for 10 elements. Option B is missing assignment (memory leak), Option C uses malloc and adds to pointer (wrong), Option D only allocates 9 elements. Note: question uses 'ptr' in text but 'p' as variable name - minor inconsistency.