Computer Science, assignment 2 PDF

Title Computer Science, assignment 2
Author Mi im
Course Computer Science
Institution University of Regina
Pages 1
File Size 86.3 KB
File Type PDF
Total Downloads 45
Total Views 168

Summary

Assignment 2 computer science all assignment 2 ....


Description

Assignment 2 1- convert 1011 0100 0111 1000 from binary to hex. Show you work. (1011 0100 0111 1000)2 =(B478)16 2. Create a Huffman Code Tree for the following table. SHOW ALL OF YOUR WORK! (X/35) 3. What are the three types of programming languages? Give one example of each. (X/6) 1- Machine language( Low-level) Example: Addition=00101100 2-Assembly language (mid-level) Example additional =ADD Language example MIPS, APIM 3- High-level language: Example additional: z=x+y Example language:C,C++,C#,JAVE,PYTHON,HTML,CSS 4- What is the function of each of these C++ commands? (X/9) Cout: When a user wants to print some text or value of any variable that was defined previously then cout is used. it displays all values on the screen Cin: in order to accept the value from the user and assign it to a particular variable, the developer must make use of Cin variable. Any value can be accepted from the user and assigned to the variable of any data type that is created %: It is for taking modules. #Include: this includes command helps in include the mentioned files in the code and make use of those. It can be used in two ways •#include •#include"filename" Main(): the main function is called at program startup after initialization of the non-local objects with static storage duration. It is the designated entry point to a program that is executed in a hosted environment ( that is, with an operating system) ; Is end of the statement // Single line comment /**/ Multi line commentà 5. Write a C++ line of code to declare a variable of type “double” that signifies the average of student grades, then initialize the variable to 50.00 (X/6) C++ syntax to declare a variable is dataType variableName = value; dataType is double variableName is average value is 50.00 So C++ line of code to declare a variable of a type that signifies the average of student grades, then initialize the variable to 50.00. double average 50.00. The answer double average = 50.00. 6. What are the three types of C++ errors? Give two examples of each type. (X/9) 1- Syntax error: Example is a typo in code and misspelled instructions, missing semicolon. 2-Run-time-error: Examples occurs when the program is executed(run time) Causes program to terminate or abort 3-Logic error: Example Error with the behavior of the program and occurs when three are syntax or run-time errors, but the code does not work as intended. 7. Find all errors in this program. Write out the correct version of this program (X/30)...


Similar Free PDFs