Data Types Assignment And Input Output Statements


Test Instructions

Test Name:Federal 10th Class Computer Chapter 02
Test Type:Mcqs
Total Question:10
Total Marks:20
Total Time:30 Minutes
Chapter Name:Punjab Data Types, Assignment, Input Output Statements
Test For: All Punjab Boards 10th Class Students
The Punjab Board of Intermediate and Secondary Education BISE PUNJAB BOARD Computer Science Online Test for the 10th Class Model Paper Chapter No 02 has been provided for the Preparations. You should attempt this online Text Book, Model Papers and get higher marks and Grades because it is very helpful for you. For the Online Preparation of the Annual Examination of Matric 10 Class Computer Subject Data Types, Assignment, Input Output Statements.
Test Helpful For: Students of Punjab All Boards like Lahore, Gujranwala, Faisalabad, Sargodha, Rawalpindi, Multan, DG Khan, Bahawalpur and Sahiwal Matric (10th Class) for Preparation of their Annual Exams for Higher Grades. So you must Preparation here online.

Punjab Computer Science Online Test 10th Class Chapter 2 Data Types, Assignment, Input Output Statements

This quiz must be completed in 30 minutes.

Time left: 1800


Rate Test Below and Also Share Your Comments and Ideas about Test or Suggestion Below in Comments Section.

You Can Learn and Gain more Knowledge through our Online Quiz and Testing system Just Search your desired Preparation subject at Gotest.

Malik Tahir

Assignment Statement

Once you've declared a variable you can use it, but not until it has been declared - attempts to use a variable that has not been defined will cause a compiler error. Using a variable means storing something in it. You can store a value in a variable using:

name = value;

For example:


stores the value 10 in the int variable a. What could be simpler? Not much, but it isn't actually very useful! Who wants to store a known value like 10 in a variable so you can use it later? It is 10, always was 10 and always will be 10. What makes variables useful is that you can use them to store the result of some arithmetic.

Consider four very simple mathematical operations: add, subtract, multiply and divide. Let us see how C would use these operations on two float variables a and b.









Note that we have used the following characters from C's character set:

+ for add

- for subtract

* for multiply

/ for divide

BE CAREFUL WITH ARITHMETIC!!! What is the answer to this simple calculation?


The answer depends upon how a was declared. If it was declared as type int the answer will be 3; if a is of type float then the answer will be 3.333. It is left as an exercise to the reader to find out the answer for a of type char.

Two points to note from the above calculation:

  1. C ignores fractions when doing integer division!
  2. when doing float calculations integers will be converted into float. We will see later how C handles type conversions.


Leave a Reply

Your email address will not be published. Required fields are marked *