recategorized by
446 views

4 Answers

0 votes
0 votes
The code will give compiler error because variable rem is not declared. Therefore answer is option A) code won’t compile.
0 votes
0 votes

The Ans is (b) 

 

The first ternary: (1 ? cout << "remainder is one" : rem == 2 ? cout << "remainder is two" : cout << "divisible by three");

  • Since 1 is a non-zero value, the condition is considered true, so the first expression is executed:
  • cout << "remainder is one".
0 votes
0 votes
Two errors:

1. Compilation error (not declared rem data type)

2. Syntax error ( ; not given after num = 5)
0 votes
0 votes
Option D is the correct answer.

There’s no syntax error in the code, it will calculate rem as 2, and provider output ‘remainder is two’

Related questions

0 votes
0 votes
1 answer
1
nadosha asked Apr 20
95 views
A constructor cannot be explicitly called by the client program. true or false?
0 votes
0 votes
0 answers
2
nadosha asked Apr 20
65 views
A program that includes the file containing a class declaration is called a ________ program of the class.
0 votes
0 votes
1 answer
3
rsansiya111 asked Oct 7, 2022
801 views
Which one of the following fundamental features of the OOPs is not supported by 𝐶++?(a) Persistence(b) Delegation(c) Genericity(d) Data abstraction