Posts tagged ‘c++’
Hash tables :
C++ Q/A :
- Mapreduce & Hadoop Algorithms in Academic Papers (3rd update), especially Scaling Up Classifiers to Cloud Computers
- TeamBox – project collaboration tool
- Continuous Integration for C++ by Rick Wagner
- Beyond Position Bias: Examining Result Attractiveness as a Source of Presentation Bias… Yue, Patel, Roehrig, WWW-2010
.. to be continued
Q1: What value will be printed ?
double d1 = 16, d2=2.0;
double d3 = (1/2) * ( sqrt(d1) + d2/2);
cout << d3 << endl;
Q2: Please write your own itoa implementation
Q3: What is pure virtual destructor? Shall ( or can ) pure virtual functions be implemented ?
Q4: Give an example of abort function implementation
Q5: Why we need semicolon after closing bracket in C++ class declaration ?
Q6: Can we call destructor directly? For what we may need it ?
Q7: Can we call constructor directly? For what we may need it ?
Q8: Can we thron an exception in destructor ?
Q9: What happen if we call pure virtual methods in constructor or destructor ? Same question about ‘non-pure’ virtual methods ?
Q10: Why don’t we have virtual constructors in C++ ?
Q11: What is difference between new and new  ? Same thing about delete and delete  ?
Q12: What is a difference between static_cast, dynamic_cast, reinterpret_cast and const_cast ?
Q13: Why do we need explicit keyword in C++ ?
Q14: Explain difference between
const MyClass c;
const MyClass &c2 = c;
const MyClass *c2 = &c;
const MyClass * const c2 = &c;
Q15: Difference between const_iterator and iterator
Q16: Implement Rand5 ( which returns randomly 0..4 ) use only Random7 ( which returns 0..6)
Q17: Can we use object of class ( or structure ) which doesn’t have name? Can we declare and use classes and structures without names ?
Q18: What is it factory pattern ?
( to be updated and continued very soon 🙂
Answers ( if you need it 🙂 ) below Continue reading ‘C/C++ interview questions’ »
One way to do it consists in using queues – you may create unique queue for each host in your SGE grid ( using qconf -aq ) and specify this queue name in submitting parameters –qsub -q <queue_name> $SGE_ROOT/examples/jobs/simple.sh
In case if you would like do deploy jobs onto grid from application ( C or Java ) SGE supports special API – Direct esource Managment Application API – DRMAA – here’s some examples in C++ and Java which may help to figure out this stuff. There’s SGE DRMAA Javadocs, drmaa package JavaDocs and common help – C library functions listed in section 3. To specify queue name dmraa_set_attribute function should be used as shown below :drmaa_set_attribute(jt, DRMAA_NATIVE_SPECIFICATION, “q queue_name”, error, DRMAA_ERROR_STRING_BUFFER – 1);
Another way to route jon onto specific host it’s to specify request attributes in qsub : – qsub -l <request_attr_name> – for Java example please see below. Also you may add “soft” or “hard” resource requirements modifier ( for more see SGE glossary – hard/soft resource requirements).drmaa_set_attribute(jt, DRMAA_NATIVE_SPECIFICATION, “-hard -q queue_name”, error, DRMAA_ERROR_STRING_BUFFER – 1);
Here’s a listing of drmaa C++ example which runs job on specified queue – to build it you may use this simple bash script which listed below – it works on Solaris 10, for Linux I suppose it’s better to use g++ compiler :INC=-I$SGE_ROOT/include LIB=-L$SGE_ROOT/lib/sol-x86/ LIB_NAME=-ldrmaa cc $INC $LIB $LIB_NAME sge_drmaa_test_example.c -o sge_drmaa_test_example.out
If you got below error when you run this example
ld.so.1: sge_drmaa_test_example.out: fatal: libdrmaa.so.1.0: open failed: No such file or directory
please checkout LD_LIBRARY_PATH environment variable, it should be set in the way like ( Solaris 10 x86 )
job_template.setNativeSpecification(“-hard -q ” + queue_name);
Another way to run job on needed host it’s to specifying hostname as request attributes – it look like
Here’s an java source for sge drmaa example or Java drmaa example archive – zip contains source file, eclipse project and compiled binaries – to create jar you may use Eclipse export or run inside bin folder
jar cf SgeDrmaaJobRunner.jar net/bokov/sge/*.class
To run this jar ( and run /tools/job.sh which already deployed on all executors ) on Solaris 10 I use this command
java -cp $SGE_ROOT/lib/drmaa.jar:SgeDrmaaJobRunner.jar -Djava.library.path=$LD_LIBRARY_PATH net.bokov.sge.SgeDrmaaJobRunner soft host not_wait /tools/job.sh host2-dev-net
Also you specify not only one queue name, but use a lists of queue’s names as parameter –
qsub -q queue_1, queue_2 $SGE_ROOT/examples/jobs/simple.sh
At least qsub allows this syntax 🙂
CppCMS – c++ framework for highloaded web projects and applications. As I can understand CppCMS faster when WordPress + PHP in in 5 times at least, but currently it used only by project owner to support CppCMS blog. To get more info about this project you may look at this links : How to install wiki++ and Wiki++ installation package