• Result
  • Today's Puzzle
    • Previous Puzzles
    • Prize & Rules
  • Discussion Board
    • Suggestion Board
    • Trending Articles
  • Maths Tricks
  • Placement Papers
    • Placement Questions
    • Interview Experience
    • Placed user Comment
    • Group Discussion
  • English APP
  • login
  • Result
  • Today's Puzzle
    • Previous Puzzles
    • Prize & Rules
  • Discussion Board
    • Suggestion Board
    • Trending Articles
  • Maths Tricks
  • Placement Papers
    • Placement Questions
    • Interview Experience
    • Placed user Comment
    • Group Discussion
  • Walkins
    • Corporate Job Exam
    • Government Job Exam
    • Entrance Exam
  • Training
    • Internship
  • Placement Questions
  • /
  • C++
  • /
  • Programming
  • /
  • Program

C++ Programming - Program Technical Interview Questions

C++ Select Another Category Program Select Another Topic

Programming and Technical

  • Android 118
  • ASP.NET 60
  • C 459
  • C++ 448
  • DATA STRUCTURE 66
  • DBMS 77
  • ELECTRONICS 39
  • Java 261
  • OOPs Concepts 117
  • Operating Syst 103
  • RDBMS 109
  • UNIX 70

C++ Question Topics

    Category (1)

    General Ability (4)

  • General Knowledge (2)
  • HR Interview (1)

  • Interview (1)
  • Logical Reasoning (5)

  • Blood Relations (3)
  • Coding Decoding (1)
  • General Mental Ability (1)
  • Numerical Ability (1)

  • Area and Volume (1)
  • Programming (67)

  • Basics (1)
  • Database (2)
  • Definition (16)
  • Program (14)
  • Technical (32)
  • Variables (1)
Keep an EYE (0)
Solved Question (0) UnSolved Question (14)
Pages: 212NextLast
Advertisements

(#M40038181) C++ QUESTION Norvig Spellinbg Corrector Keep an EYE Keep an eye puzzle Keep an eye puzzle

What I wanted to do here is to develop, in less than a page of code, a toy spelling corrector that achieves 80 or 90% accuracy at a processing speed of at least 10 words per second.

So here, in 21 lines of Python 2.5 code, is the complete spelling corrector:

import re, collections

def words(text): return re.findall('[a-z]+', text.lower())

def train(features):
model = collections.defaultdict(lambda: 1)
for f in features:
model[f] += 1
return model

NWORDS = train(words(file('big.txt').read()))

alphabet = 'abcdefghijklmnopqrstuvwxyz'

def edits1(word):
splits = [(word[:i], word[i:]) for i in range(len(word) + 1)]
deletes = [a + b[1:] for a, b in splits if b]
transposes = [a + b[1] + b[0] + b[2:] for a, b in splits if len(b)>1]
replaces = [a + c + b[1:] for a, b in splits for c in alphabet if b]
inserts = [a + c + b for a, b in splits for c in alphabet]
return set(deletes + transposes + replaces + inserts)

def known_edits2(word):
return set(e2 for e1 in edits1(word) for e2 in edits1(e1) if e2 in NWORDS)

def known(words): return set(w for w in words if w in NWORDS)

def correct(word):
candidates = known([word]) or known(edits1(word)) or known_edits2(word) or [word]
return max(candidates, key=NWORDS.get)
The code defines the function correct, which takes a word as input and returns a likely correction of that word. For example:

>>> correct('speling')
'spelling'
>>> correct('korrecter')
'corrector'

Asked In C++ Pawan Pandey (11 years ago)
Unsolved
Is this Puzzle helpful?   (1)   (0) Submit Your Solution Program

(#M40032442) C++ QUESTION Loops Keep an EYE Keep an eye puzzle Keep an eye puzzle

Generate random number

Asked In C++ Sachin kumar (11 years ago)
Unsolved Read Solution (3)
Is this Puzzle helpful?   (4)   (1) Submit Your Solution Program
Advertisements

(#M40031849) C++ QUESTION Keep an EYE Keep an eye puzzle Keep an eye puzzle

What will be the output for the following C++ program ..??

class Sample
{
public:
int *ptr;
Sample(int i)
{
ptr = new int(i);
}
~Sample()
{
delete ptr;
}
void PrintVal()
{
cout << "The value is " << *ptr;
}
};
void SomeFunc(Sample x)
{
cout << "Say i am in someFunc " << endl;
}
int main()
{
Sample s1= 10;
SomeFunc(s1);
s1.PrintVal();
}

Asked In C++ Rajendra Singh (11 years ago)
Unsolved Read Solution (4)
Is this Puzzle helpful?   (7)   (5) Submit Your Solution Program

(#M40030304) C++ QUESTION C++ Keep an EYE Keep an eye puzzle Keep an eye puzzle

Difference between an array of pointers and a pointer to an
array?

Asked In C++ MAN (11 years ago)
Unsolved Read Solution (1)
Is this Puzzle helpful?   (0)   (0) Submit Your Solution Program

(#M40030277) C++ QUESTION C++ Keep an EYE Keep an eye puzzle Keep an eye puzzle

Which statement is true of "pure virtual" functions?
a) They force you to derive another class from the
base class which contains the function.
b) They contain no code.
c) Neither of these
d) Both of these

Asked In C++ MAN (11 years ago)
Unsolved Read Solution (3)
Is this Puzzle helpful?   (0)   (0) Submit Your Solution Program

(#M40028563) C++ QUESTION Technical Question on C++ and OOPS Keep an EYE Keep an eye puzzle Keep an eye puzzle

What is a size of empty class in c++?

Options
1) 4 bytes
2) 2 bytes
3) 0 bytes
4) 1 bytes

Asked In C++ MAN (12 years ago)
Unsolved
Is this Puzzle helpful?   (0)   (0) Submit Your Solution Program

(#M40028549) C++ QUESTION Technical Question on C++ and OOPS Keep an EYE Keep an eye puzzle Keep an eye puzzle

What will be the output of following program?

main()
{
int i=1;
for(;i<=32768;i++)
printf("%d",i);
}

Options
1) 32767
2) infinite loop
3) 32768
4) None of the above

Asked In C++ MAN (12 years ago)
Unsolved Read Solution (2)
Is this Puzzle helpful?   (11)   (4) Submit Your Solution Program

(#M40028548) C++ QUESTION Technical Question on C++ and OOPS Keep an EYE Keep an eye puzzle Keep an eye puzzle

What will be the O/P?

main()
{
struct xyz {
int i;
};
struct xyz *p;
struct xyz a;
p=&a;
p->i=10;
printf("%d",(*p).i);
}

Options
1) 0
2) 10
3) Garbage Value
4) Compile Time Error

Asked In C++ MAN (12 years ago)
Unsolved
Is this Puzzle helpful?   (0)   (0) Submit Your Solution Program

(#M40028543) C++ QUESTION Technical Question on C++ and OOPS Keep an EYE Keep an eye puzzle Keep an eye puzzle

What do you mean by storage classes?

Asked In C++ MAN (12 years ago)
Unsolved
Is this Puzzle helpful?   (0)   (0) Submit Your Solution Program

(#M40028540) C++ QUESTION Technical Question on C++ and OOPS Keep an EYE Keep an eye puzzle Keep an eye puzzle

What will be the output?

main()
{
int a[]={1,3,5,7};
printf("%d",&a[3]-&a[1]);
}


Options
1) 1
2) 2
3) 3
4) 4

Asked In C++ MAN (12 years ago)
Unsolved Read Solution (3)
Is this Puzzle helpful?   (5)   (1) Submit Your Solution Program
Keep an EYE (0)
Solved Question (0) UnSolved Question (14)
Pages: 212NextLast
  • Login
  • Register

Resend

Sponsored Links

Advertisements

Challenger of the Day

no image
Dimple
India
Punjab
Time: 00:01:33
Points
19

Maths Quotes

Everything in nature adheres to the cone, the cylinder and the cube.

Paul Cezanne

If I were again beginning my studies, I would follow the advice of Plato and start with mathematics.

Galileo Galilei

Placed User Comments

M4Math helped me a lot.

Vipul Chavan 5 years ago

Thanks m4 maths for helping to get placed in several companies.
I must recommend this website for placement preparations.

yash mittal 5 years ago

Now enjoy Offline Access of latest Question.

Get M4maths app to avail expert's solution and latest selected questions.

Download m4maths app now

  • 2533K+Registerd user
  • 1774K+Engineers
  • 759K+MBA Asprirant
  • 3K+Enginnering College
  • 250+Company Exam
  • 150K+Interview Questions
  • Site Links
  • Home
  • Result
  • Today's Puzzle
  • Discussion Board
  • Maths Tricks
  • Advertise with us
  • Contact Us
  • Useful Info
  • Maths Quotes
  • Previous Puzzles
  • Prize
  • Privacy Policy
  • Disclaimer and Copyright
  • Terms and Conditions
  • Sitemap
  • Placement papers
  • TCS Placement Paper
  • HCL Placement Paper
  • INFOSYS Placement Paper
  • IBM Placement Paper
  • SYNTEL Placement Paper
  • TECHNICAL Interview
  • HR Interview
All rights are reserved to @m4maths.com