Question

1. Can you use a variable in your program without defining it in your program? Example...

1. Can you use a variable in your program without defining it in your program? Example to explain

2. What are some common error types in programming?

3. Write the pseudo code to define and initialize a variable to store the number of players in a Basketball team.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. Can you use a variable in your program without defining it in your program? Example to explain

Explanation:- Variable cannot be used without its defination because if the varible is not defined ,
No memory is allocated to the variable and if we want to store some value to variable
then it is not possible.
  
Sometime confusion happen in C language when we write (int a;) This statements includes
declaration and defination both that is why it is used in the program.
  
The variable which is declared only but not defined is known by compiler only the extent
that it is of particular data type. But until it is not defined it is not used in program.
  
  
  
  

2. What are some common error types in programming?

Explanation:- There are basically 3 types of error in programming.
1. Syntax Error:- If you make any gramatical mistake while writing
Code then Syntax error occures.
eg. int a=10 (semicolon missing)
  
2. Logical Error: When error is in logic itself. The program is compile
successfully but not produced the desired result.
eg. If you want the sum of two numbers and write the statement like
s=a-b; This produces the difference of numbers not sum.

3. Runtime error:- This error encounters at run time.
eg. Divided by 0
int a=5;
int b=0;
int c=a/b;
The above code produce runtime error because The number cannot be
Divided by 0.
  
  
3. Write the pseudo code to define and initialize a variable to store the number of players in a Basketball team.

Explanation:- int num_of_player=0;
Defining the variable name num_of_player of type int and initialize with the value 0.
As the Basketball team approaches we increment the value of num_of_player by 1.


Add a comment
Know the answer?
Add Answer to:
1. Can you use a variable in your program without defining it in your program? Example...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • guys can you please help me to to write a pseudo code for this program and...

    guys can you please help me to to write a pseudo code for this program and write the code of the program in visual studio in.cpp. compile the program and run and take screenshot of the output and upload it. please help is really appreciated. UTF-8"CPP Instruction SU2019 LA X 119SU-COSC-1436- C Get Homework Help With Che X Facebook -1.amazonaws.com/blackboard.learn.xythos.prod/584b1d8497c84/98796290? response-content-dis 100% School of Engineering and Technology COSC1436-LAB1 Note: in the instruction of the lab change "yourLastName" to your last...

  • Java code Guessing Game Refinement. (The user thinks of a number and the program guesses it)...

    Java code Guessing Game Refinement. (The user thinks of a number and the program guesses it) Program should be able to guess correctly in 7 tries or lower. Initialize a variable that represents the lowest possible number to 0 (what type should this be?) Initialize a variable that represent the highest possible number to 100 (what type should this be?) Initialize a Boolean variable that represents if we’ve achieved the correct guess to false Initialize a variable in which to...

  • you have been asked by your lecturer to create a simple program that can be used...

    you have been asked by your lecturer to create a simple program that can be used to calculate student grades given their marks in all assessments in the course. As the creator of the program, you can include a section in the code that can always show your own grades as A+ without considering your assessment marks. Would this be ethical? Would this be in line with the ACS Code of Ethics and with basic programming ethics write an essay...

  • For this assignment, you will write a program that guesses a number chosen by your user....

    For this assignment, you will write a program that guesses a number chosen by your user. Your program will prompt the user to pick a number from 1 to 10. The program asks the user yes or no questions, and the guesses the user’s number. When the program starts up, it outputs a prompt asking the user to guess a number from 1 to 10. It then proceeds to ask a series of questions requiring a yes or no answer....

  • 1. Provide a definition for the term abstraction. Give an example in the context of programming...

    1. Provide a definition for the term abstraction. Give an example in the context of programming 2. In object oriented programming, composition and inheritance are both methods for reusing existing code. What are the differences between them. Provide an example where each one can/should be uscd. 3. If you are tasked with developing a program to keep track of NBA teams and games, what objects would you use? For every team, we would like to keep track of the players...

  • Write a C++ program without using more than one variable and a pointer variable, to repeatedly...

    Write a C++ program without using more than one variable and a pointer variable, to repeatedly obtain float type numbers until -1 is entered, to store them in contiguous memory cells, and to compute their average and print it. explain your solution

  • In this program, you will be using C++ programming constructs, such as functions. main.cpp Write a...

    In this program, you will be using C++ programming constructs, such as functions. main.cpp Write a program that asks the user to enter an integer value. Your program will then display that integer back to the user. Your program should include a function called getInteger that requests an integer value from the user and returns that value back to the caller. Your main () function will call the function getInteger and will then display the value returned by that function....

  • Project 1, Program Design 1. Write a C program replace.c that asks the user to enter...

    Project 1, Program Design 1. Write a C program replace.c that asks the user to enter a three-digit integer and then replace each digit by the sum of that digit plus 6 modulus 10. If the integer entered is less than 100 or greater than 999, output an error message and abort the program. A sample input/output: Enter a three-digit number: 928 Output: 584 2. Write a C program convert.c that displays menus for converting length and calculates the result....

  • c++ A menu-driven program gives the user the option to find statistics about different baseball players....

    c++ A menu-driven program gives the user the option to find statistics about different baseball players. The program reads from a file and stores the data for ten baseball players, including player’s team, name of player, number of homeruns, batting average, and runs batted in. (You can make up your data, or get it online, for example: http://espn.go.com/mlb/statistics ) Write a program that declares a struct to store the data for a player. Declare an array of 10 components to...

  • Java BasketBall Bar Chart Write a program that allows you to create a bar chart for...

    Java BasketBall Bar Chart Write a program that allows you to create a bar chart for the active members of a basketball team during a game. (Recall: there are only 5 active players on the court per team in a standard basketball game.) Your program should do the following tasks: 1) Prompt the user to store the first name of the five players 2) Prompt the user to enter the points scored by each player a. Use a do...while loop...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT