Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ALL QUESTIONS ARE C# BASED Given the following code segment what will print on the monitor? int ctr = 0; if (1) Console.WriteLine(true); else Console.WriteLine(false);

ALL QUESTIONS ARE C# BASED

Given the following code segment what will print on the monitor? int ctr = 0; if (1) Console.WriteLine("true"); else Console.WriteLine("false");

true

false

At least one of the lines will generate a compiler error.

The statement will compile but not execute.

What is the name given to variables declared within a method?

bool

local

static

const

None of the above.

Which of the following is not a C# relational operator?

<

>

==

<>

All of the above are C# relational operators.

A method named calcSalary is static, void and takes no arguments. Which of the following correctly calls calcSalary?

void calcSalary(void)

calcSalary(void);

void calcSalary ( );

calcSalary ( );

void = calcSalary ( );

Which of the following creates an int variable named var1 and a float variable named var2?

int var1 = 0, float var2 = 0;

int var1 = 0; float var2 = 0;

int, float var1 = 0, var2 = 0;

int var1 = 0, var2 = 0;

None of the above.

Which of the following initializer lists would correctly set the elements of array n?

int[] n = {1, 2, 3, 4, 5};

array n[int] = {1, 2, 3, 4, 5};

int n[5] = {1; 2; 3; 4; 5};

int n = new int(1, 2, 3, 4, 5);

Which of the following data types would be most appropriate for storing a variable that represents money?

decimal

int

double

float

Which of the following is an invalid variable name?

2count

two_count

_two_count

twoCount

All of the above are valid.

Which of the following conditions correctly checks for a score to be from 0 to 300 and a game to be either 1, 2, or 3?

if (score >= 0 && score <= 300 || game > 0 && game < 4)

if (score >= 0 || score <= 300 && game > 0 || game < 4)

if (score >= 0 && score <= 300 && game > 0 && game < 4)

if (score >= 0 || score <= 300 || game > 0 || game < 4)

What is the value of the following expression? 27 % 4

1

2

3

None of the above.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions

Question

Explain the metrics for evaluating training and development.

Answered: 1 week ago

Question

1. Who should participate and how will participants be recruited?

Answered: 1 week ago