.
  Vyom World.com . Let's Touch the Sky Together!  
.

Home
VyomWorld.com Home
Interview Questions
VyomLinks.com Home
JobsAssist.com Home
Vyom Network
Contact Us
Jobs & Careers
Resume Submitter
Placement Papers
IT Companies Directory
Computer Jobs
Interview Questions
Online Exams
Vyom Career eMag.
Fun
Send FREE SMS!
SMS Jokes
Source Codes Library
Source Codes Home
ASP Source Codes
C Source Codes
C++ Source Codes
COBOL Source Codes
Java Source Codes
Pascal Source Codes
Submit Source Codes
GATE
GATE an Overview
GATE Preparation
Study Materal
GRE
GRE an Overview
GRE Questions
GRE Preparation
GRE Universities
TOEFL Preparation
TOEFL Resources
GMAT Preparation
GMAT Resources
MBA Preparation
MBA Resources
Networking Concepts
Networking Concepts
Testing Preparation
Testing Resources
Webmasters
Free Traffic Builder
Webmaster Articles
Web Hosting
Tutorials
Hardware Tutorial
1500 Free eBooks New!


Home » Placement Papers » Motorola Placement Papers » Motorola Previous Year Placement Paper

 

Motorola Placement Paper -: .Net Questions With Answers


Advertisements
Advertisements




Motorola Previous Years Solved Sample Placement Papers

  1. What will be the output of the following C# code?

    using System;
    
    namespace MyApplication {
      class Program {
        static void Main(string[] args) {
          bool x = true;
          Console.Write(Convert.ToString(x));
        }
      }
    }
        

    A: True

    B: true

    C: False

    D: false

    Ans: A) True

    Explanation: In the above C# code, we are using Convert.ToString() method which converts a bool to string. Thus, the output will be "True".

  2. What will be the output of the following C# code?

    using System;
    
    namespace MyApplication {
      class Program {
        static void Main(string[] args) {
          double x = 10.25;
          Console.Write(Convert.ToInt32(x));
        }
      }
    }
        

    A: 10.30

    B: 10.25

    C: 10

    D: Error

    Ans: C) 10

    Explanation: In the above C# code, we are using Convert.ToInt32() method which converts a double to int. Thus, the output will be "10".

  3. What is 'Console' in C#?

    A: Class

    B: Object

    C: Method

    D: Structure

    Ans: A) Class

    Explanation: In C#, the Console class is used to represent the standard input, output, and error streams for console applications.

  4. What will be the output of the following C# code, if the input is 123?

    using System;
    
    namespace MyApplication {
      class Program {
        static void Main(string[] args) {
          Console.WriteLine("Enter a number:");
          int num = Console.ReadLine();
          Console.WriteLine("Given number is: " + num);
        }
      }
    }
        

    A: Given number is:123

    B: Given number is: 123

    C: Given number is: "123"

    D: Error

    Ans: D) Error

    Explanation: In C#, Console.ReadLine() is used to read a string. Here, we are trying to assign the input to an int variable directly, which causes an error. The error is: Cannot implicitly convert type 'string' to 'int'.

  5. What will be the output of the following C# code, if the input is 123?

    using System;
    
    namespace MyApplication {
      class Program {
        static void Main(string[] args) {
          Console.WriteLine("Enter a number:");
          int num = Convert.ToInt32(Console.ReadLine());
          Console.WriteLine("Given number is: " + num);
        }
      }
    }
        

    A: Given number is:123

    B: Given number is: 123

    C: Given number is: "123"

    D: Error

    Ans: B) Given number is: 123

    Explanation: In C#, Console.ReadLine() reads input as a string. Using Convert.ToInt32(), we convert the input to an int, so there is no error. Output will be: Given number is: 123.

  6. Which is/are the correct method(s) to input a float value in C#?

    A: Parse(Console.ReadLine())

    B: ToSingle(Console.ReadLine())

    C: ToFloat(Console.ReadLine())

    D: Both A and B

    E: Both A and C

    Ans: D) Both A and B

    Explanation: In C#, the following methods can be used to input a float value:

    • float.Parse(Console.ReadLine()): Parses a string to a float.
    • Convert.ToSingle(Console.ReadLine()): Converts a string to a single-precision floating-point number.

    ToFloat(Console.ReadLine()) is not a valid method in C#.




 


.

Recently Updated: New Placement Papers added.
Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Programming & Source Codes | GRE Preparation | Jobs, Discussions | Software Listing | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | International Business Information | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | FAQs | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Excellent Mobiles | Software Testing | Interview Questions | Freshers Jobs | Server Insiders | File Extension Directory

Copyright ©2003-2024 Vyom Technosoft Pvt. Ltd., All Rights Reserved. Read our Privacy Policy