Ask Computer Engineering Expert

1. Choose the INCORRECT statement. 
A) All variables must be declared before they can be used. 
B) Variables consist of letters, digits, and underscores. 
C) Keywords can be used as variable names. 
D) Variables cannot begin with a digit. 
2. Which of the following usually indicates that there is no more input to be read by a program? 
A) 'n' 
B) '' 
C) END 
D) EOF 
3. If a file is opened for reading and the file does not exist, what action is taken? 
A) A new file is created. 
B) A NULL value is returned. 
C) An error message is issued. 
D) An EOF value is returned. 
4. Which of the following statements is true? 
A) int expressions are always computed exactly; but float expressions can suffer round-off error 
B) float expressions are always computed exactly; but int expressions can suffer round-off error 
C) Both int and float expressions can suffer round-off error 
D) Both int and float expressions will always be computed exactly 
5. What is the effect of the following recursive function? 

void Mystery(int A[ ], int size) 

if (size > 0) {A[0] = 0; Mystery (A+1, size -1);} 





A) It sets the first element of the array A to zero. 
B) It sets the last element of the array A to zero. 
C) It sets all elements of the array A to zero. 
D) It generates an infinite recursion loop. 
6. An #include file will usually contain: 
A) constants defined with #define. 
B) function prototypes. 
C) type definitions. 
D) all of the above. 
7. What is the effect of the following code? 

char Ch; 
Ch = '7'; 
printf("%dn", Ch); 

A) It will cause an error 
B) It will print out the computer's internal code for the character '7' 
C) It will print out the character '7' 
D) It will print out the character whose internal code is 7 
8. The most common reason for using a macro instead of a function is: 
A) to save storage space. 
B) to reduce the possibility of errors. 
C) to make the program run faster. 
D) all of the above. 
9. What is the two's complement of -Y (negative Y)? 

X=1100110000110011 
Y=0000111100001010 

A) 0000111100001010 
B) 1111000011110101 
C) 1111000011110110 
D) 1100000000110001 
10. What is the advantage of using a pointer to a structure as a parameter to a function, instead of the structure itself? 
A) The code is easier to read. 
B) It is more efficient because the structure is not copied. 
C) There is no difference; it is a matter of style which is used. 
D) Passing a structure as a parameter is not allowed. 
11. Choose the invalid C statement. 
A) int a, b=2, c=3; 
B) char a[]="abc", *p = a; 
C) a+b = 7; 
D) ++(*p++); 
12. If we want the random number library function to produce a different sequence of values each time the program is run which of the following statements should be used? 
A) setenv(rand()); 
B) fopen(srand()); 
C) srand(clock()); 
D) srand(time(NULL)); 
13. The scalar() function uses po1?x to access the first member of the a structure. Which of the following constructs can be equally used within the function to access the same member? 

struct vector 

float x; 
float y; 
float z; 
}; 

void main(void) 

struct vector a = {2.3, 4.2, 6.,5}; 
struct vector b = {-1.2, 3.5, 5.1}; 
float scalar(vector *, vector *); 
printf("The answer is %.2f", scalar(&a, &b)); 


float scalar(struct vector*po1,, struct vector *po2) 

float s; 
s=po1?x*po2?x + po1?y*po2?y + po1?z*po2?z; 
return(s); 


A) po1.x 
B) *po1.x 
C) (*po1).x 
D) a.x 
14. Choose the C++ statement which is equivalent to: 

printf("Area = %g n", PI * Radius * Radius); 

A) cout >> "Area = " >> PI * Radius * Radius >> endl; 
B) cout << "Area = " << PI * Radius * Radius << endl 
C) cout << "Area = " << PI * Radius * Radius; 
D) cout << "Area = " << PI * Radius * Radius << endl; 
15. Given the structure and pointer declarations shown below, choose the assignment statement which sets the Price member of the structure pointed to by PC to 1000. 

struct Computer 

char Manufacturer[30]; 
float Price; 
int Memory; 
} *PC; 

A) PC?Price = 1000.0; 
B) PC.Price = 1000.0; 
C) *PC.Price = 1000.0; 
D) Computer.Price = 1000.0; 
16. Assuming the following declarations: 

int A=1, B=2, C=3, D=4; 

What is the value of the following (Boolean) expression? 

C == D || B > A && C 

A) 0 
B) 1 
C) There is a syntax error in the expression. 
D) There is no error, but the value cannot be determined from the information given. 
17. Choose the correct statement below: 
A) It is generally a good rule for applications programmers to use identifiers that begin with an underscore. 
B) The compiler considers the string constant "this is a message" as 4 separate tokens. 
C) An operator in C specifies an operation to be performed on an operand or a set of operands. 
D) In the following expression: while(++jj >= 75), the body of the while loop is not executed when the expression ++jj is equal to 75. 
18. Given the following two-dimensional array declaration and initialization, what is the value of the expression *(a[1]+2)? 

int a[ ][4] = {{1,2,3,4},{5,6,7,8}}; 

A) 3 
B) 6 
C) 7 
D) The subscript exceeds array bounds. 
19. Using the rules of precedence, the following expression: 

u*z+x/t-y+w%v 

will be evaluated as: 

A) u*(z+x/t)-(y+w)%v 
B) (u*z)+x/(t-y)+(w%v) 
C) (((u*z)+(x/t))-y)+(w%v) 
D) (((u*z)+(x/t)-(y+w)%v 
20. What is the output of the following code? 

void Mystery (char *Str) 

if (*Str != '') 

Mystery(Str + 1); 
printf("%sn", Str); 



Mystery("abcd"); 

A) d 
cd 
bcd 
abcd 
B) "null string" 

cd 
bcd 
abcd 
C) abcd 
bcd 
cd 

D) d 
cd 
bcd 
abcd 
21. What is the purpose of a constructor? 
A) To declare a new class 
B) To copy a new value into a string 
C) To initialize an object 
D) To define macros with arguments 
22. When a program is compiled, the following process takes place: 
A) the compiler and the loader are invoked. 
B) the loader is first invoked and then the preprocessor. 
C) the compiler is first invoked, then the preprocessor, and finally the loader. 
D) the preprocessor is invoked, then the compiler, and finally the loader. 
E) the compiler translates the code into object code. 
23. Which of the following statements allocates space for a variable of the defined enum type? 
A) enum color {red, yellow, blue} paint; 
B) enum color {red, yellow, blue}; 
C) enum {red, yellow, blue} paint; 
D) a and c 
24. Which of the following would typically be found as environment variables? 
A) Base directory name 
B) Total processor time used by a program 
C) A list of names and phone numbers 
D) All of the above 
25. Which of the statements below is true of the following declaration: 

int n=5, *p=&n; 

A) p is a pointer initialized to point to n. 
B) p is a pointer initialized to the value 5. 
C) n and p are both pointer variables. 
D) the declaration contains a syntax error  

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9650110

Have any Question?


Related Questions in Computer Engineering

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Jeff decides to start saving some money from this upcoming

Jeff decides to start saving some money from this upcoming month onwards. He decides to save only $500 at first, but each month he will increase the amount invested by $100. He will do it for 60 months (including the fir ...

Suppose you make 30 annual investments in a fund that pays

Suppose you make 30 annual investments in a fund that pays 6% compounded annually. If your first deposit is $7,500 and each successive deposit is 6% greater than the preceding deposit, how much will be in the fund immedi ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

A real estate developer will build two different types of

A real estate developer will build two different types of apartments in a residential area: one- bedroom apartments and two-bedroom apartments. In addition, the developer will build either a swimming pool or a tennis cou ...

Question what some of the reasons that evolutionary models

Question : What some of the reasons that evolutionary models are considered by many to be the best approach to software development. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As