zoukankan      html  css  js  c++  java
  • SAP DevOps笔试题

    1.[Unix administration]
    Please use Linux bash to fulfill the following Operation tasks.

    • List all Java process
    • List Linux kernel version
    • Compress all log files under /var/log/nginx, and copy to server 10.0.0.1. User
      name:work, Password: Password

    2.[Programming]
    Please use script language(Python, Perl, Nodejs etc) to fulfill the following tasks in two ways

    3.[Network]

    • List >3 http method other than GET
    • How to exam the DNS resolution
      e.g. www.baidu.com in Linux shell, List the possible commands you
      have know.

    4.对B类网段172.168.0.0进行划分,子网掩码为255.255.192.0

    • 要求计算可划分子网数
    • 每个子网中主机数
    • 确定每个子网的子网地址
    • 确定每个子网合法IP地址
    • 确定每个子网广播地址

    参考答案

    1.[Unix administration]
    Please use Linux bash to fulfill the following Operation tasks.

    • List all Java process
    ps -ef | grep java
    • List Linux kernel version
    uname -r
    • Compress all log files under /var/log/nginx, and copy to server 10.0.0.1. User
      name:work, Password: Password
    分两步走:
    首先, 执行查找所有的log文件,并压缩成为自命名的文件,假设为logzips.gz:
    find /var/log/nginx -type f -name '*.log' -print | xargs tar cf - |gzip -c > ./logzips.gz 
    然后,用scp进行copy,中途要输入被传输机器的密码,假设放到/var/mylog目录下:
    scp ./logzips.gz work@10.0.0.1:/var/mylog/logzips.gz

    2.[Programming]
    Please use script language(Python, Perl, Nodejs etc) to fulfill the following tasks in two ways

    [Python]方法1, 通过Http使用urllib模块:
    import urllib 
    print "downloading with urllib" 
    url = 'http://some.website/some.file'  
    urllib.urlretrieve(url, "some.file")
    [Python]方法2,通过Http使用urllib2模块:
    import urllib2 
    print "downloading with urllib2" 
    url = 'http://some.website/some.file' 
    fin = urllib2.urlopen(url)
    data = fin.read() 
    with open("some.file", "wb") as fout:
        fout.write(data)
    [Python]方法3, 通过使用requests模块
    import requests 
    print "downloading with requests"
    url = 'http://some.website/some.file' 
    response = requests.get(url) 
    with open("some.file", "wb") as fout:
         fout.write(response.content)
    
    方法1:不使用Cookie, 发送HTTP POST
    import urllib2, urllib
    data = {'Username' : 'work', 'Password' : 'Password'}
    f = urllib2.urlopen(
            url     = 'https://some.website/login',
            data    = urllib.urlencode(data)
      )
    print f.read()
    方法2:使用CookieJar
    import urllib2
    import urllib
    from cookielib import CookieJar
    
    cj = CookieJar()
    opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
    # input-type values from the html form
    data = { 'Username' : 'work', 'Password' : 'Password' }
    data_encoded = urllib.urlencode(data)
    response = opener.open("https://some.website/login", data_encoded)
    content = response.read()

    3.[Network]

    • List >3 http method other than GET
    1. GET 从指定的url上获取内容
    2. POST 提交body中的内容给服务器中指定的url中,属于非幂等的(non-idempotent)请求
    3. HEAD 从指定的url上获取header内容(类似Get方式)
    4. PUT 将body上传至服务器指定url处
    5. DELETE 在指定url处删除资源
    6. OPTIONS 获取指定url中能接收的请求方法
    7. CONNECT 连接指定频段。当客户端需要通过代理服务器连接HTTPS服务器是用到。

    具体参见HTTP Method

    • How to exam the DNS resolution
      e.g. www.baidu.com in Linux shell, List the possible commands you
      have know.
    原理都是依赖于一个很重的的文件/etc/resolv.conf
    1. dig www.baidu.com (+tcp, +trace)
    2. nslookup www.baidu.com
    3. host www.baidu.com (用于查看某主机对应的IP)
    4. ping www.baidu.com (如果ping不通,当然DNS解析就不对)

    4.对B类网段172.168.0.0进行划分,子网掩码为255.255.192.0

    • 要求计算可划分子网数
    因为是B类网段,B类地址用16位表示网络ID,而其子网掩码是18位,则子网位数为18-16=2位,那么子网就有2^2=4个。
    • 每个子网中主机数
    IPv4总共用32位表示,分为网络ID和主机ID,其中子网掩码占了18位,即网络ID可用18位,则还剩32-18=14位来用于表示主机,即每个子网中主机数为2^14 -2 个 (由于特殊用途,丢弃全为0,和全为1这两种情况)。
    • 确定每个子网的子网地址
    子网地址则为每个网段的起始地址为全0即:
    172.168.0.0
    172.168.64.0
    172.168.128.0
    172.168.192.0
    • 确定每个子网合法IP地址
    172.168.0.1~172.168.63.254
    172.168.64.1~172.168.127.254
    172.168.128.1~172.168.191.254
    172.168.192.1~172.168.255.254
    • 确定每个子网广播地址
    广播地址为每个网段的结束地址为全1即:
    172.168.63.255
    172.168.127.255
    172.168.191.255
    172.168.255.255
    

    没有看明白的话,可以看看我的另一篇文章如何计算子网数

  • 相关阅读:
    【转帖】太晚睡觉等于自杀(一定要看看,以后不熬夜了!)程序员必看
    C盘碎片整理时“无法移动的文件”的处理
    【转帖】VS2008+SQL2005开发环境搭建
    【转帖】财务尽职调查资料收集总结
    SQL2005开发版SSIS正常连接需要修改的地方
    【未解决】制作可选择目录树的控件(替换使用参数进行递进选择)
    【未解决】VS2008与Reporting Services结合生成的网站,速度超慢,何故?
    新博开张
    【已解决】尝试为文件 ......\App_Data\aspnetdb.mdf 附加自动命名的数据库,但失败...
    SSRS表达式
  • 原文地址:https://www.cnblogs.com/qianggezhishen/p/7349502.html
Copyright © 2011-2022 走看看