Stcc Prog-116 C# 2010 Chapters 1 - 4 Study Quiz

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Sylvia
S
Sylvia
Community Contributor
Quizzes Created: 1 | Total Attempts: 259
| Attempts: 259
SettingsSettings
Please wait...
  • 1/90 Questions

    Name one of  the two prefixes that should be used for the int data type

Please wait...
Stcc Prog-116 C# 2010 Chapters 1 - 4 Study Quiz - Quiz
About This Quiz

This quiz combines all of the Chapter Questions and Knowledge Check Questions from Chapters 1-4.


Quiz Preview

  • 2. 

    Name one of  the two prefixes that should be used for the char data type

    Explanation
    The correct answer is "chr" and "c". These are the two prefixes that should be used for the char data type. The "chr" prefix is commonly used to indicate a character, while the "c" prefix is a shorter alternative. Both prefixes are valid and can be used interchangeably when declaring variables of the char data type.

    Rate this question:

  • 3. 

    Name one of  the two prefixes that should be used for the String data type

    Explanation
    The correct answer is "str" and "s" because these are two common prefixes that are used to represent the String data type in programming languages. The prefix "str" is often used to indicate a variable or object that stores a string value, while the prefix "s" is a shorter alternative that is also commonly used. These prefixes help to distinguish String variables from variables of other data types and make the code more readable and understandable.

    Rate this question:

  • 4. 

    Name one of  the two prefixes that should be used for the byte data type

    Explanation
    The correct answer is "byte". In Java, "byte" is a primitive data type used to store whole numbers from -128 to 127. It occupies 8 bits of memory. "by" and "byt" are not valid prefixes for the byte data type.

    Rate this question:

  • 5. 

    Name one of  the two prefixes that should be used for the double data type

    Explanation
    The correct answer is "dbl, d". These are the two prefixes that should be used for the double data type. The prefix "dbl" is a commonly used abbreviation for "double", while the prefix "d" is also accepted and understood by programmers as a shorthand for "double". Both prefixes indicate that the variable or constant is of the double data type, which is used to store decimal numbers with a larger range and precision compared to other numeric data types.

    Rate this question:

  • 6. 

    Name one of  the two prefixes that should be used for the float data type

    Explanation
    The correct answer is "flt, f". These are the two prefixes that should be used for the float data type. The prefix "flt" is a commonly used abbreviation for "float", while the prefix "f" is a shorthand notation that is also widely accepted and used in programming languages. Both prefixes indicate that a variable or constant is of the float data type, which represents decimal numbers with a fractional component.

    Rate this question:

  • 7. 

    What is the (industry standard) prefix that should be used for the following Object: Textboxes

    Explanation
    The industry standard prefix for the given object "Textboxes" is "txt". This prefix is commonly used to indicate that the object is a textbox. It helps in maintaining consistency and clarity in naming conventions within the industry.

    Rate this question:

  • 8. 

    What is the (industry standard) prefix that should be used for the following Object: Labels

    Explanation
    The industry standard prefix "lbl" should be used for the given object "Labels". This prefix is commonly used to indicate that the object is a label. It helps to maintain consistency and clarity in the code, making it easier for developers to understand and work with the object.

    Rate this question:

  • 9. 

    When you run a form after you’ve used the Form Designer to design it but haven’t added any code to it , the buttons don’t cause anything to happen, but otherwise the form works

    • True

    • False

    Correct Answer
    A. True
    Explanation
    When you run a form after designing it using the Form Designer but without adding any code to it, the buttons on the form will not trigger any specific actions or events. However, the rest of the form will still function as intended. This means that the form will be displayed and any other elements or functionality that were designed in the Form Designer will still be present and usable. The buttons, in this case, will not have any associated code to execute, so clicking on them will not cause any specific actions to occur. Therefore, the statement "the buttons don't cause anything to happen, but otherwise the form works" is true.

    Rate this question:

  • 10. 

    Name one of  the two prefixes that should be used for the bool data type

    Correct Answer
    bln
    b
    Explanation
    also acceptable are boo and bool, but bln and b are more commonly used.

    Rate this question:

  • 11. 

    What is the (industry standard) prefix that should be used for the following Object: Forms

    Correct Answer
    frm
    Explanation
    The industry standard prefix "frm" should be used for the object "Forms". This prefix is commonly used to indicate that the object is a form, which is a graphical user interface component used to collect and organize data. By using this prefix, it helps to clearly identify and differentiate the object as a form within the context of the industry standard naming conventions.

    Rate this question:

  • 12. 

    Examine the first two lines of code and then compare it to the third line of code.  Do they accomplish the same thing? int iCount; iCount = 10; int iCount = 10;

    • Yes

    • No

    Correct Answer
    A. Yes
    Explanation
    The first two lines of code declare a variable called iCount and assign the value 10 to it. The third line of code combines the declaration and assignment into a single line. Both sets of code accomplish the same thing, which is initializing the variable iCount with the value 10. Therefore, the answer is yes, they accomplish the same thing.

    Rate this question:

  • 13. 

    A variable stores a value that can be change as the program executes.

    • True

    • False

    Correct Answer
    A. True
    Explanation
    A variable is a container that holds a value, and this value can be changed as the program runs. In programming, variables are used to store and manipulate data. By assigning different values to a variable throughout the program, we can update and modify the data as needed. Therefore, the statement that a variable stores a value that can be changed as the program executes is true.

    Rate this question:

  • 14. 

    The following code calls the Focus method of the txtMonthlyInvestment control: txtMonthlyInvestment.Focus();

    • True

    • False

    Correct Answer
    A. True
    Explanation
    This code snippet calls the Focus method of the txtMonthlyInvestment control, indicating that the control will receive the focus or become the active element on the page. Therefore, the correct answer is True.

    Rate this question:

  • 15. 

    The C# char data type supports the two-byte Unicode character set, which can store practically store any character from any language in the world.

    • True

    • False

    Correct Answer
    A. True
    Explanation
    The C# char data type is capable of storing the two-byte Unicode character set, which means it can accommodate characters from any language in the world. This makes the statement true.

    Rate this question:

  • 16. 

    DateTimedateNumber9 = Convert.ToDateTime("06/08/98 17:30"); String sOutput = dateNumber9.ToString("d"); What is the value of sOutput?

    Correct Answer
    6/8/1998
    Explanation
    The value of sOutput is "6/8/1998". This is because the Convert.ToDateTime() method is used to convert the given string "06/08/98 17:30" to a DateTime object. Then, the ToString() method is used with the "d" format specifier, which represents the short date pattern. This pattern displays the date in the format "M/d/yyyy", resulting in the value "6/8/1998" for sOutput.

    Rate this question:

  • 17. 

    Is this a valid statement in C# (will it compile and work): int iAge = 0, iCount = 10;

    • Yes

    • No

    Correct Answer
    A. Yes
    Explanation
    This statement is valid in C#. It declares two integer variables, iAge and iCount, and initializes them with the values 0 and 10 respectively. This code will compile and work without any issues.

    Rate this question:

  • 18. 

     float fNumber1 = 12.3f;  String sOutput = fNumber1.ToString("n3"); What is the value of sOutput?

    Correct Answer
    12.300
    Explanation
    The value of sOutput is "12.300". The code is converting the float variable fNumber1 to a string using the ToString method with the format "n3", which specifies that the number should be displayed with 3 decimal places.

    Rate this question:

  • 19. 

    Decimal decNumber3 = 1234567.1m; String sOutput = decNumber3.ToString("c0"); What is the value of sOutput?

    Correct Answer
    $1,234,567
    Explanation
    The value of sOutput is formatted as a currency with no decimal places. It displays the number 1234567 as $1,234,567.

    Rate this question:

  • 20. 

    Name one of  the two prefixes that should be used for the long data type

    Correct Answer
    lng
    l
    Explanation
    The correct answer is "lng" or "l". These are the two prefixes that should be used for the long data type. The "lng" prefix is commonly used to indicate a long integer data type, while the "l" prefix is used in some programming languages to denote a long data type. Both prefixes are used to differentiate the long data type from other data types, such as integers or floating-point numbers.

    Rate this question:

  • 21. 

    Float fNumber4 = 123456.0f; String sOutput = fNumber4.ToString("f1"); What is the value of sOutput?

    Correct Answer
    123456.0
    Explanation
    The value of sOutput is "123456.0" because the ToString("f1") method formats the float value fNumber4 with one decimal place.

    Rate this question:

  • 22. 

    Float fNumber2 = 12.348f; String sOutput = fNumber2.ToString("n1"); What is the value of sOutput?

    Correct Answer
    12.3
    Explanation
    The value of sOutput is 12.3 because the ToString("n1") method formats the float value to have one decimal place. Therefore, the float value 12.348 is rounded to 12.3.

    Rate this question:

  • 23. 

    DateTimedateNumber10 = Convert.ToDateTime("06/08/98 17:30"); String sOutput = dateNumber10.ToString("t"); What is the value of sOutput?

    Correct Answer
    5:30 PM
    5:30PM
    Explanation
    The value of sOutput is "5:30 PM" because the Convert.ToDateTime() method is used to convert the string "06/08/98 17:30" into a DateTime object. Then, the ToString("t") method is called on the DateTime object to convert it into a string representation of the time in the current culture's short time format, which is "5:30 PM".

    Rate this question:

  • 24. 

     Name one of  the two prefixes that should be used for the short data type  

    Correct Answer
    sht
    n
    Explanation
    One of the two prefixes that should be used for the short data type is "sht". The "sht" prefix is commonly used to indicate a variable or data type that stores short integer values. It is a standard naming convention in programming languages to use prefixes to provide clarity and indicate the type or purpose of a variable. The "sht" prefix helps programmers easily identify and differentiate short integer variables from other data types.

    Rate this question:

  • 25. 

    A user entry that can't be converted to a number is a common cause of a runtime error

    • True

    • False

    Correct Answer
    A. True
    Explanation
    When a user enters a value that cannot be converted to a number (e.g., entering letters instead of digits), it can cause a runtime error. This is because the program expects a numeric input but receives an incompatible data type. The program may not be able to handle this unexpected input, leading to a runtime error. Therefore, it is true that a user entry that cannot be converted to a number is a common cause of a runtime error.

    Rate this question:

  • 26. 

    Float fNumber5 = 123456.0f; String sOutput = fNumber5.ToString("n0"); What is the value of sOutput?

    Correct Answer
    123,456
    Explanation
    The value of sOutput is 123,456. This is because the ToString("n0") method is used to format the float number fNumber5 as a string with zero decimal places and using thousands separators.

    Rate this question:

  • 27. 

    Float fNumber6 = .234f; String sOutput = fNumber6.ToString("p2"); What is the value of sOutput?

    Correct Answer
    23.40%
    23.40 %
    Explanation
    The value of sOutput is "23.40%". The given code converts the float variable fNumber6 into a string representation using the format "p2", which means it will be displayed as a percentage with two decimal places. Therefore, the resulting string will be "23.40%".

    Rate this question:

  • 28. 

    Which of the following is a valid comment?

    • "" This is a comment

    • / This is a comment /

    • ' This is a comment '

    • // This is a comment

    Correct Answer
    A. // This is a comment
    Explanation
    The correct answer is "// This is a comment" because in programming languages like C++, Java, and JavaScript, the double forward slash "//" is used to indicate a single-line comment. This means that anything written after the "//" will be ignored by the compiler or interpreter, making it a valid comment. The other options are not valid comments because they either lack the required syntax or do not follow the conventions of the programming language.

    Rate this question:

  • 29. 

    A constant stores data

    • That changes as a program executes

    • That does not change as a program executes

    • That changes with user input

    • That changes when the program exits

    Correct Answer
    A. That does not change as a program executes
    Explanation
    A constant stores data that does not change as a program executes. This means that the value assigned to a constant remains the same throughout the execution of the program and cannot be modified. Constants are typically used to store fixed values or values that should not be altered during the program's execution.

    Rate this question:

  • 30. 

    To change the file name for a form, project, or solution you use the

    • Windows Explorer

    • Toolbox

    • Solution Explorer

    • Form Designer

    Correct Answer
    A. Solution Explorer
    Explanation
    To change the file name for a form, project, or solution, the correct tool to use is the Solution Explorer. The Solution Explorer provides a hierarchical view of the files and folders in a project or solution. It allows you to easily navigate through the project structure and make changes to file names, add or remove files, and organize the project.

    Rate this question:

  • 31. 

    To improve the readability of your C# code, it's recommended that you use all capital letters for variable names.

    • True

    • False

    Correct Answer
    A. False
    Explanation
    Using all capital letters for variable names is not recommended for improving the readability of C# code. It is a common convention to use camel case for variable names in C#, where the first letter of each word is capitalized except for the first word. This convention helps to make the code more readable and understandable for other developers. Using all capital letters can make the code harder to read and understand, as it may be perceived as shouting or emphasizing the variable name.

    Rate this question:

  • 32. 

    What type of control is used to provide for user entry?

    • Label

    • Listbox

    • Button

    • Textbox

    Correct Answer
    A. Textbox
    Explanation
    A textbox is used to provide for user entry. It allows the user to input text or data into a form or application. Unlike a label, which only displays text, a textbox allows the user to interact with it by typing or editing text. Listbox and button controls do not directly provide for user entry, as a listbox displays a list of options for selection and a button triggers an action. Therefore, a textbox is the correct control for user entry.

    Rate this question:

  • 33. 

    Int i = 4; int j = 8; int k = 17; Given the above variables, what is the value of x after the following statement is executed? int x = i + j;

    • 4

    • 12

    • 8

    • 32

    Correct Answer
    A. 12
    Explanation
    The value of x after the statement "int x = i + j;" is executed is 12. This is because the variables i and j are assigned the values 4 and 8 respectively. The addition operation "i + j" evaluates to 12, which is then assigned to the variable x.

    Rate this question:

  • 34. 

    What is the name of the Visual Studio window that contains controls that you can drag on to a form?

    • Solution Explorer

    • Code Editor

    • Toolbox

    • Error List

    Correct Answer
    A. Toolbox
    Explanation
    The Toolbox window in Visual Studio contains controls that can be dragged onto a form. These controls are pre-built components that can be used to add functionality and interactivity to the form. The Toolbox provides a convenient way to access and add these controls to the design surface of the form, making it easier for developers to build the user interface of their application.

    Rate this question:

  • 35. 

    The CancelButton property of a form sets the button that will be activated if the user presses the _________________ key

    • Alt

    • Esc

    • Ctrl

    • Shift

    Correct Answer
    A. Esc
    Explanation
    The CancelButton property of a form sets the button that will be activated if the user presses the Esc key. This means that when the user is interacting with the form and presses the Esc key, the action associated with the CancelButton will be triggered. This is useful in situations where the user wants to cancel or close the form without submitting any changes or performing any further actions.

    Rate this question:

  • 36. 

    To override the order of precedence in an arithmetic expression, you can use:

    • Double quotes

    • Single quotes

    • Parentheses

    • Braces

    Correct Answer
    A. Parentheses
    Explanation
    Parentheses are used in an arithmetic expression to specify the order in which operations should be performed. When parentheses are used, the operations within them are evaluated first, overriding the default order of precedence. This allows for more control and flexibility in performing calculations.

    Rate this question:

  • 37. 

    What is this an example of? int TaxRate = (int)2.5d;

    • Implicit casting

    • Explicit casting

    Correct Answer
    A. Explicit casting
    Explanation
    The given code is an example of explicit casting. The variable "TaxRate" is being assigned the value of 2.5d, which is a double data type. However, the variable is declared as an integer (int). In order to assign a double value to an integer variable, explicit casting is required. The "(int)" before 2.5d indicates the explicit casting of the double value to an integer value.

    Rate this question:

  • 38. 

    When assigning a value to a string data type you must enclose the value in what:

    • () parenthesis

    • "" double quotes

    • {} braces

    • '' single quotes

    Correct Answer
    A. "" double quotes
    Explanation
    When assigning a value to a string data type, the value must be enclosed in double quotes (""). Double quotes are used to indicate that the characters within them should be treated as a string. This is a common convention in many programming languages. Parentheses, braces, and single quotes are not used to enclose string values. Parentheses are used for grouping expressions, braces are used for defining blocks of code or data structures, and single quotes are used for enclosing character literals.

    Rate this question:

  • 39. 

    Decimal decNumber7 = -1234567.871m; String sOutput = decNumber7.ToString("c2"); What is the value of sOutput?

    Correct Answer
    ($1,234,567.87)
    Explanation
    The value of sOutput is ($1,234,567.87) because the ToString("c2") method is used to format the decimal number as a currency value with two decimal places. The negative sign is included in the formatted output.

    Rate this question:

  • 40. 

    Int i = 4; int j = 8; int k = 17; Given the above variables, what is the value of x after the following statement is executed? int x = j / i;

    • 0.5

    • 0

    • 4

    • 2

    Correct Answer
    A. 2
    Explanation
    The value of x after the statement is executed is 2. This is because the division operator (/) performs integer division, which discards any decimal places. Therefore, when j (8) is divided by i (4), the result is 2.

    Rate this question:

  • 41. 

    To concatenate two or more strings into one, you use this character:

    • &

    • @

    • *

    • +

    Correct Answer
    A. +
    Explanation
    To concatenate two or more strings into one, you use the "+" character. The "+" operator is used to combine or join strings together, resulting in a new string that contains the combined values of the original strings. For example, if you have two strings "Hello" and "World", using the "+" operator like "Hello" + "World" would result in the concatenated string "HelloWorld".

    Rate this question:

  • 42. 

    Is this a valid statement in C# (will it compile and work): string sName = 'Brian Candido';

    • Yes

    • No

    Correct Answer
    A. No
    Explanation
    The given statement is not valid in C#. In C#, single quotes ('') are used to represent characters, not strings. To represent a string, double quotes ("") should be used. Therefore, to make the statement valid, the string should be enclosed in double quotes like this: string sName = "Brian Candido";

    Rate this question:

  • 43. 

    Decimal a = 2.5m; decimal b = 4.0m; decimal c = 12.7m; Given the above variables, what is the value of x after the following statement is executed? decimal x = a + b;

    • 2.5

    • 6

    • 6.5

    • 10

    Correct Answer
    A. 6.5
    Explanation
    When the statement "decimal x = a + b;" is executed, the values of variables a and b are added together. Since a is 2.5 and b is 4.0, the sum of these two values is 6.5. Therefore, the value of x after the statement is executed is 6.5.

    Rate this question:

  • 44. 

    Int i = 4; int j = 8; int k = 17; Given the above variables, what is the value of x after the following statement is executed? double x = Math.Pow(i, 2);

    • 0

    • 2

    • 4

    • 16

    Correct Answer
    A. 16
    Explanation
    The value of x after executing the statement is 16. The Math.Pow() function is used to calculate the power of a number. In this case, it calculates the square of the variable i, which has a value of 4. So, 4 raised to the power of 2 is equal to 16, which is the value assigned to x.

    Rate this question:

  • 45. 

    IDE stands for what?

    • Intelligent Design Environment

    • Intelligent Development Environment

    • Integrated Design Environment

    • Integrated Development Environment

    Correct Answer
    A. Integrated Development Environment
    Explanation
    An IDE is a software application that provides comprehensive tools and features for software development. It integrates various tools, such as code editors, compilers, debuggers, and build automation tools, into a single platform, making it easier for developers to write, test, and debug code. Therefore, the correct answer is Integrated Development Environment.

    Rate this question:

  • 46. 

    If you want to write C# code you would use what?:

    • Solutions Explorer

    • Forms Designer

    • Code Editor

    • Console Designer

    Correct Answer
    A. Code Editor
    Explanation
    The code editor is the correct answer because it is the tool used for writing C# code. It provides features such as syntax highlighting, code completion, and debugging capabilities, making it easier for developers to write and edit their code. The solutions explorer, forms designer, and console designer are other tools in the development environment that serve different purposes but are not specifically used for writing code in C#.

    Rate this question:

  • 47. 

    Which of the following is a valid decimal literal?

    • 30.0d

    • 30.0f

    • 30.0m

    • 30.0n

    Correct Answer
    A. 30.0m
    Explanation
    The letter "m" in the decimal literal "30.0m" represents the suffix for a decimal data type in some programming languages, such as C#. This suffix is used to indicate that the number should be treated as a decimal value. Therefore, "30.0m" is a valid decimal literal.

    Rate this question:

  • 48. 

    Which values can a boolean data type contain (pick all that apply):

    • Characters

    • Numbers

    • True

    • False

    Correct Answer(s)
    A. True
    A. False
    Explanation
    A boolean data type can only contain two values, which are True and False. It cannot contain characters or numbers.

    Rate this question:

  • 49. 

    Int i = 4; int j = 8; int k = 17; Given the above variables, what is the value of x after the following statement is executed? int x = k % j;

    • 1

    • 2

    • 3

    • 4

    Correct Answer
    A. 1
    Explanation
    The statement "int x = k % j;" calculates the remainder when k is divided by j. In this case, k is 17 and j is 8. When 17 is divided by 8, the remainder is 1. Therefore, the value of x after executing this statement is 1.

    Rate this question:

Quiz Review Timeline (Updated): Mar 21, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Oct 13, 2011
    Quiz Created by
    Sylvia
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.