Looking for Standard Template Library (STL) job? Do you have C/C++ Programming experience? Are you expertise in Office API development, MFC, STL, Boost? Then this is the right platform to search and apply jobs as well as preparing for the interview? The C++ STL (Standard Template Library) is a highly standard set of C++ format classes to offer broadly useful classes and functions with layouts that actualize numerous well known and generally utilized calculations and data structures like vectors lists, queues, and stacks. Find the relevant jobs on Standard Template Library (STL) including system operations analyst, developer, and senior embed SW developer, application software engineer, lead/Android security software developer, system analyst, Java developer, windows programmer, sr.administrator wintel etc. Go through wisdom jobs Standard Template Library (STL) job interview questions and answers page for better career opportunities.
Question 1. Write A Program In C++ Returning Starting Locations Of A Sub String Using Pointers?
Answer :
#include<stdio.h>
#include<iostream.h>
int main()
{
Char* mystrstr(char*,char*);
Char str1[20];
Char str2[10];
Cout<<"n Enter two stringst";
Cin>>str1>>str2;
Cout<<"nstr1 = "<<str1<<" str2 "<<str2 ;
Char* c= mystrstr(str1,str2);
If(c!=NULL)
printf ("nc = %sn",c);
Return 0;
}
Char* mystrstr(char* str1, char* str2)
{
Char *cp = (char *) str1;
Char *s1, *s2;
If ( !*str2 )
return ((char *)str1);
While (*cp)
{
s1 = cp;
s2 = (char *) str2;
While ( *s1 && *s2 && !(*s1-*s2) )
{
S1++;
S2++;
}
If (!*s2)
{
printf ("n string foundn");
return (cp);
}
cp++;
}
return(NULL);
}
Question 2. Write A Program In C/c++ To Implement Reader- Writer Problem?
Answer :
Readers-Writers Problem:
The readers-writers problem is a classic synchronization Problem in which two
Distinct classes of threads exist, reader and writer.
Multiple reader threads can be present in the Database simultaneously. However, the writer threads must have exclusive access. That is, no other writer thread, nor any reader thread, May be present in the Database while a given writer thread is present.
Note:
The reader/writer thread must call start Read()/start Write() to enter the database and it must call end Read()/end Write() to exit the database.
Class Database extends Object {
Private int numReaders = 0;
Private int numWriters = 0;
Private Condition Variable OKtoRead = new Condition Variable ();
private Condition Variable OKtoWrite = new Condition Variable ();
public synchronized void start Read() {
while (numWriters > 0)
wait(OKtoRead);
numReaders++;
}
public synchronized void end Read() {
numReaders--;
notify(OKtoWrite);
}
public synchronized void start Write() {
while (numReaders > 0 || numWriters > 0)
wait(OKtoWrite);
numWriters++;
}
public synchronized void end Write() {
numWriters--;
notify(OKtoWrite);
notifyAll(OKtoRead);
}
}
class Reader extends Object implements Runnable {
private Monitor m = null;
public Reader(Monitor m) {
this.m = m;
new Thread(this).start();
}
public void run() {
//do something;
m.startRead();
//do some reading…
m.endRead();
// do something else for a long time;
}
}
class Writer extends Object implements Runnable {
private Monitor m = null;
public Writer(Monitor m) {
this.m = m;
new Thread(this).start();
}
public void run() {
//do something;
m.startWrite();
//do some writing…
m.endWrite();
// do something else for a long time;
}
}
- 2 -
wait(Condition Variable cond) {
put the calling thread on the “wait set” of cond;
release lock;
Thread.currentThread.suspend();
acquire lock;
}
notify(Condition Variable cond){
choose t from wait set of cond;
t.resume();
}
notifyAll(Condition Variable cond){
for all t in wait set of cond;
t.resume()
}
For the following scenarios, we assume that only one reader thread and one writer thread are running on the processor.
Question 3. Explain Method Overloading?
Answer :
Method overloading is to overload methods using same class name by writing different parameters. This is called Method overloading.
Question 4. What Is Sorted Linked List?
Answer :
Linked list means node which is connected each other with a line. It means that each node is connected with another one. Each node of the list holds the reference of the next node.
If we talk about the sorted linked list , it is also a list just like another list. but the difference is only that it hold all the nodes in a sequential manner either in ascending order descending order.
Question 5. What Is The Acronym Of The Term C.o.m.p.u.t.e.r?
Answer :
Common operating machine a particular user technical education research. OR
Question 6. Tell Me About C++?
Answer :
c++ is object oriented programming language.. the main function value should return.
Question 7. How To Get The Sum Of Two Integers?
Answer :
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,sum;
printf("enter two numbers");
scanf("%d%d",&i,&j);
sum=i+j;
printf("sum=%d",sum);
}
Question 8. Why We Are Using The Fork Command And How It Works?
Answer :
In linux fork() system call is used to create a child process. The Child process inherits some properties of its parent and operates in a separate memory space.
Answer :
#include
#include
class person
{
int person;
float salary;
}p;
cout<<"enter the person name";
cin>>p.person;
cout<<"enter the salary";
cin>>p.salary;
}
void main()
{
person;
getch();
}
Answer :
27 4 is the output.
The call to the macro sets a = b*b*b with b = 3, 3 cubed is 27 then b is incremented to 4 after the macro call.
Question 11. Why & Sign Is Used In Copy Constructor?
Answer :
To avoid local copy of object reference (&) is used in copy constructor.
Moreover if the & is omitted then copy constructor goes in infinite loop.
eg. if class name is Sample.
Copy constructor without &
Sample :: Sample (Sample s)
{
//Code goes here
}
and we create object as follows. ;
Sample s;
Sample s1(s);
In this scenario program will go in infinite loop.
Answer :
#include
#include
class BOX
{
private:
int l,b,h;
public:
void input();
void print();
long volume(long,int,int);
};
void BOX::input()
{
cout<<"input values of l,b,h"<<"n";
cin>>l>>b>>h;
}
void BOX::print()
{
out<<"volume="<<"and";
}
void BOX::volume()
{
long volume(long l,int b,int h);
{
return(l*b*h);
}
}
void main()
{
set BOX b1;
b1.input();
b1.print();
b1.volume();
return;
}
Question 13. Tell Me What Is The Difference Between Thread And Process?
Answer :
Thread is a smallest unit of process. In process have one or more thread.
Question 14. What Is The Difference Between C++ And Vc++?
Answer :
VC++ uses all C++ features. VC++ has GUI and it is user friendly. It has many programming features like Win32, MFC, ATL, ActiveX, DLLs etc.
Answer :
It's a sophisticated and powerful library of template classes and template functions that implement many common data structures and algorithms, and forms part of the C++ Standard Library.
Question 16. Who Developed The Stl?
Answer :
The STL was developed at Hewlett Packard by Alexander Stepanov, with major contributions by David Musser and Meng Lee. It was deemed by the C++ Standards Committee to be so important to the future of C++ that the approval of the C++ Standard was delayed for several years so that the STL could be incorporated into that Standard. A version of the Standard that incorporated the STL was first approved in the fall of 1998.
Question 17. Why Should A C++ Programmer Be Interested In The Stl?
Answer :
Because the STL embodies the concept of reusable software components, and provides off-the-shelf solutions to a wide variety of programming problems. It is also extensible, in the sense that any programmer can write new software (containers and algorithms, for example), that "fit in" to the STL and work with the already-existing parts of the STL, provided the programmer follows the appropriate design guidelines.
Question 18. What Is The Design Philosophy Of The Stl?
Answer :
The STL exemplifies generic programming rather than object-oriented programming, and derives its power and flexibility from the use of templates, rather than inheritance and polymorphism. It also avoids new and delete for memory management in favor of allocators for storage allocation and deal location. The STL also provides performance guarantees, i.e., its specification requires that the containers and algorithms be implemented in such a way that a user can be confident of optimal runtime performance independent of the STL implementation being used.
Question 19. What Are The Major Components Of The Stl?
Answer :
The containers and container adaptors (both are objects that can hold other objects), the iterators (generalized pointers that point at items in containers), and the algorithms (that work on containers through iterators) will be the most frequently used components of the STL.
Question 20. What Are Some Other Components Of The Stl?
Answer :
Other STL components include function objects (objects of a class that defines operator()), or allocators (which manage memory allocation and deal location for containers). Function objects are essential for effective use of the STL, but the average user will be able to ignore allocators most of the time by simply accepting the default allocator for each container used.
Question 21. How Do You Use The Stl?
Answer :
By including the necessary header files to permit access to the parts of the STL that you need, by declaring objects of the appropriate container, iterator and function types, and then using member functions and/or algorithms, as appropriate, to perform whatever tasks your application requires. It is also generally necessary to ensure that whatever objects you plan to put into your container(s) are objects of classes that have a default constructor, a copy constructor, and an overloaded operator=. In addition, if you plan to sort or compare such container objects, the corresponding classes must provide definitions for operator== and operator<. Finally, since it is often the case that different containers can be used in the same problem situation, the user needs to be able to make an appropriate choice for each occasion, and this choice will usually be based on performance characteristics.
Answer :
In particular:
Standard Template Library (STL) Related Tutorials |
|
---|---|
UML Tutorial | Python Tutorial |
Adaptive software development Tutorial |
Standard Template Library (STL) Related Practice Tests |
|
---|---|
UML Practice Tests | Python Practice Tests |
Java-Multithreading Practice Tests | Java Design Patterns Practice Tests |
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.