6 pages/≈3300 words
IT & Computer Science
Computer Science (Coursework Sample)
It was a coursework for the computer science project source..
CS 3 Module I Module Test Q1- Discuss generally how you could get a C++ Program running In the designer command incite window, enter md c:\hello to create a directory, and a short time later enter cd c:\hello to change to that directory. This is the directory that your source record and the compiled program are created in. Enter notebook hello.cpp in the order prompts window. Choose Yes when Notepad prompts you to make a document. This opens a clear Notepad window, ready for you to enter your code in a record named hello.cpp. In Notepad enter the lines of code. To limit mistakes, copy this code and glue it into Notepad. Save your work! In Notepad, on the File menu, choose Save. That will prepare to compile. Switch back to the developer command incite window. Enter dir at the command incite to list the contents of the c:\hello directory. You should see the source record hello.cpp in the directory posting. At the engineer command incite, enter cl/EHsc hello.cpp to compile your program. To run the hello.exe program, at the command prompts, enter hello. The program shows the content and exits. Q2- Is C++ case sensitive? How does it affect your coding if C++ is case sensitive? C++ is case delicate because computing frameworks are normally case touchy. It requires additional push to *not* be case delicate. Information devices like consoles need to recognize cases, as do yield devices, content utilities, typesetting frameworks etc. A few compilers enable you to turn case affectability off. Try not to be enticed to do this; your Compilers and other C++ developers will be extremely confused by your codes. …How? A case-delicate program that expects you to enter all commands in uppercase won't react correctly on the off chance that you enter at least one characters in lowercase. It will treat the command RUN uniquely in contrast to run. Projects that don't recognize uppercase and lowercase are said to be case-coldhearted. Q3- How do you use Library Functions? Library Functions: Library functions are the built-in function in C++ programming. Programmer can utilize library function by invoking function directly; they don't have to compose it themselves. For Example: sqrt() library function is invoked to calculate the square base of a number. You can utilize all functions defined in cmath when you include the content of document cmath in this program using #include
. Each legitimate C++ program has no less than one function, that is, main() function.
In the C++ programming language, the C++ Standard Library is a collection of classes and functions The C++ Standard Library gives a few generic containers, functions to use and control these containers, function objects, generic strings and streams (including interactive and document I/O), bolster for some language highlights, and functions for regular assignments such as finding the square base of a number.
How Do use…
…. Use for mathematical operations.
…. Function use for I/O.
…. Use for date and time.
CS 3 Module II Module Test
Discuss how a Modulus Operator functions does.
The modulus operator is helpful in an assortment of circumstances. It is commonly used to take an arbitrarily produced number and reduce that number to an irregular number on a littler range, and it can likewise quickly let you know whether one number is a factor of another.
In the event that you needed to know whether a number was odd or even, you could utilize modulus to quickly let you know by requesting the rest of the number when isolated by 2.
The key line is the one that plays out the modulus operation: "num % 2 == 0". A number is regardless of whether and just in the event that it is distinguishable by two and a number is detachable by another lone if there is no leftover portion.
Discuss at least two ways of using or getting a string into an array.
Array of Strings can be created in C++, which can be very helpful.
There are 3 different ways to create Array of Strings.
Using 2D array (Both C and C++):
This method is useful for shuffling, comparing and accessing characters randomly.
Drawbacks of this method:
Number of Strings and Size of String – both the qualities are settled.
A 2D array is allocated, whose second measurement is equivalent to most extreme estimated string which causes wastage of space.
Using string Keyword (Only in C++):
In this technique, size of the string isn't settled, hence space is spared.
Drawback of this method:
Array is of settled size.
Using Vectors (only C++)
STL container vector can be utilized to dynamically allocate array.
Out of all the three strategies, vector is by all accounts the most ideal path for creating cluster of strings in C++.
How does C++ categorize what type is a particular integer variable?
Data types define the kind of data a variable can hold, for instance an integer variable can hold integer data, a character compose variable can hold character data etc.
Data types in C++ are categorized in three gatherings: Built-in, user-defined and derived.
CS 3 Module III Module Test
Name at least two operators that are frequently used in loops. Explain each… Arithmetic Operators: There are following arithmetic operators upheld by C++ language. Let variable A holds 5 and variable B holds 10, at that point
OperatorDescriptionExample+Adds two operandsA + B will give 15-Subtracts second operand from the firstA - B will give -5*Multiplies both operandsA * B will give 50/Divides numerator by de-numeratorB / A will give 2%Modulus Operator and remainder of after an integer divisionB % A will give 0++HYPERLINK "/cplusplus/cpp_increment_decrement_operators.htm" \o "Increment operator in C++"Increment operator, increases integer value by oneA++ will give 6
There are following rational operators supported by C++ language. Assume variable A holds 10 and variable B holds 20, at that point
OperatorDescriptionExample==Checks if the values of two operands are equal or not, if yes then condition becomes true.(A == B) is not true.!=Checks if the values of two operands are equal or not, if values are not equal then condition becomes true.(A! = B) is true.>Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true.(A > B) is not true.<Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true.(A < B) is true.>=Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.(A >= B) is not true.Q2-
Explain what an ‘if’ statement does in a C++ program. If test expression is evaluated to true, a statement inside the body of “if” is executed. If test expression is evaluated to false, a statement inside the body of “if” is skipped.
CS 3 Module IV Module Test
Categorize Functions and provide description of what each function can do. User-defined Function: C++ allows programmer to define their own function.A user-defined function groups code to perform a specific task and that group of code is given a name (identifier). When the function is invoked from any part of program, it all executes the codes defined in the body of function.
When a program begins running, the system calls the main () function, that is, the system starts executing codes from main() function.
When control of the program reaches to function_name() inside main(), it moves to void function_name() and all codes inside void function_name() is executed.
Then, control of the program moves back to the main function where the code after the call to the function _ name () is executed as shown in figure above.
Function Call: To execute the codes of function body, the user-defined function needs to be invoked (called).In the above program, add(num1,num2); inside main() function calls the user-defined function. The function returns an integer which is stored in variable add. Return Statement: A function can return a single value to the calling program using return statement. In the above program, the value of add is returned from user-defined function to the calling program using statement below:
In the above program, the value of add inside user-defined function is returned to the calling function. The value is then stored to a variable sum. Notice that the variable returned, i.e., add is of type int and sum is also of int type. Also, notice that the return type of a function is defined in function declaratory int add(int a, int b). The int before add (int a, int b) means the function should return a value of type int.
Q2- Differentiate between Writing Functions for Array and Writing Functions for Structures Writing Functions for Array: At the point when an array is going as a contention to a function, just the name of an array is utilized as contention. e.g., show (marks); Notice the distinction while passing array as a contention instead of a variable. e...
Get the Whole Paper!
Not exactly what you need?
Do you need a custom essay? Order right now:
- Computer Science: The Similarities Between Hashing And Message DigestsDescription: A hash is a string of irregular looking characters that distinctively recognizes the data being denoted, much like your unique mark distinguishes you. It is possible to hash any data, regardless of whether it's a document similar to a music MP3 or only a series of characters like an undisclosed key....1 page/≈275 words| 1 Source | APA | IT & Computer Science | Coursework |
- Network Security: Similarities Between Cryptography And SteganographyDescription: Steganography is a piece of Network Security and running together well with cryptography. Where cryptography stows away just the substance of the message, it shrouds the presence of the message. It likewise has a major refinement with watermarking....1 page/≈275 words| 1 Source | APA | IT & Computer Science | Coursework |
- Relationship Between Knowledge, Data And InformationDescription: Knowledge is associated to human deeds and is made from flow of messages. In this paper we are going to base our arguments on the relationship between the three terms....2 pages/≈550 words| 2 Sources | APA | IT & Computer Science | Coursework |