0% found this document useful (0 votes)
5 views4 pages

What Is The Only Function All C

Uploaded by

Ahmed Al-nasheri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

What Is The Only Function All C

Uploaded by

Ahmed Al-nasheri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

What is the only function all C++ programs must contain?

A. start()
B. system()
C. main()
D. program()

3. What punctuation is used to signal the beginning and end of code blocks?
A. { }
B. -> and <-
C. BEGIN and END
D. ( and )

4. What punctuation ends most lines of C++ code?


A. .
B. ;
C. :
D. '

5. Which of the following is a correct comment?


A. */ Comments */
B. ** Comment **
C. /* Comment */
D. { Comment }

6. Which of the following is not a correct variable type?


A. float
B. real
C. int
D. double

7. Which of the following is the correct operator to compare two variables?


A. :=
B. =
C. equal
D. ==

1. Which of the following is true?


A. 1
B. 66
C. .1
D. -1
E. All of the above

2. Which of the following is the boolean operator for logical-and?


A. &
B. &&
C. |
D. |&
3. Evaluate !(1 && !(0 || 1)).
A. True
B. False
C. Unevaluatable

4. Which of the following shows the correct syntax for an if statement?


A. if expression
B. if { expression
C. if ( expression )
D. expression if

1. Which is not a proper prototype?


A. int funct(char x, char y);
B. double funct(char x)
C. void funct();
D. char x();

2. What is the return type of the function with prototype: "int func(char x,
float v, double t);"
A. char
B. int
C. float
D. double

3. Which of the following is a valid function call (assuming the function


exists)?
A. funct;
B. funct x, y;
C. funct();
D. int funct();

4. Which of the following is a complete function?


A. int funct();
B. int funct(int x) {return x=x+1;}
C. void funct(int) {cout<<"Hello"}
D. void funct(x) {cout<<"Hello"}

1. Which follows the case statement?


A. :
B. ;
C. -
D. A newline

2. What is required to avoid falling through from one case to the next?
A. end;
B. break;
C. Stop;
D. A semicolon.
3. What keyword covers unhandled possibilities?
A. all
B. contingency
C. default
D. other

4. What is the result of the following code?


int x=0;

switch(x)

case 1: cout<<"One";

case 0: cout<<"Zero";

case 2: cout<<"Hello World";

}
A. One
B. Zero
C. Hello World
D. ZeroHello World

What results from executing this code snippet?

int x=5, y=2;


if(x & y) {
/*_part A_*/
}
else {
/*_part B_*/
}

Part A executes because x==5 (true) and y==2 (true), thus the AND
operation evaluates as true.
Part B executes because (x & y) results in 0, or false.
Part A executes because (x & y) results in a nonzero value, or true.
Part B executes because the statement (x & y) is invalid, thus false.

What is printed from this code?


int i = 0;
printf("%d", i++);
printf("%d", i--);
printf("%d", ++i);
printf("%d", --i);
0,1,1,0
0,1,0,1
0,0,1,0
1,0,0,1

What is the value of x after running this code?

int x=10, a=-3;


x=+a;

3
7
-3
13

Which choice does not produce the same output as this code snippet?
Assume the variable i will not be used anywhere else in the code.

for (i=1;i<10;i++){
cout<<i<<endl;
}

A.
i=1;
while(i<10){
cout<<++i<<endl;
}

B.
for (int i:{1,2,3,4,5,6,7,8,9}) {
cout<<i<<endl;
}

C.
i = 1;
do {
cout<<i++<<endl;
} while(i<10);

D.
i = 1;
loop:
cout<<i++<<endl;
if(i<10) goto loop;

What would be the output of this code?


int nums[3]={2,4,3};
cout << (nums[0] << nums[1] << nums[2] );

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy