WorksheetsMidterm Exam ICTC1023
Total questions: 40
Worksheet time: 30mins
It infers to the type that do not contain the actual data stored in a variable, but it contains a reference to the variables.
reference
Both a and c
value
variable
Deduce the value to be returned by Equals( ) method
TRUE or FALSE
true or false
TRUE
FALSE
The ____method in C# is declared differently from the main function in C++.
Main( )
Main
main( )
main
Compare() method returns __ if string1 < string2
1
-1
0
2
In C#, variables are categorized into _ types.
3
2
5
4
__ property determines the length of a string
Length
length
Length( )
None of the above
A method which can be used to extract a portion of a string from starting point for a specific length
Substring( )
Length ( )
Substring
None of the above
There are __ pre-written methods to compare strings
2
3
4
5
CompareTo( ) is a ___ method
Static
Non-static
Compare() method returns _ if string1 == string2
1
2
0
-1
Objects communicates through invoking methods and sending data to them
Class Definitions
Message Passing
Objects
one of the above
It accepts input from the user and store it into a variable.
ReadLine( )
WriteLine( )
ReadKey( )
None of the above
using System.Windows.Forms is the directive to create
web-based application
console application
windows forms application
None of the above
It allows you to customize your form layout
Form1.Designer
Form1.cs
Program.cs
None of the above
Suppose we use for (int i = 0; i < 9; i++), variable i will display
0…8
1…9
1…8
None of the above
In the code, Console.WriteLine(" compare {0} to {1}: {2}", string1, string2, String.Equals(string1, string2)),
we declared
string string1 = "Cheri" , string2 = "Cherry", this will return
0
TRUE
FALSE
1
The using directive System.Linq can be removed when running console application
Yes
No
TRUE
None of the above
The lines of code below will not cause an error if we remove
if (number1 > number2)
{ Console.WriteLine("{0} is greater than {1} ", number1, number2) }
{ }
( )
“ “
None of the above
Using C#, the keyword __ is valid
else
Else
ELSE
None of the above
Using C#, the directive __ is the most important
System
system
SYSTEM
None of the above
Using C#, the given conversions are valid except
Convert.ToInt34
Convert.ToDouble
Convert.ToInt16
Convert.ToString
Determine what causes the error
if (grade.Equals("INC" | | grade.Equals("inc"))
missing )
space in | |
("inc")
None of the above
The given declaration of strings are valid except
String SemGrade
string SemGrade;
String SemGrade;
Is there an error in the given Form1.cs code
private void button3_Click(object sender, EventArgs e)
{
MessageBox.Show("Hello " + textBox1.Text + " !!!" + "\n" + "Welcome to OOP environment.");
}
None
Yes - MessageBox.Show
Yes - button3_Click
Yes - private
The default namespace is
namespace ConsoleApplication1
namespace ConsoleApplication
namespace ConsoleApplication2
Program.cs can be renamed in ____
Determine the window part
Server Explorer window
Solution Explorer window
Properties window
In OOP, dot notation is represented by
Method_Name.Object_name.()
Object_name.Method_Name()
Use camelCase for ___
class name and method name
variable name and method arguments
Identify what has been performed in the given line of code:
Print p = new Print( );
Inheritance
Instantiation
Data Abstraction
Classes
Recognize the OOP characteristic that has been represented in the given lines of code:
private void BtnAdd_Click(object sender, EventArgs e)
{
total1 = total1 + Convert.ToDouble(txtDisplay.Text);
txtDisplay.Clear();
btnAddClick = true;
btnSubtractClick = false;
btnMultiplyClick = false;
btnDivideClick = false;
}
Inheritance
Data Abstraction
Instantiation
Form1 refers to __
source file
form designer
main form
main program
Textbox, label, command button, menu, image are called __
objects
controls
credentials
forms
MessageBoxButtons.YesNo constitutes a message box with command buttons Yes and No
True
False
InitializeComponent() method in Visual Studio.NET C# is a method that is automatically created and managed by Windows Forms designer and it defines everything you see on the form. Everything done on the form in VS.NET using designers generates code.
False
True
Refers to a template, declaration or blueprint that is used for classifying object
object
class
namespace
directive
To test the function of Form1, use the method __ in the main program
Application.EnableVisualStyles();
Application.Run( );
Application.SetCompatibleTextRenderingDefault( );
The form property that displays the form in the center of the screen
WindState
StartPosition
ShowIcon
The form property that will remove the minimize, restore, close buttons of the selected form
MaximizeBox
ControlBox
MainMenuStrip
Determine the OOP characteristic exemplified in the given line of code
public partial class Form1 : Form
Data Abstraction
Inheritance
Instantiation
Polymorphism
Identify the next form to be navigated in the codes below:
Calculator calc = new Calculator();
calc.Show();
this.Hide();
Form2
Form3
Calculator
calc
