Личный сайт


Отличный тест на общее развитие — угадай язык программирования.

У меня 11 из 20, т.е. 55%

Ответы ниже, кто не хочет, тот не подсматривает.

Не узнал руби, скалу, обж С, хаскель (пазор!), лого, фортран, форт (пазор!), шарп и аду.
Признал: С, с++, яваскрипт, яву, питон, яву, перл, лисп, вижал бейсик, паскаль.
Кобол угадал.
Собственно вполне ожидаемо. С чем хоть немного имел дело, то легко угадывается.

Your responses
Question 1:
/* Program: helloWorld */

int main(void) {
printf(«Hello, world!n»);
return 0;
Correct Answer: C
Your Answer: C
The godfather of modern imperative language syntax, you can recognize C by its header files (with the *.h extension) and its slash-and-asterisk comment delimiters.
Question 2:
// Program: helloWorld

function helloWorld() {
document.write(«Hello, world!»);
Correct Answer: JavaScript
Your Answer: JavaScript
The Web’s scripting language still resembles C and its cousins, but its syntax is a little more verbose. The I/O based on the document object is a dead giveaway.
Question 3:
# Program: helloWorld

def helloWorld():
print «Hello, world!»
Correct Answer: Python
Your Answer: Python
Compared to the other popular scripting languages, Python does away with C-like syntax, with its braces and other punctuation marks, in favor of natural-language keywords and code blocks based on whitespace indentation.
Question 4:
// Program: helloWorld

class helloWorld {
public static void main(String[] args) {
System.out.println(«Hello, world!»);
Correct Answer: Java
Your Answer: Java
Java looks a lot like C and C++, but it’s more strictly object-oriented and uses a different syntax for classes, methods, and types.
Question 5:
# Program: helloWorld

sub helloWorld {
print «Hello, world!n»;
Correct Answer: Perl
Your Answer: Perl
You can tell it’s a scripting language because it uses the hash symbol (#) to denote comments. Unlike its competitors, however, the concepts of functions, methods, and subroutines are interchangeable in Perl, and all are defined using the keyword sub.
Question 6:
// Program: helloWorld

using namespace std;
int main()
cout << "Hello, World!" << endl; return 0; } Correct Answer: C++ Your Answer: C++ The object-oriented successor to C looks a lot like its older sibling, but C++ is easy to spot by its simplified, single-line comments and its stream-based console I/O. Question 7: # Program: helloWorld class helloWorld def greet puts "Hello, world!" end end Correct Answer: Ruby Your Answer: Scala Ruby's class and method definition syntax resembles that of Python, but unlike that language, definitions in Ruby must be closed with the end keyword. Question 8: ;; Program: helloWorld (write-line "Hello, world!") Correct Answer: Lisp Your Answer: Lisp You can always tell a Lisp program by its signature parentheses -- in real programs they are often nested many levels deep. This program's particular dialect is Common Lisp. Question 9: ' Program: helloWorld Imports System Public Module helloWorld Sub Main() Console.WriteLine ("Hello, world!") End Sub End Module Correct Answer: Visual Basic Your Answer: Visual Basic Microsoft's often-criticized language bears little resemblance to the Basic that was popular in the 1980s, but you can still spot Visual Basic by its single-quote comment delimiters. The example uses the modern Visual Basic .Net syntax. Question 10: // Program: helloWorld object helloWorld { def main(args: Array[String]) { Console.println("Hello, world!"); } } Correct Answer: Scala Your Answer: Java As a JVM language, Scala borrows much from Java, but its syntax is more compact and has a few twists of its own. Watch for the object and def keywords, which aren't used in Java. Question 11: -- Program: helloWorld module helloWorld where main = putStrLn "Hello, world!" Correct Answer: Haskell Your Answer: Cobol As a functional language, Haskell's syntax differs from most of the languages in this quiz. It can be spotted by its unusual, compact syntax and its double-dash comment delimiter. Question 12: { Program: helloWorld } Program helloWorld(output); Begin WriteLn('Hello, world!') End. Correct Answer: Pascal Your Answer: Pascal One of the earlier structured programming languages, Pascal's syntax is verbose by today's standards, but it remains eminently readable. Unlike languages derived from C, curly brackets in Pascal indicate comments. Question 13: // Program: helloWorld #import
int main(void) {
NSLog(@»Hello, world!n»);
return 0;
Correct Answer: Objective-C
Your Answer: C#
Because Objective-C is a superset of C, some Objective-C code looks almost identical to its older cousin. To tell which is which, watch for library classes and functions that start with «NS.» That prefix is a holdover from the NeXTstep OS, which popularized Objective-C.
Question 14:
; Program: helloWorld

to helloWorld
print [Hello, world!]
Correct Answer: Logo
Your Answer: Fortran
Logo is an old language with an unusual syntax. A teaching language, it is recognizable by its friendly, readable keywords. The to/end keyword pair, used to define a subroutine, should be a big hint.
Question 15:
* Program: helloWorld

PROGRAM-ID. helloWorld.
DISPLAY ‘Hello, world!’.
Correct Answer: Cobol
Your Answer: Cobol
Once you’ve seen Cobol code, you can never forget it. The rigorous and unorthodox program structure, the mandatory indentation, and the liberal use of uppercase are all dead giveaways.
Question 16:
* Program: helloWorld

PROGRAM helloWorld
PRINT ‘(A)’, ‘Hello, world!’
Correct Answer: Fortran
Your Answer: Basic
The granddaddy of programming languages, Fortran is the oldest language still in use today. As such, it resembles a lot of later languages, but the primitive syntax and unusual indentation make it readily identifiable.
Question 17:
Program: helloWorld

: helloWorld ( — )
.» Hello, world!» cr ;
Correct Answer: Forth
Your Answer: SQL
Not only is Forth seldom used today, but its syntax remains unique in the history of programming languages. It can still be found in various embedded systems applications, including the Open Firmware found in some PowerPC, Sparc, and IBM Power systems.
Question 18:
// Program: helloWorld

using System;
public class helloWorld
public static void Main()
Console.WriteLine(«Hello, world!»);
Correct Answer: C#
Your Answer: Java
Somewhere between C and Java lies C#. It retains much of the syntax of the former while adding many of the modern language features of the latter (and some of its own). If it looks like C but it’s too slick to be C++, you just might be looking at .Net code.
Question 19:
# Program: helloWorld

function helloWorld() {
echo «Hello, world!n»;
Correct Answer: PHP
Your Answer: PHP
PHP uses the function keyword to begin function definitions like JavaScript, but it uses the hash character for comments and the echo keyword for text output, like a scripting language. If you can remember those things, you’ll be able to recognize one of the more popular scripting languages on the Web.
Question 20:
— Program: helloWorld

with Text_IO;
use Text_IO;
procedure helloWorld is
Put_Line(«Hello, world!»);
end helloWorld;
Correct Answer: Ada
Your Answer: Pascal
Ada was designed by the U.S. Department of Defense as a reliable, efficient, and highly maintainable language for embedded systems applications. As such, it uses a strict, verbose syntax that owes a lot to Pascal and its related family of languages.