CE Home
Navigation
Go Back   CrazyEngineers Forum > CE : Technical Discussions > Computer Science & IT Engineering
Notices


Advertisements
Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)
Old 22nd September 2008, 02:32 PM
Good Administrator
 
The_Big_K's Avatar
 
Join Date: 26th November 2005
Location: Terra-Firma
I'm a Crazy Electrical Engineer
Posts: 5,674
Send a message via Yahoo to The_Big_K
Thumbs up Programming exercise for newbies

Here's a small coding exercise for programming newbies. I asked this question in an interview to a computer science graduate and she could not solve it. It was surprizing. The computer science, IT engineers should start thinking on their own - mugging up the stuff from book doesn't help.

So here's a simple programming challenge [for newbies]:-

Write a program that accepts a new text strings, one on each line, but prints a line number before it accepts the input. The lines are then printed out, with each word individually reversed.

That is, the output should look like -
<Text string Input>

1: Hello, this is The Big K
2: This is line number 2
3: ___

*******************************
1: K giB ehT siht ,olloeH

etc.

I hope you got the problem. Use any damn computer programming language of your choice. The only bet is - you crack this question on your own. The purpose is to make you think, not to test your Google search skills.

All the best.

[Provide all details in comments inside your code]
The_Big_K is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)
Old 22nd September 2008, 02:49 PM
ash
Moderator
 
ash's Avatar
 
Join Date: 12th July 2007
Location: IIUM, Malaysia
I'm a Crazy Communications Engineer
Posts: 1,668
Default Re: Programming exercise for newbies

[spam]
*quickly closes Google Search*

uh.. say what?

It'll be interesting to code this in a language you are not familiar with
[/spam]
__________________
Keep it simple. Keep it real.
| New to CE? Click here! | Join our CE Bot project! | Problems? Questions? PM or mail me at ash{at]crazyengineers{dot]com |
ash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)
Old 22nd September 2008, 09:11 PM
CE - Apprentice
 
gaurav.bhorkar's Avatar
 
Join Date: 6th August 2008
Location: Nagpur
I'm a Crazy Computer Science Engineer
Posts: 28
Send a message via Yahoo to gaurav.bhorkar
Default Re: Programming exercise for newbies

I do not know any computer language as I am in 1st year but still, i will try using HTML code and JavaScript.

<html>
<body>
<script language="JavaScript">
a=parse(prompt("text here"));
document.write(+a);
document.write(+"1: Hello, this is The Big K");
document.write(+"2: This is line number 2");
document.write(+"3: ___");
</script>
</body>
</html>


I guess it is correct.
__________________
GaUrAv
gaurav.bhorkar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)
Old 22nd September 2008, 09:30 PM
CE - Newbie
 
Join Date: 22nd September 2008
Location: presently in bangalore
I'm a Crazy electronics Engineer
Posts: 1
Default Re: Programming exercise for newbies

hey can u select one best project in electronics
chtn is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)
Old 22nd September 2008, 11:25 PM
Good Administrator
 
The_Big_K's Avatar
 
Join Date: 26th November 2005
Location: Terra-Firma
I'm a Crazy Electrical Engineer
Posts: 5,674
Send a message via Yahoo to The_Big_K
Smile Re: Programming exercise for newbies

Quote:
Originally Posted by gaurav.bhorkar View Post
I do not know any computer language as I am in 1st year but still, i will try using HTML code and JavaScript.

<html>
<body>
<script language="JavaScript">
a=parse(prompt("text here"));
document.write(+a);
document.write(+"1: Hello, this is The Big K");
document.write(+"2: This is line number 2");
document.write(+"3: ___");
</script>
</body>
</html>

I guess it is correct.
Wow! I never expected such a simple solution!

I guess another simple solution would be to use "printf" or "cout" keywords to generate the output. Right?
The_Big_K is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)
Old 23rd September 2008, 02:13 PM
Good Administrator
 
The_Big_K's Avatar
 
Join Date: 26th November 2005
Location: Terra-Firma
I'm a Crazy Electrical Engineer
Posts: 5,674
Send a message via Yahoo to The_Big_K
Angry Re: Programming exercise for newbies

Hah!

Guys! This one is simple! I want the code! Right NOW!
The_Big_K is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)
Old 24th September 2008, 12:01 PM
CE - Apprentice
 
gaurav.bhorkar's Avatar
 
Join Date: 6th August 2008
Location: Nagpur
I'm a Crazy Computer Science Engineer
Posts: 28
Send a message via Yahoo to gaurav.bhorkar
Default Re: Programming exercise for newbies

Can anyone display this :

*
**
***
****
*****
__________________
GaUrAv
gaurav.bhorkar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)
Old 24th September 2008, 02:29 PM
CE - Regular Member
 
Join Date: 24th July 2008
I'm a Crazy Computer Engineer
Posts: 50
Default Re: Programming exercise for newbies

Gaurav this is very simple but good for newbie to computer science this problem should be like this
*
***
*****
*******
niraj.kumar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)
Old 24th September 2008, 02:30 PM
Good Administrator
 
The_Big_K's Avatar
 
Join Date: 26th November 2005
Location: Terra-Firma
I'm a Crazy Electrical Engineer
Posts: 5,674
Send a message via Yahoo to The_Big_K
Default Re: Programming exercise for newbies

I want the first problem to be cracked! No one yet?
The_Big_K is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)
Old 25th September 2008, 11:27 AM
CE - Addict
 
anuragh27crony's Avatar
 
Join Date: 12th January 2006
Location: INDIA
I'm a Crazy Computer Engineer
Posts: 341
Send a message via Yahoo to anuragh27crony
Default Re: Programming exercise for newbies

Does the line numbers...include Input...????
anuragh27crony is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +5.5. The time now is 01:02 PM.
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Member comments are owned by the poster. Copyright © 2005-2008 CrazyEngineers.com. All rights reserved.

Advertisements