A Few Questions On C

Reply

Join Date: Dec 2006
Posts: 2
Reputation: adam37 is an unknown quantity at this point 
Solved Threads: 0
adam37 adam37 is offline Offline
Newbie Poster

A Few Questions On C

 
0
  #1
Dec 21st, 2006
Hi,
I'm revising for an exam comming up in C Programming. Can anyone help by answering some typical questions which might come up in the examination. Any help would be appreciated.


Basic data types

  • What are the different types of data?
  • What are signed and non-signed data types?
  • What is a float used for?
  • Why have a double?

Maths operations

  • If you have an integer, how can you copy this value into a float?
  • What is the size of a double?
  • What is the logic for finding out if a number is a multiple of 4?
  • How can you use if statements to determine more than one feature?
  • How long is a piece of string?

Strings and arrays

  • What happens when you use scanf to enter a string with spaces present?
  • What happens when you use getchar to enter a string with spaces present?
  • How can you extract a string from another string?
  • How can you create an array of floating point numbers?

Structures and unions

  • How do you access the elements of a structure?
  • How can you set values to a specific part of the data structure?
  • Why use structures?
  • Where would you use a union?

Files

  • How do you open a file for reading?
  • How do you open a file for writing?
  • How do you open a file where you can append to the end?
  • How can you read data from a file?
  • How do you write data to a file?
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,052
Reputation: John A has much to be proud of John A has much to be proud of John A has much to be proud of John A has much to be proud of John A has much to be proud of John A has much to be proud of John A has much to be proud of John A has much to be proud of 
Solved Threads: 334
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: A Few Questions On C

 
0
  #2
Dec 21st, 2006
How about I give you a few links instead of answering all your questions?Well... there's a lot of information there, so I hope that you don't get too freaked out at all of that. Take what you need, leave the rest. And if you need help on a specific problem or question, feel free to ask it and we'll help you as best we can.

Hope this helps
"Technological progress is like an axe in the hands of a pathological criminal."

All my posts may be freely redistributed under the terms of the MIT license.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 16,601
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1614
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: A Few Questions On C

 
0
  #3
Dec 21st, 2006
>>What is the size of a double?
depends on operating system and possibly the compiler. But you can use sizeof(double) to get its size.

>>How long is a piece of string?
depends on where you cut it with your scissors. (sorry for the bad joke, I just couldn't resistet temptation :eek: )
The most important thing in the Olympic Games is not to win but to take part, just as the most important thing in life is not the triumph but the struggle. The essential thing is not to have conquered but to have fought well.
-Pierre de Coubertin, The Olympic Creed Inspired by Bishop Ethelbert
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 598
Reputation: SpS is on a distinguished road 
Solved Threads: 32
SpS's Avatar
SpS SpS is offline Offline
Posting Pro

Re: A Few Questions On C

 
0
  #4
Dec 21st, 2006
Originally Posted by adam37 View Post
Hi,
I'm revising for an exam comming up in C Programming. Can anyone help by answering some typical questions which might come up in the examination. Any help would be appreciated.


Basic data types

  • What are the different types of data?
  • What are signed and non-signed data types?
  • What is a float used for?
  • Why have a double?

Maths operations

  • If you have an integer, how can you copy this value into a float?
  • What is the size of a double?
  • What is the logic for finding out if a number is a multiple of 4?
  • How can you use if statements to determine more than one feature?
  • How long is a piece of string?

Strings and arrays

  • What happens when you use scanf to enter a string with spaces present?
  • What happens when you use getchar to enter a string with spaces present?
  • How can you extract a string from another string?
  • How can you create an array of floating point numbers?

Structures and unions

  • How do you access the elements of a structure?
  • How can you set values to a specific part of the data structure?
  • Why use structures?
  • Where would you use a union?

Files

  • How do you open a file for reading?
  • How do you open a file for writing?
  • How do you open a file where you can append to the end?
  • How can you read data from a file?
  • How do you write data to a file?
You certainely need to go through this site
http://www.c-faq.com/
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,480
Reputation: jwenting is a name known to all jwenting is a name known to all jwenting is a name known to all jwenting is a name known to all jwenting is a name known to all jwenting is a name known to all 
Solved Threads: 235
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: A Few Questions On C

 
0
  #5
Dec 22nd, 2006
if you're revising for an exam and still don't know those things you might as well cancel the exam and actually visit your classes the next time the course is taught because you're all but certain to fail (miracles do happen, but don't count on them).
42
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 519
Reputation: Bench is a jewel in the rough Bench is a jewel in the rough Bench is a jewel in the rough 
Solved Threads: 53
Bench's Avatar
Bench Bench is offline Offline
Posting Pro

Re: A Few Questions On C

 
0
  #6
Dec 22nd, 2006
Originally Posted by Ancient Dragon View Post
>>How long is a piece of string?
depends on where you cut it with your scissors. (sorry for the bad joke, I just couldn't resistet temptation :eek: )
Its twice as long as half its length, of course
¿umop apisdn upside down?
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,480
Reputation: jwenting is a name known to all jwenting is a name known to all jwenting is a name known to all jwenting is a name known to all jwenting is a name known to all jwenting is a name known to all 
Solved Threads: 235
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: A Few Questions On C

 
0
  #7
Dec 22nd, 2006
is it? I doubt you can say that without giving an appropriate margin for error.
For example if you take that piece of string and cut it in half you're actually removing some molecules which should make it shorter. But the change in bonding might make it longer.
42
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 4,304
Reputation: WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future 
Solved Threads: 410
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Industrious Poster

Re: A Few Questions On C

 
0
  #8
Dec 22nd, 2006
Originally Posted by Ancient Dragon View Post
>>How long is a piece of string?
depends on where you cut it with your scissors. (sorry for the bad joke, I just couldn't resistet temptation :eek: )
Originally Posted by Bench View Post
Its twice as long as half its length, of course
If you cut off both ends, the string is endless. So there! :p
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 16,601
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1614
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: A Few Questions On C

 
0
  #9
Dec 22nd, 2006
Originally Posted by WaltP View Post
If you cut off both ends, the string is endless. So there! :p
I'm freyed not.
The most important thing in the Olympic Games is not to win but to take part, just as the most important thing in life is not the triumph but the struggle. The essential thing is not to have conquered but to have fought well.
-Pierre de Coubertin, The Olympic Creed Inspired by Bishop Ethelbert
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 327
Reputation: Colin Mac is on a distinguished road 
Solved Threads: 22
Colin Mac Colin Mac is offline Offline
Posting Whiz

Re: A Few Questions On C

 
0
  #10
Dec 22nd, 2006
It would be understandable if you left most of those out and were unsure about some and asked for help, but even though I'm no expert, the majority of those questions are pretty basic. It shows you have not even tried, so you can't expect people to answer those for you.

If you are getting a test on C programming, you should have at least access to those answers even if you don't know them.
Last edited by Colin Mac; Dec 22nd, 2006 at 4:04 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1688 | Replies: 9
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC