Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

CamelCase is a naming schema that capitalizes the first letter of each word exce

ID: 672932 • Letter: C

Question

CamelCase is a naming schema that capitalizes the first letter of each word except for the first word for variable names that are a concatenation of words. Variable names can have spaces in them. In C++, uninitialized variables always hold the value 0. When you divide an int variable or literal by another int variable or literal, you get the integer quotient as a result. The Dark GDK's random number generator automatically reseeds itself with a unique value each time it is executed. In a math expression, multiplication and division takes place before addition and subtraction. Constant variables' values can be altered by the program during the program's execution. DWORD is an primitive data type in C++. Algorithms And Programs Declare three variables, varOne, varTwo and varThree, and assigned to each variable 23, 3.1415, and dbRGB(255, 50, 255) respectively. Make sure to use the correct data types. Write the code that declares three int variables, red, green, blue, and initialize each variable with a random number between 0 and 255 inclusively. Afterwards, clears the screen and fills it with the color derived from the three variables. You wish to create a random generator that provides random even integers from 8 to 20. Write the statement that represents that random generator. Let result, w, x, y, z be int variables and assume that w = 5, x = 7, y = 8, andZ= 2. What value will be stored in result after each of the following statements are executed: result = x + y; result = z * 2; result = x / y; result = w % z; result = y- z; result = x + y * w/z; Write the two dbCircleQ functions that will draw the Venn Diagram as displayed below:

Explanation / Answer

True or False :


(a)
camelCase is a naming standard which is used
to break down when representing variables of two
or more words.
Each word is a capital
letter except for the first word in concatenation of words.

Hence, the statement is True

------------------------------------------------------------------------------------------------------------------------------

(b)
Variable names can contain small letter, upper case,
and under score.
Variables must not contain any space in between the letters..
Hence, the statement is False

------------------------------------------------------------------------------------------------------------------------------

(c)
Uninitialized variables are not set to zero.
Compiler throws run time errors if used without initialization.
C++ compiler will not set uninitialzed values to zero.
Hence, the statement is False

------------------------------------------------------------------------------------------------------------------------------
(d)
When numerator and denominatior are integer values,
then the resultant is also a integer value.

For a=10, b=3
then a/b=10/3=3
Result will be a integer value.Discard decimal values.
Hence, the statement is True

------------------------------------------------------------------------------------------------------------------------------

(e)

The Dark GDK random number generator
dbRND(limit) will return same random number
if program executes several times.

Hence, the statement is False.

------------------------------------------------------------------------------------------------------------------------------

(f)
Multiplication and division operators have higher precedence
over the addition and subtraction in the mathematical operations.
Hence, the statement is True.

------------------------------------------------------------------------------------------------------------------------------

(g)
Constants variable's will not change its values during the program
execution.
Hence, the statement is False.

------------------------------------------------------------------------------------------------------------------------------

(h)
DWORD is used to store color value and it is the primitive data type of size 4 bytes(=32 bits)
Hence, the statement is True.
---------------------------------------------------------------------------------------------------------------------
Programs and Algorithms


(a)

//Since 23 is integer , data type is int is used
int varOne=23;
//Since 3.1415 is value with decimals , data type is double used
double varTwo=3.1415;
//DWORD is used to set colors
DWORD color = dbRGB(255, 50,255);

------------------------------------------------------------------------------------------------------------------------------

(b)
Note : DWORD color = dbRGB(redColor,
       greenColor, blueColor);
//Color range : 0 to 255

//To set red color , use 255 as redColor, rest of arguments
//set to zero
DWORD red = dbRGB(255, 0, 0);
//To set green color , use 255 as greenColor, rest of arguments
//set to zero
DWORD green = dbRGB(0, 255, 0);
//To set blue color , use 255 as blueColor, rest of arguments
//set to zero
DWORD blue = dbRGB(0, 0, 255);

dbClear(red, green, blue) //clears the screen and fills
with the specified solors from red, green and blue

------------------------------------------------------------------------------------------------------------------------------

(c)
Generate random numbers in the range of 8 to 20.

int seed;
const int size=6;
int arr[size]
int index;
int random=8;
for(index=0;index<6;index++)
{
   seed = dbTimer();
   int value=dbRandomize(seed);      
   //check if value is even and continue it is even
   while(!isEven(value))
   {
   seed = dbTimer();
   value=dbRandomize(seed);      
   }

   arr[index]=value;
}

bool isEven(int value)
{
   return value%2==0;
}

----------------------------------------------------------------------------------------------------
(d)

int w=5;
int x=7;
int y=8;
int z=2
a.
result=x+y
result=7+8=15
result=15

b.
result=z*2;
result=2*2;
result=4;

c.
result=x/y;
result=7/8;
//ignores the decimal values in integer division
result=0

d.
result=w%z
//remainder value by dividing 5 by 2
result=5%2;
result=2

e.
result=y-z;
result=8-2;
result=6;

f.
result=x+y*w/z;
result=7+8*5/2;
//Multiplication * have higher precedence over / and +
result=7+35/2;
//Division / have higher precedence over +
result=7+17; //ignores the decimal value in integer division
result=24;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote