Ask C/C++ Expert


Home >> C/C++

Assignment

1.A logical OR false if:
Only one input is true
There is no such thing as an AND gate
Neither input is true
Both inputs are true

2.A bitwise XOR is true if
Only one input is true
There is no such thing as an OR gate
Both inputs are true
Either input is true

3.The !operator is true
If the input is true
A NOT gate does not exist
If there is no input
If the input is false

4.Which of the following is not a C++ looping structure
DO-UNTIL
DO-WHILE
While
For

5.In a for statement, there are two semi-colons. In which area of a for loop does the initialization of the control variable occur?
Between the first semicolon and the second semicolon
The for loop does not do any tests
After the second semicolon
Before the first semicolon

6.if(x == 2 |- y == 3)
{
//Do Something
}
The |- stands for
AND
XOR
OR
No valid answer for this question!

7.Which of the following statements will cause a switch statement or a loop to terminate immediately?
break
halt
stop
continue

8.In order to stop one case in a switch to fall through to the next case, you would use the ________________ statement
default
break
continue
next case

9.The default statement is used in a switch in order to provide
a case for anything that does not match any other case
a case that might be executed if the single case above it is not executed.
There is no such statement in C++!
a case that is always executed

10.Given that a bit pattern stored in the variable x is 00000101, what will x <<= 1 do to this bit pattern?
It would make it 00001010
Nothing. This does not exist in C++!!
It would make it 00000010
It would make it 00000001

11.The continue statement causes a loop to
This is not a C++ statement!
immediately go to the next iteration after completing the remaining steps in the loop
immediately go to the next iteration without completing the remaining steps in the loop
immediately terminate

12.Which of the following escape characters will cause the a backspace character to be printed to the screen?
\n
\b
\r
\t

13.Which of the following is not a C++ data type?
All are
float
double
char
bool
integer

14.Which of the follow will always execute the body of the loop at least once, regardless of the condition.
a while loop
a do-while loop
a switch statement
a for loop

15.In a for statement, there are two semi-colons. In which area of a for loop does the testing occur?
The for loop does not do any tests
Between the first semicolon and the second semicolon
Before the first semicolon
After the second semicolon

16.Boolean expressions are evaluated similarily to the way arithmetic expressions are evaluated
True
False

17.A switch statement is not a good way to implement a menu for the user of your program
True
False

18.Indentation of code is required by the compiler in C++, and servers no useful purpose for the programmer.
True
False

19. Which of the following is not a C++ data type?
int
double
bool
whole
char
float

20.Variables contained within a block, ie, starting with a { and ending with a } are global variables.
True
False

21.If an identifier is declared as a variable in each of two blocks, one within the other, then these are two different variables with the same name. One variable exists only within the inner block and cannot be accessed outside of the inner block. The other variable exists only in the outer block and cannot be accessed in the inner block. The two variables are distinct, so changes made to one of these variables will have no effect on the other of these two variables.
True
False

22.A block is some C++ code enclosed in braces. The variables declared in a block are local to the block and so the variable names can be used outside of the block for something else.
True
False

23.Which of the following has the highest precedence?
* (Multiply)
&&
==
Unary minus

24.The // is used for _______________
marking the start of a multi-line comment
dividing doubles
making a single line comment, or commenting at the end of a line
This is not part of C++!!!

25.Which of the follow will always execute the body of the loop at least once, regardless of the condition.
a for loop
a switch statement
a do-while loop
a while loop

26.By default, cin uses whitespace as the data separator.
True
False

27.The iomanipsetfill() needs to be "turned off." Meaning, it is set only for the output statement you are currently within.
True
False

28.In order to use setfill(), or any of the other items, you must include and be using cout only.
True
False

29.A byte is 16 bits.
True
False

30.In order to shift the value in an integer variaible x one bit to the left, you would use x <<= 1;
True
False

31.C++ automatically initialized variables to ______________
1
-1
Junk values
0

32.Which of the following iomanip functions does not need to be "turned off" if you use it?
setfill
oct
setprecision
setw

33.A short int has 32 bits on a 32 bit machine.
True
False

34.The data range of a int and an unsigned int are the same.
True
False

35.Masking operations work only on integer and integer-like variables
True
False

36.while( i = 0)
cout<<"Hello"<Will iterate indefinitely.
True
False

37.Assignments can be done within a while, if, or do-while condition.
True
False

38.Assuming that x and y are ints,
x ^= y;
y ^= x;
x ^= y;
will __________________
cause a random value to appear in x and y
do nothing. Will not compile!
Swap the values of the variables x and y
will make x and y the same value

39.A for statement requires all three parts, separated by semi-colons, to have a statement within them.
True
False

40.The comma operator allows you to put multiple statement on one line ending with a semi-colon.
True
False

41.in order to use cin, you must include fstream
True
False

42.The number of digits in an integer is one less than the log base 10 of the number.
True
False

43.In standard C++, you can use either && or and for a logical AND in an if statement
True
False

44.In standard C++, you can use an || or an or in an if statement condition.
True
False

45.The sign bit of an integer is bit number 0 in C++.
True
False

46.When converting from double to integer, it is not possible to lose information.
True
False

47.The log10 function works only on doubles or floats.
True
False

48.A while statement cannot be nested within an if statement
True
False

49.The else statement is required on all if statements;
True
False

50.for(int i = 0; i < 100000; i++);
is a valid C++ statement
True
False.

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M92286234
  • Price:- $50

Priced at Now at $50, Verified Solution

Have any Question?


Related Questions in C/C++

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

  • 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