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...
Assembly language: please comment on every line of code explaining each part. include head comments describing...
Assembly language: please comment on every line of code explaining each part. include head comments describing what your program does. Assignment 3A - A program that adds and subtracts 32-bit numbers After installing the assembler on the computer, enter the following program, save it, assemble it and run it. Do not forget to add a comment with your name in it. You will hand in a listing (e.g., addsum.asm) that should include your name ________________________________________ TITLE Add and Subtract (AddSum.asm)...
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 programming language how do you find if all the character on a single line...
In C programming language how do you find if all the character on a single line in a 2 dimensional array are the same? The program should read line by line to check if all the characters on a line are the same. For this program we want to see if the * character ever shows up on a line where it is the only character on the line. as seen below. so lets say we have a array with...
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...
Comment the code explaining what each line is doing. The first line has been done for...
Comment the code explaining what each line is doing. The first line has been done for you. x=[0 0 -1 2 3 -2 0 1 0 0]; %input discrete-time signal x dtx= -2:7; y=[1 -1 2 4]; dty=8:11; z=conv(x,y); dtz=6:18; subplot(1,3,1), stem(dtx,x) subplot(1,3,2), stem(dty,y) subplot(1,3,3), stem(dtz,z)
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT