Are you a candidate looking to sharpen your skills? Try our practice tests or view sample interview questions & Get hired by the best. Click Here×

Winforms with C# Online Skills Assessment Test

Topics Covered

  • Panel Control
  • Blank Validation
  • Connection Objects
  • Credentials
  • Authentication
  • Track Bar
  • DataGridView
  • Development and Design

Useful for hiring

  • C# Developer- WinForms
  • C# Programmer- WinForms

Start hiring job-fit candidates using this assessment

GET A DEMO

"Interview Mocha's assessments eliminated reliance on resumes and reduced our time to hire by half. Now we spend time only on relevant candidates and take data-driven hiring decisions."

George Nichkov, Gett,
Global Analytics Team Lead
Question

Below is the code written to send a mail from an application

Some part of the code is missing which is indicated by (//Missing Part).
Select the correct option to complete the code.

Code:
 

private void btnSend_Click(object sender, EventArgs e) 

    try 
    { 
        if (ValidateForm()) 
        { 
            label3.Text = ""; 
            MailMessage mailMessage = new MailMessage(username.Text, toTextBox.Text); 
            mailMessage.Subject = subjectTextBox.Text; 
            mailMessage.Body = bodyTextArea.Text; 
           
            //Missing Part

            for (int i = 0; i < attachmentsListBox.Items.Count; i++)  
            { 
                mailMessage.Attachments.Add(new Attachment(attachmentsListBox.Items[i].ToString())); 
            } 
            SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587); 
            smtpClient.Credentials = new System.Net.NetworkCredential(username.Text, password.Text); 
            smtpClient.EnableSsl = true; 
            mailMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure; 
            smtpClient.Send(mailMessage); 
        } 
    } catch (Exception ex) 
    { 
        label3.Text = ex.Message; 
    } 
}  

Answer
    •             AddItems(TextBox.Value, mailMessage, "CC"); 
                  AddItems(TextBox.Value, mailMessage, "BCC");
       

    •             AddCC(ccTextBox.Text, mailMessage, "CC"); 
                  AddBCC(bccTextBox.Text, mailMessage, "BCC"); 
                 

    •             AddItems(ccTextBox.Text, mailMessage, "CC"); 
                  AddItems(bccTextBox.Text, mailMessage, "BCC"); 
                 

Question

How to switch between 2 Forms?

Answer
    • [Form1]
              private void button1_Click(object sender, EventArgs e)
              {
                            form2.ShowDialog();
              }

      [Form2]
              private void button1_Click(object sender, EventArgs e)
              {
                  this.Close();
              }

    • [Form1]
              private void button1_Click(object sender, EventArgs e)
              {
                  
                  Form2 form2 = new Form2();
                  form2.Dialog();
              }

      [Form2]
              private void button1_Click(object sender, EventArgs e)
              {
                  this.Close();
              }

    • [Form1]
              private void button1_Click(object sender, EventArgs e)
              {
                  this.Hide();
                  Form2 form2 = new Form2();
                  form2.ShowDialog();
                  this.Show();
              }

      [Form2]
              private void button1_Click(object sender, EventArgs e)
              {
                  this.Close();
              }

Question

Below is the code to display a tooltip on individual items in a ListBox

Some part of the code is missing which is indicated by (//Missing Part).
Select the correct option to complete the code.

Code:
 

private void onMouseMove(object sender, MouseEventArgs e)
  {
     if (sender isListBox)
     {
         ListBox listBox = (ListBox)sender;
         Point point = new Point(e.X, e.Y);
         int hoverIndex = listBox.IndexFromPoint(point);
        
         //Missing Part

      }
   }

Answer
    •          if (hoverIndex>= 0 &&hoverIndex<listBox.Items.Count)
               {
                   tt.SetToolTip(listBox, listBox.Items[hoverIndex].ToString());
                }
       

    •          if (hoverIndex<= 0 &&hoverIndex<=listBox.Items.Count)
               {
                   tt.SetToolTip(listBox, listBox.Items[hoverIndex].ToString());
                }
          

    •          if (hoverIndex>= 0 && hoverIndex<listBox.Count)
               {
                   tt.SetToolTip(listBox, listBox.Items[hoverIndex].ToString());
                }
        

Good News! You can customize this test as per your requirement

  • Choose and add questions from Interview Mocha question libraries

  • Add your own set of questions

  • Customize test settings like duration, number of questions, passing score, web proctoring and much more

  • Mail us at support@interviewmocha.com to create a custom test

Looking for a tailor-made test, to suit your assessment needs?

Get in touch

Global companies using Mocha assessments

  • altran
  • credit suisse
  • sephora
  • nielsen
  • capgemini
  • akamai

How Mocha assessments are brewed

Speed up your IT recruitment with Interview Mocha

  • 500+ IT skill tests
  • 20+ coding languages
  • 50+ domain knowledge tests
  • 100+ digital 2.0 skill tests
  • Customer focus aptitude tests
  • Enterprise ready features & more...
GET A DEMO

Why hiring managers and recruiters across the globe love Interview Mocha

Take your first step to hire job fit candidates

GET A DEMO