Question

In: Computer Science

QUESTION 6 A single line comment in C++ language source code can begin with _____   ...

QUESTION 6

A single line comment in C++ language source code can begin with _____

      
a) //
b) ;
c) :
d) /*

QUESTION 7

What is the output of the following program?

#include<iostream> using namespace std; class abc { public: int i; abc(int i) { i = i; } }; main() { abc m(5); cout<<m.i; }

a)Garbage
b)5       
c)Compile Error
d)None of the answers

QUESTION 8

The following operator can be used to calculate the value of one number raised to another.

      
a)None of the answers
b) ^
c)**
d) ^^   

QUESTION 9

What is the output of the following program?

#include <iostream> using namespace std; int main () { // local variable declaration: int x = 1; switch(x) { case 1 : cout << "Hi!" << endl; break; default : cout << "Hello!" << endl; } }

a) Hi
b)Hello
c)HelloHi
d)Compile Error

QUESTION 10

What is the output of the following program?

#include<iostream> using namespace std; main() { int a[] = {1, 2}, *p = a; cout<<p[1]; }
      
a)2
b)1
c)Compile Error
d)Runtime Error

Solutions

Expert Solution

6. A single line comment in C++ language source code can begin with a) //

7.What is the output of the following program?

#include<iostream> using namespace std; class abc { public: int i; abc(int i) { i = i; } }; main() { abc m(5); cout<<m.i; }

b)5

8. The following operator can be used to calculate the value of one number raised to another.a)None of the answers.

We can do this using pow() function. In python we can use **.

9.What is the output of the following program?

#include <iostream> using namespace std; int main () { // local variable declaration: int x = 1; switch(x) { case 1 : cout << "Hi!" << endl; break; default : cout << "Hello!" << endl; } }

a) Hi

10. What is the output of the following program?

#include<iostream> using namespace std; main() { int a[] = {1, 2}, *p = a; cout<<p[1]; }
b)1

Please give a upvote if u feel helpful.


Related Solutions

Language: C and comment code please PThreads The goal of this homework is to show an...
Language: C and comment code please PThreads The goal of this homework is to show an understanding of pthreads and C. Assignment: Write a C program to use the bitwise operations with each bitwise operation contained within its own thread. Each thread should take 1 parameter and will only modify global values. First, create global integers x and y, then, in the main function you will read in values for x and y from the user and then create the...
C# programming. Comment/Explain the below code line by line. I am having a hard time following...
C# programming. Comment/Explain the below code line by line. I am having a hard time following it. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Nth_prime {     class Program     {         public static bool isPrime(int number)         {             int counter = 0;             for (int j = 2; j < number; j++)             {                 if (number % j == 0)                 {                     counter = 1;                     break;                 }             }             if (counter == 0)             {                 return true;             }             else             {                 return false;             }         }...
Write an x86 assembly language program that performs equivalently to the C++ source code file shown...
Write an x86 assembly language program that performs equivalently to the C++ source code file shown below.Please note that commented out behavior must be implemented in x86 assembly language. There is no standard, portable way to perform some of these actions in C++. #include void main() { // Use registers for these in your x86 assembly language program // Only use the .data segment for string (character array) variables int eax; int esi; int ecx; int edi; // Loop the...
IN C++ LANGUAGE PLEASE::: Distance calc. This question is fairly straightforward. Design (pseudocode) and implement (source...
IN C++ LANGUAGE PLEASE::: Distance calc. This question is fairly straightforward. Design (pseudocode) and implement (source code) a program to compute the distance between 2 points. The program prompts the user to enter 2 points (X1, Y1) and (X2, Y2). The distance between 2 points formula is: Square_Root [(X2 – X1)^2 + (Y2 – Y1)^2]
explain the code for a beginner in c what each line do Question 3. In the...
explain the code for a beginner in c what each line do Question 3. In the following code, answer these questions: Analyze the code and how it works? How can we know if this code has been overwritten? Justify how? #include <stdlib.h> #include <unistd.h> #include <stdio.h> int main(int argc, char **argv) { int changed = 0; char buff[8]; while (changed == 0){ gets(buff); if (changed !=0){ break;} else{     printf("Enter again: ");     continue; } }      printf("the 'changed' variable...
Create C# code that can search a text file and output the data at the line...
Create C# code that can search a text file and output the data at the line number inputted and amount of entries needed. Example of call in command window: Search16s filename.txt 273   10 Where 273 is the line number to start the output from, and 10 is the number of sequences that the program should output. The number of sequences entered on call should always be a odd number or give an error in console. The output should also display...
C Programming Language (Code With C Programming Language) Problem Title : Which Pawn? Jojo is playing...
C Programming Language (Code With C Programming Language) Problem Title : Which Pawn? Jojo is playing chess himself to practice his abilities. The chess that Jojo played was N × N. When Jojo was practicing, Jojo suddenly saw a position on his chessboard that was so interesting that Jojo tried to put the pieces of Rook, Bishop and Knight in that position. Every time he put a piece, Jojo counts how many other pieces on the chessboard can be captured...
Projectile motion with air resistance code in c language
Projectile motion with air resistance code in c language
bus reservation system code using c language in this system we can add seat and remove....
bus reservation system code using c language in this system we can add seat and remove. this code will be in c language using 2 d aray
Explain the differences between an assembly language source code file, the listing file produced by 'nasm',...
Explain the differences between an assembly language source code file, the listing file produced by 'nasm', the object file (.o) and the final executable program.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT