ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 12 Weeks Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 24 May 2017 My Price 9.00

value of x after the code executes

can any answer these question ASAP?

1. (TCO 3) Given the following code and flag = 2, what is the value of x after the code executes?
 
int x = 0;   
switch (flag)
{
case 0:
       x++;
       break;
case 1:
case 2:
       x++;
case 3:
       x++;
       break;
case 4:
       x++;
case 5:
case 6:
       x++;
case 7:
       x++;
       break;
default:
       break;
}(Points : 5)        x
will be 0.
       x
will be 1.
       x
will be 2.
       x
will be 3.

Question 2. 2. (TCO 8) Which is the command used to create a file for input?(Points : 5)
       ofstream myFile;
       myFile.create("file.txt");
       ifstream myFile;
       myFile.create();

 

Question 3. 3. (TCO 6) Given the following two-dimensional array initialization, which value is stored in myArray[3][2]?


       // Create an array with std::array
       array <array <int, COLUMN>, ROW> myArray =
       {{
             {1,2,3,4,5},
             {10,20,30,40,50},
             {100,200,300,400,500},
             {6,7,8,9,0}
}};(Points : 5)
       30
       200
       400
       8

 

Question 4. 4. (TCO 5) From the list below, which is a function prototype?(Points : 5)
       int myFunc( int);
       int myFunc(int x)
   {
       return 2*x;
   }
       y = myFunc(3);
       int myFunc(int){}

 

Question 5. 5. (TCO 5) In the code below, which is the value of x after the program returns from y=myfunc(x);?


#include <iostream>
#include <string>
 
using namespace std;
 
//******Function Prototypes******
int myFunc(int);
 
//******End of Function Prototypes******
 
//-------------------------------
//******Program starts here******
//-------------------------------
int main()
{
       int x =0;
       int y =0;
       x = 10;
       y = myFunc(x);
       // Wait for user input to close program when debugging.
       cin.get();
       return 0;
}
//******End of Main******
 
//******Function Definitions******
int myFunc(int x)
{
       int j = 2*x;
       x = 2*j;
       return j;
}
//******End of Function Defintions******(Points : 5)
       0
       40
       20
       10

 

Question 6. 6. (TCO 5) Which statement best describes the following?


      #include <iostream>(Points : 5)
       This is a preprocessor command.
       It gives access to a user-created header file.
       This is required to do file IO.
       All of the above

 

Question 7. 7. (TCO 5) In the code below, which is the value of x after the program returns from y=myfunc(x);?


#include <iostream>
#include <string>
 
using namespace std;
 
//******Function Prototypes******
int myFunc(int &);
 
//******End of Function Prototypes******
 
//-------------------------------
//******Program starts here******
//-------------------------------
int main()
{
       int x =0;
       int y =0;
       x = 4;
       y = myFunc(x);
       // Wait for user input to close program when debugging.
       cin.get();
       return 0;
}
//******End of Main******
 
//******Function Definitions******
int myFunc(int
&x)
{
       int j = 2*x;
       x = 2*j;
       return j;
}
//******End of Function Defintions******(Points : 5)
       16
       0
       8
       4

 

Question 8.8. (TCO 3) Which does the following line of code do?

 

 

X = (flag1 == flag2)? 4: 20;(Points : 5)

       If flag1 and flag2 are equal to 4, 20 is stored in X.
       If flag1 is not equal to flag2, 4 is stored in X.
       X, flag1, and flag2 are set to 4:20.
       If flag1 equals flag2, 4 is stored in X.

Answers

(11)
Status NEW Posted 24 May 2017 06:05 AM My Price 9.00

-----------

Not Rated(0)