Computer Science - I Overview
28 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Linux is a _____ software.

  • Private
  • Public domain
  • Paid
  • Free (correct)
  • Data items that are divided into sub items are called as ______.

  • Arrays
  • Elementary items (correct)
  • Group items
  • Notes
  • In the declaration float *ptr;, the data type of ptr is _____ and the data type of the variable pointed to by ptr is ______.

  • float, int
  • float, float
  • pointer, float (correct)
  • int, float
  • The HTML tag used to write the definition list ______.

    <DL> Signup and view all the answers

    What is Memory Management? What are the services provided under it?

    <p>Memory management is the process of controlling and coordinating computer memory. Services provided include allocation, deallocation, protection, and sharing of memory.</p> Signup and view all the answers

    What is a pointer in C++? Give suitable example.

    <p>A pointer in C++ is a variable that stores the memory address of another variable. For example, <code>int *ptr = &amp;num;</code> declares a pointer variable <code>ptr</code> that stores the memory address of the integer variable <code>num</code>.</p> Signup and view all the answers

    Write advantages and disadvantages of HTML.

    <p>Advantages of HTML include ease of understanding, easy installation, and widespread compatibility. Disadvantages include limited functionality, lack of dynamic behavior, and not a programming language by definition.</p> Signup and view all the answers

    What are Pointer Arrays? Explain giving an example.

    <p>A pointer array is an array that stores the memory addresses of other variables, which can be of various data types. For example, <code>int *arr[5];</code> declares a pointer array <code>arr</code> of size 5 that can hold addresses of integer variables.</p> Signup and view all the answers

    What is traversing an Array? Give the algorithm for Traversing of Linear Array.

    <p>Traversing an array means accessing and processing each element of the array one by one. The algorithm for traversing a linear array involves iterating through each element using a loop.</p> Signup and view all the answers

    What are different attributes of the body tag in HTML?

    <p>The <code>body</code> tag defines the content of an HTML document, and its attributes include <code>style</code>, <code>onload</code>, and <code>onunload</code>, which are event handlers, as well as <code>bgcolor</code>, <code>background</code>, and <code>text</code>, which define the visual appearance of the content.</p> Signup and view all the answers

    What is a Class in C++? Explain the general form of the Class Declaration.

    <p>A class in C++ is a blueprint for creating objects. It defines the data members (attributes) and member functions (methods) that an object of that class can have. The general form of a class declaration is:</p> <p><code>class ClassName { // data members // member functions };</code></p> Signup and view all the answers

    What are the different methods by which a virus can infect other programs?

    <p>Viruses can infect programs through various methods, including attaching to executable files, using social engineering techniques to trick users into executing malicious code, exploiting vulnerabilities in operating systems or software, and spreading through network connections or removable media.</p> Signup and view all the answers

    Write two features of each of the following data structures: Record, Array, and Linked List.

    <p>A <strong>record</strong> is a collection of related data items stored together. Features include flexible structure and ability to store various data types.</p> <p>An <strong>array</strong> is a linear data structure that stores a fixed number of elements of the same data type. Features include constant access time and efficiency for random access.</p> <p>A <strong>linked list</strong> is a linear data structure where elements are dynamically linked through pointers. Features include dynamic memory allocation and efficient insertion and deletion.</p> Signup and view all the answers

    Write a short note on inline function.

    <p>An inline function is a function whose code is substituted directly at the point of call instead of creating a separate function call. This optimization can improve performance by reducing overhead related to function calls.</p> Signup and view all the answers

    What are COLSPAN and ROWSPAN attributes?

    <p>In HTML tables, <code>COLSPAN</code> and <code>ROWSPAN</code> attributes allow cells to span multiple columns and rows, respectively. <code>COLSPAN</code> merges a cell horizontally across multiple columns, while <code>ROWSPAN</code> merges a cell vertically across multiple rows.</p> Signup and view all the answers

    Explain three types of control structures used for flow of control.

    <p>Three common types of control structures are sequential, selection, and iteration.</p> <p>Sequential structures execute statements one after another.</p> <p>Selection structures, such as <code>if</code> statements and <code>switch</code> statements, allow for branching based on conditions.</p> <p>Iteration structures, like <code>for</code> loops and <code>while</code> loops, repeat a block of code until a certain condition is met.</p> Signup and view all the answers

    Give the basic structure of an HTML program. State its advantages and disadvantages.

    <p>The basic structure of an HTML program is:</p> <pre><code class="language-html">&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Advantages: Easy to learn and use, widely supported, consistent across browsers, and focuses on content presentation. Disadvantages: Limited functionality, cannot handle complex logic or data manipulation, and requires additional technologies for dynamic web development.</p> Signup and view all the answers

    What is a file system? List and explain types of file systems used in OS.

    <p>A file system is a logical organization of data on a storage device, allowing for efficient storage, retrieval, and management of files. Common types include FAT, NTFS, ext2, and ext4, each with different features and strengths.</p> Signup and view all the answers

    Write the size in bytes of the following data types: float, double, short int, unsigned int, long double, and char.

    <p>The size of data types can vary slightly across compilers and platforms. However, here are the typical sizes in bytes:</p> <p><code>float</code>: 4 bytes</p> <p><code>double</code>: 8 bytes</p> <p><code>short int</code>: 2 bytes</p> <p><code>unsigned int</code>: 4 bytes</p> <p><code>long double</code>: 16 bytes</p> <p><code>char</code>: 1 byte</p> Signup and view all the answers

    What is an object? Describe how members of a class can be accessed using an object of that class.

    <p>An object is an instance of a class, representing a real-world entity. Members of a class can be accessed using the dot operator (<code>.</code>) with the object name. For example, <code>objectName.memberName</code> Accesses <code>memberName</code> within the <code>objectName</code>.</p> Signup and view all the answers

    What is process scheduling? Explain scheduling objectives.

    <p>Process scheduling manages the execution of multiple processes by allocating CPU time to running processes. Objectives include maximizing CPU utilization, minimizing response time, and ensuring fairness.</p> Signup and view all the answers

    Explain Bubble sort algorithm with suitable example.

    <p>Bubble sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. Example:</p> <ol> <li>Start with the first element and compare it with the next element.</li> <li>If the first element is greater than the second, swap them.</li> <li>Repeat steps 1 and 2 for all adjacent elements in the list.</li> <li>After the first pass, the largest element will be at the end of the list.</li> <li>Repeat steps 1-4 for the remaining elements in the list, reducing the number of elements to be sorted in each iteration.</li> <li>Continue until the entire list is sorted.</li> </ol> Signup and view all the answers

    Write a C++ program to accept a set of 10 numbers and print the numbers using pointers.

    <pre><code class="language-cpp">#include &lt;iostream&gt; using namespace std; int main() { int numbers[10]; int *ptr = numbers; cout &lt;&lt; &quot;Enter 10 numbers:&quot; &lt;&lt; endl; for (int i = 0; i &lt; 10; i++) { cin &gt;&gt; *ptr; ptr++; } cout &lt;&lt; &quot;Numbers using pointers:&quot; &lt;&lt; endl; ptr = numbers; for (int i = 0; i &lt; 10; i++) { cout &lt;&lt; *ptr &lt;&lt; &quot; &quot;; ptr++; } return 0; } </code></pre> Signup and view all the answers

    Write a C++ program to accept a string from the user and reverse the string.

    <pre><code class="language-cpp">#include &lt;iostream&gt; #include &lt;string&gt; using namespace std; int main() { string str; cout &lt;&lt; &quot;Enter a string: &quot;; cin &gt;&gt; str; string reversedStr = string(str.rbegin(), str.rend()); cout &lt;&lt; &quot;Reversed string: &quot; &lt;&lt; reversedStr &lt;&lt; endl; return 0; } </code></pre> Signup and view all the answers

    Write HTML code for a webpage displaying the following table:

    City High Low Wing
    Mumbai 33 24 West
    Pune 34 25 South
    Latur 32 20 South

    <pre><code class="language-html">&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Yesterday's Weather&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Yesterday's Weather&lt;/h1&gt; &lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;City&lt;/th&gt; &lt;th&gt;High&lt;/th&gt; &lt;th&gt;Low&lt;/th&gt; &lt;th&gt;Wing&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;Mumbai&lt;/td&gt; &lt;td&gt;33&lt;/td&gt; &lt;td&gt;24&lt;/td&gt; &lt;td&gt;West&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Pune&lt;/td&gt; &lt;td&gt;34&lt;/td&gt; &lt;td&gt;25&lt;/td&gt; &lt;td&gt;South&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Latur&lt;/td&gt; &lt;td&gt;32&lt;/td&gt; &lt;td&gt;20&lt;/td&gt; &lt;td&gt;South&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> Signup and view all the answers

    Write a program in C++ to read a line of text and count the number of words in a text.

    <pre><code class="language-cpp">#include &lt;iostream&gt; #include &lt;string&gt; using namespace std; int main() { string text; cout &lt;&lt; &quot;Enter a line of text: &quot;; getline(cin, text); int wordCount = 0; bool inWord = false; for (char ch : text) { if (isspace(ch)) { inWord = false; } else if (!inWord) { wordCount++; inWord = true; } } cout &lt;&lt; &quot;Number of words: &quot; &lt;&lt; wordCount &lt;&lt; endl; return 0; } </code></pre> Signup and view all the answers

    Write a program in C++ to find the sum of the first 100 natural numbers.

    <pre><code class="language-cpp">#include &lt;iostream&gt; using namespace std; int main() { int sum = 0; for (int i = 1; i &lt;= 100; i++) { sum += i; } cout &lt;&lt; &quot;Sum of the first 100 natural numbers: &quot; &lt;&lt; sum &lt;&lt; endl; return 0; } </code></pre> Signup and view all the answers

    Write HTML code for the following table:

    Ind Eng Yuvraj Sehwag Peterson Bopara IND Win I ODI by
    387 238 183* 83 58 49 149

    <pre><code class="language-html">&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Match Summary&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Ind&lt;/th&gt; &lt;th&gt;Eng&lt;/th&gt; &lt;th&gt;Yuvraj&lt;/th&gt; &lt;th&gt;Sehwag&lt;/th&gt; &lt;th&gt;Peterson&lt;/th&gt; &lt;th&gt;Bopara&lt;/th&gt; &lt;th&gt;IND Win I ODI by&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;387&lt;/td&gt; &lt;td&gt;238&lt;/td&gt; &lt;td&gt;183*&lt;/td&gt; &lt;td&gt;83&lt;/td&gt; &lt;td&gt;58&lt;/td&gt; &lt;td&gt;49&lt;/td&gt; &lt;td&gt;149&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> Signup and view all the answers

    Study Notes

    Computer Science - I

    • Linux is a public domain software.
    • Data items divided into sub-items are called elementary items.
    • In float *ptr declaration, the data type of ptr is float and the data type of the variable pointed to by ptr is also float.

    Memory Management

    • Memory management involves services provided to manage memory.
    • A pointer in C++ is a variable that holds the memory address of another variable.

    Pointer Arrays

    • Pointer arrays are arrays of pointers.

    Traversing an Array

    • The process of accessing each element of an array one by one is array traversing. Algorithm exists to traverse arrays.

    HTML Body Tag Attributes

    • HTML body tags have attributes.

    Classes

    • Classes are used for object-oriented programming(OOP).

    Virus Infection Methods

    • Viruses can infect programs in various ways.

    Data Structures

    • Records, arrays, and linked lists are data structures.

    Inline Functions

    • Inline functions enhance code efficiency.

    COLSPAN and ROWSPAN Attributes

    • HTML attributes for controlling column and row spans in tables.

    Control Structures

    • Control structures like loops(for, while) and conditional statements(if/else) form the flow of control in most programs

    HTML Program Structure

    • The HTML program structure includes elements like , .
    • Advantages and disadvantages of HTML programming are present.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Related Documents

    Description

    This quiz covers essential topics in Computer Science I, including memory management, pointer arrays, data structures, and HTML body tag attributes. Test your understanding of these foundational concepts and their practical applications in programming and software development.

    More Like This

    Computer Science: Memory Concepts
    10 questions
    Computer Science 9608 - Lecture 2
    10 questions
    Computer Science: Main Memory
    30 questions
    Use Quizgecko on...
    Browser
    Browser