随笔分类 -  CareerCup

摘要:14.6 Implement a CircularArray class that supports an array-like data structure which can be efficiently rotated.The class should use a generic type, ... 阅读全文
posted @ 2015-11-24 13:11 Grandyang 阅读(1782) 评论(0) 推荐(0) 编辑
摘要:14.5 Explain what object reflection is in Java and why it is useful.Java中的对象反射机制可以获得Java类和对象的反射信息,并可采取如下操作:1. 在运行阶段获得类内部的方法和字段信息2. 新建类的实例3.通过获取字段引用来获得... 阅读全文
posted @ 2015-11-17 13:42 Grandyang 阅读(520) 评论(0) 推荐(0) 编辑
摘要:14.4 Explain the difference between templates in C++ and generics in Java.在Java中,泛式编程Generic Programming的实现是通过一种就做类型擦除Type Erasure的机制来实现的。当源码转为Java虚拟机... 阅读全文
posted @ 2015-11-14 12:41 Grandyang 阅读(637) 评论(0) 推荐(0) 编辑
摘要:14.3 What is the difference between final, finally, and finalize?这道题考察我们Java中的三个看起来很相似的关键字final,finally和finalize。别看它们三长的很像,但是完全不是一回事。final用在一个变量,方法或是类... 阅读全文
posted @ 2015-11-08 10:21 Grandyang 阅读(454) 评论(0) 推荐(0) 编辑
摘要:14.2 In Java, does the finally block get executed if we insert a return statement inside the try block of a try-catch-finally?这道题问我们Java中的finally块是否会被... 阅读全文
posted @ 2015-11-08 09:57 Grandyang 阅读(423) 评论(0) 推荐(0) 编辑
摘要:14.1 In terms of inheritance, what is the effect of keeping a constructor private?这道题问我们用继承特性时,如果建立一个私有的构建函数会怎样。只有能访问该函数的私有变量或函数的东西才能访问私有构建函数,比如内部类就可以... 阅读全文
posted @ 2015-11-06 14:12 Grandyang 阅读(621) 评论(0) 推荐(0) 编辑
摘要:13.10 Write a function in C called my2DAlloc which allocates a two-dimensional array. Minimize the number of calls to malloc and make sure that the me... 阅读全文
posted @ 2015-11-04 04:41 Grandyang 阅读(1009) 评论(0) 推荐(0) 编辑
摘要:13.9 Write an aligned malloc and free function that supports allocating memory such that the memory address returned is divisible by a specific power ... 阅读全文
posted @ 2015-11-03 03:31 Grandyang 阅读(1368) 评论(0) 推荐(0) 编辑
摘要:13.8 Write a smart pointer class. A smart pointer is a data type, usually implemented with templates, that simulates a pointer while also providing au... 阅读全文
posted @ 2015-11-02 13:32 Grandyang 阅读(896) 评论(0) 推荐(0) 编辑
摘要:13.7 Write a method that takes a pointer to a Node structure as a parameter and returns a complete copy of the passed in data structure. The Node data... 阅读全文
posted @ 2015-11-02 11:55 Grandyang 阅读(894) 评论(0) 推荐(0) 编辑
摘要:13.6 Why does a destructor in base class need to be declared virtual?这道题问我们为啥基类中的析构函数要定义为虚函数。首先来看下面这段代码:class Foo {public: void f();};class Bar: pu... 阅读全文
posted @ 2015-10-31 06:55 Grandyang 阅读(495) 评论(0) 推荐(0) 编辑
摘要:13.5 What is the significance of the keyword "volatile" in C这道题考察我们对于关键字volatile的理解,顾名思义,volatile有易变的易挥发的意思,在C/C++里,表示告知编译器某个变量可能会由程序外部改变,比如操作系统,硬件或者其... 阅读全文
posted @ 2015-10-31 04:13 Grandyang 阅读(517) 评论(0) 推荐(0) 编辑
摘要:13.4 What is the difference between deep copy and shallow copy? Explain how you would use each.这道题问深拷贝和浅拷贝的区别。浅拷贝复制对象中所有的成员值到另一个对象中,而深拷贝不仅复制这些,还复制所有的指... 阅读全文
posted @ 2015-10-31 03:19 Grandyang 阅读(496) 评论(0) 推荐(0) 编辑
摘要:13.3 How do virtual functions work in C++?这道题问我们虚函数在C++中的工作原理。虚函数的工作机制主要依赖于虚表格vtable,即Virtual Table。当类中定义了虚函数时,一个虚表格就建立了用来保存该类的虚函数的地址。此时编译器Compiler也会在... 阅读全文
posted @ 2015-10-30 06:58 Grandyang 阅读(624) 评论(0) 推荐(0) 编辑
摘要:13.2 Compare and contrast a hash table and an STL map. How is a hash table implemented? If the number of inputs is small, which data structure options... 阅读全文
posted @ 2015-10-30 05:20 Grandyang 阅读(603) 评论(0) 推荐(0) 编辑
摘要:13.1 Write a method to print the last K lines of an input file using C++.这道题让我们用C++来打印一个输入文本的最后K行,最直接的方法是先读入所有的数据,统计文本的总行数,然后再遍历一遍打印出最后K行。这个方法需要读两遍文件,... 阅读全文
posted @ 2015-10-29 12:10 Grandyang 阅读(717) 评论(0) 推荐(0) 编辑
摘要:12.6 How would you test an ATM in a distributed banking system?这道题问我们如何来测试一个自动取款机,我们首先要询问下列问题:- 谁来使用这些ATM?回答可能是任何人,或者是盲人,或者是其他什么答案。- 这些ATM用来干什么?回答可能是取... 阅读全文
posted @ 2015-10-28 11:57 Grandyang 阅读(773) 评论(0) 推荐(0) 编辑
摘要:12.5 How would you testa pen?这道题让我们测试一支笔,我们需要问面试官许多问题来理解"who,what,where,when,how and why",比如我们可以这样:面试官:你怎样测试一支笔?候选人:谁将要使用这笔?面试官:儿童候选人:有意思,那么他们用来干什么呢,是... 阅读全文
posted @ 2015-10-27 10:07 Grandyang 阅读(790) 评论(0) 推荐(0) 编辑
摘要:12.4 How would you load test a webpage without using any test tools?这道题问我们如何不用任何测试工具来加载测试一个网页。加载测试可以用来验证一个网站应用的最大操作容量和跟性能有关的瓶颈。同样,也可以测试应用在加载对不同情况的响应。对... 阅读全文
posted @ 2015-10-26 09:19 Grandyang 阅读(546) 评论(0) 推荐(0) 编辑
摘要:12.3 We have the following method used in a chess game: boolean canMoveTo( int x, int y). This method is part of the Piece class and returns whether o 阅读全文
posted @ 2015-10-25 09:44 Grandyang 阅读(602) 评论(0) 推荐(0) 编辑

Fork me on GitHub