服务热线400-700-0056

主菜单

UPlooking home slide

错误信息

Notice: Undefined index: mobile 在 isMobile() (行 66/alidata/www/syuplooking/sites/all/themes/shenyang/template.php).

当前位置

【小测验】你能看出这是哪种语言写的程序吗?

世界上存在的编程语言有上百种,有的非常流行,有的默默无闻。有的适合商用,有的适合教学,有的适合玩耍。初学程序员可能只知道一两种语言,但随着经历越多,学的编程语言种类越多。懂多少种编程语言可以作为一个程序员能力大小的重要标准。如果你想知道自己的实力,请测一下自己,这里一共有12题,看看能选对几种?


1、


#include <iostream>


 int main()

 {

  std::cout << "Hello, World.";

 }


答案:✓C++


2、


#!/bin/sh

 echo "Hello World"


答案:✓shell


3、


>>> def fib(n):

>>>     a, b = 0, 1

>>>     while a < n:

>>>         print(a, end=' ')

>>>         a, b = b, a+b

>>>     print()

>>> fib(1000)


答案:✓Python


4、


 public class Hello {

  public static void main(String []args) {

  System.out.println("Hello World");

  }

 }


答案:✓Java


5、


# The Greeter class

class Greeter

  def initialize(name)

    @name = name.capitalize

  end


  def salute

    puts "Hello #{@name}!"

  end

end


# Create a new object

g = Greeter.new("world")


# Output "Hello World!"

g.salute


答案:✓Ruby


6、


package main


import "fmt"


func main() {

fmt.Println("Hello, 世界")

}


答案:✓Go语言


7、


$pizza  = "piece1 piece2 piece3 piece4 piece5 piece6";

$pieces = explode(" ", $pizza);

echo $pieces[0]; // piece1

echo $pieces[1]; // piece2


答案:✓✓PHP


8、


#import <Foundation/Foundation.h>

 

int main(int argc, char *argv[]) {

 

    @autoreleasepool {

        NSLog(@"Hello World!");

    }

 

   return 0;

}


答案:✓Objective C


9、


(defun should-be-constant ()

  '(one two three))

 

(let ((stuff (should-be-constant)))

  (setf (third stuff) 'bizarre))   ; bad!

 

(should-be-constant)   ; returns (one two bizarre)


答案:✓Lisp


10、


class Hello {

  static void Main() {

  System.Console.Write("Hello World");

  }

 }


答案:✓C#


11、


var http = require('http');

http.createServer(function (req, res) {

  res.writeHead(200, {'Content-Type': 'text/plain'});

  res.end('Hello World\n');

}).listen(1337, '127.0.0.1');

console.log('Server running at http://127.0.0.1:1337/');


答案:✓node.js


12、


Imports System.Console

Module Program

    Sub Main() 

        Dim rows As Integer

        Dim current = 1

        For row = 1 To rows

            For column = 1 To row 

                Write("{0,-2} ", current) 

                current += 1

            Next

            WriteLine()

        Next 

    End Sub

End Module


答案:✓Visual Basic .NET