Tuesday, February 25, 2025

JECA 2025 QUESTION PRACTICE SET 1

 JECA 2025 QUESTION PRACTICE SET 1

Question 1:

Which disk scheduling algorithm is designed to reduce the total seek time by choosing the request that is closest to the current disk head position?

A) FCFS (First-Come, First-Served)
B) SSTF (Shortest Seek Time First)
C) SCAN
D) LOOK

Question 2:

In which of the following disk scheduling algorithms does the disk arm move from one end to the other and then reverse the direction?

A) FCFS
B) SCAN
C) C-SCAN
D) LOOK



Question 3:

Which of the following disk scheduling algorithms always moves the disk arm in a single direction?

A) FCFS
B) SCAN
C) C-SCAN
D) SSTF



Question 4:

What is the primary disadvantage of the First-Come, First-Served (FCFS) disk scheduling algorithm?

A) It can lead to high disk seek times
B) It does not guarantee fairness
C) It prioritizes critical requests
D) It causes disk head starvation

Question 5:

Which disk scheduling algorithm suffers from the problem of "starvation," where some requests may never be serviced?

A) SSTF (Shortest Seek Time First)
B) FCFS
C) SCAN
D) C-SCAN



Question 6:

Which of the following disk scheduling algorithms is most likely to cause starvation for requests far away from the current disk head position?

A) SCAN
B) LOOK
C) SSTF
D) C-SCAN



Question 7:

In the LOOK disk scheduling algorithm, the disk arm:

A) Always goes to the furthest request in one direction and then reverses
B) Moves back and forth like in SCAN but stops when there are no more requests in that direction
C) Moves only in one direction, regardless of the position of the requests
D) Chooses the request that is farthest from the current head position

Question 8:

Which disk scheduling algorithm is used in situations where the disk arm only services requests in one direction and, when reaching the end, jumps back to the starting position to continue servicing?

A) C-SCAN
B) LOOK
C) FCFS
D) SCAN

Question 9:

Which of the following disk scheduling algorithms is a modified version of SCAN where the disk arm always moves in a single direction?

A) SSTF
B) LOOK
C) C-SCAN
D) FCFS


Question 10:

Given the request queue:
Request Queue: 140, 90, 15, 200, 60, 45, 30, 180
The initial head position is at 100. Using FCFS (First-Come, First-Served) algorithm, what is the total head movement?

A) 650
B) 675
C) 720
D) 700


Question 11:

Given the request queue:
Request Queue: 140, 90, 15, 200, 60, 45, 30, 180
The initial head position is at 100. Using SSTF (Shortest Seek Time First) algorithm, what is the total head movement?

A) 350
B) 330
C) 400
D) 380



Question 12:

Consider the request queue:
Request Queue: 140, 90, 15, 200, 60, 45, 30, 180
The initial head position is at 100. Use the SCAN algorithm, and the head initially moves toward the higher numbered tracks. What is the total head movement?

A) 500
B) 450
C) 520
D) 480



Question 13:

For the request queue:
Request Queue: 140, 90, 15, 200, 60, 45, 30, 180
The initial head position is at 100. Using C-SCAN, what is the total head movement?

A) 760
B) 800
C) 780
D) 850



Question 14:

For the request queue:
Request Queue: 140, 90, 15, 200, 60, 45, 30, 180
The initial head position is at 100. Using LOOK, what is the total head movement if the head initially moves toward the lower numbered tracks?

A) 520
B) 530
C) 550
D) 570

Question 15:

Given the request queue:
Request Queue: 200, 130, 50, 80, 170, 60, 120, 150
The initial head position is at 100. Using C-LOOK, what is the total head movement?

A) 780
B) 750
C) 820
D) 770


Question 16:

Which command is used to display the current working directory in UNIX?

A) pwd
B) cd
C) ls
D) dir



Question 17:

Which command is used to change the directory in UNIX?

A) move
B) chdir
C) cd
D) dir

Question 18:

Which command in UNIX is used to list all files and directories in the current directory?

A) list
B) ls
C) dir
D) show

Question 19:

What does the command rm -r do in UNIX?

A) Removes a single file
B) Removes a directory and its contents
C) Renames a file
D) Creates a new directory



Question 20:

Which command is used to view the contents of a file in UNIX?

A) show
B) open
C) cat
D) view

Question 21:

Which command is used to display the last part of a file in UNIX?

A) head
B) tail
C) cat
D) more

Question 22:

Which command is used to find files in UNIX?

A) search
B) find
C) locate
D) grep

Question 23:

Which command is used to create a new directory in UNIX?

A) newdir
B) mkdir
C) create
D) makedir

Question 24:

Which of the following commands is used to change the file permissions in UNIX?

A) chmod
B) chown
C) setperm
D) modify



Question 25:

Which command is used to display the manual page of a command in UNIX?

A) man
B) help
C) guide
D) doc

Question 26:

Which command is used to remove a file in UNIX?

A) delete
B) remove
C) rm
D) del

Question 27:

Which command is used to count the number of lines, words, and characters in a file?

A) count
B) wc
C) lines
D) stat



Question 28:

Which command is used to display the disk usage of directories in UNIX?

A) diskusage
B) du
C) df
D) size



Question 29:

What does the command chmod 755 file.txt do?

A) Grants read and write permissions to the owner and read-only permissions to others
B) Grants full permissions to the owner and read and execute permissions to others
C) Grants full permissions to everyone
D) Removes all permissions from the owner



Question 30:

Which command is used to send a signal to a process in UNIX?

A) kill
B) terminate
C) exit
D) stop

Question 31:

Which command is used to display the current date and time in UNIX?

A) time
B) date
C) datetime
D) now



Question 32:

Which command is used to display all currently running processes in UNIX?

A) ps
B) jobs
C) process
D) tasklist



Question 33:

Which command is used to concatenate and display files in UNIX?

A) cat
B) concat
C) combine
D) join

Question 34:

Which command is used to view and search for patterns in files in UNIX?

A) search
B) grep
C) find
D) scan

Question 35:

Which command in UNIX is used to compress files?

A) zip
B) compress
C) tar
D) gzip

Question 36:

What will be the output of the following C program?

#include <stdio.h>
void main() {
    int i = 0;
    if(i++ == 0)
        printf("Hello ");
    else
        printf("World ");
}

A) Hello
B) World
C) Hello World
D) None

Question 37:

What is the result of the following C code?

int x = 5;
int y = 2;
x = x / y * y;
printf("%d", x);

A) 1
B) 2
C) 5
D) 0



Question 38:

What does the following C code print?

int x = 5;
int y = 10;
x = ++x + y++;
printf("%d %d", x, y);

A) 16 11
B) 15 11
C) 16 10
D) 15 10



Question 39:

What will be the output of this program?

#include <stdio.h>
void main() {
    int x = 1, y = 1;
    if(x++ == ++y)
        printf("Match");
    else
        printf("No Match");
}

A) Match
B) No Match
C) Compile-time error
D) Undefined behavior

Question 40:

Which of the following statements is TRUE about a union in C?

A) The members of a union share the same memory location.
B) The size of a union is the sum of the sizes of its members.
C) A union can have only one member at a time.
D) None of the above

Question 41:

What is the output of the following C program?

#include <stdio.h>
void main() {
    int i = 0;
    printf("%d ", i++);
    printf("%d ", i);
}

A) 0 1
B) 1 1
C) 1 2
D) 0 2

Question 42:

What will be the result of the following C code?

int x = 2, y = 3;
x = x ^ y;
y = x ^ y;
x = x ^ y;
printf("%d %d", x, y);

A) 2 3
B) 3 2
C) 0 0
D) Undefined behavior



Question 43:

What is the output of this program?

#include <stdio.h>
void main() {
    int arr[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
    printf("%d", *(*(arr + 1) + 1));
}

A) 4
B) 5
C) 6
D) 8

Question 44:

Which of the following statements about function pointers in C is TRUE?

A) Function pointers can point to functions with different signatures.
B) Function pointers are not allowed to be used in C.
C) A function pointer is declared using the syntax type *function_name();.
D) A function pointer stores the memory address of a variable.



Question 45

What does the following C program print?

#include <stdio.h>
void foo(int x) {
    if(x < 5) {
        x++;
        foo(x);
    }
    printf("%d ", x);
}
void main() {
    foo(0);
}

A) 1 2 3 4 5
B) 5 4 3 2 1
C) 1 2 3 4
D) 5 4 3 2

Question 46:

What is the correct syntax to declare a pointer to a function in C?

A) int *func(int x);
B) int (*func)(int x);
C) int func*(int x);
D) int *func(int x, int y);

Question 47:

What does the following program output?

#include <stdio.h>
void main() {
    int i = 10;
    while(i--) {
        printf("%d ", i);
    }
}

A) 9 8 7 6 5 4 3 2 1 0
B) 10 9 8 7 6 5 4 3 2 1
C) 9 8 7 6 5 4 3 2 1
D) Compile-time error

Question 48:

What will be the output of the following C code?

int x = 10;
int *ptr = &x;
(*ptr)++;
printf("%d", x);

A) 9
B) 10
C) 11
D) Undefined behavior



Question 49:

What is the output of the following code?

#include <stdio.h>
void main() {
    int a = 10;
    int b = 20;
    if(a = b) 
        printf("Match");
    else
        printf("No Match");
}

A) Match
B) No Match
C) Compile-time error
D) Undefined behavior



Question 50:

Which of the following is true about the sizeof operator in C?

A) It can be used with any variable type, including arrays and structures.
B) It is evaluated at runtime.
C) It can be used only with primitive data types.
D) It returns the size of a pointer to the type.



Question 51:

Which of the following is a correct declaration for a constant pointer to a constant integer in C?

A) int *const const_ptr;
B) const int *const const_ptr;
C) const int *const_ptr;
D) int const *const_ptr;



Question 52:

Which of the following functions in C can cause undefined behavior when used incorrectly?

A) malloc()
B) free()
C) strlen()
D) printf()



Question 53:

What is the output of the following code?

#include <stdio.h>
int main() {
    char *str = "Hello, World!";
    printf("%c", *(str + 7));
    return 0;
}

A) H
B) W
C) l
D) o

Question 54:

What will be the output of the following program?

#include <stdio.h>
int main() {
    int x = 0;
    switch(x) {
        case 0:
            printf("Zero");
            break;
        case 1:
            printf("One");
            break;
        default:
            printf("Default");
    }
    return 0;
}

A) Zero
B) One
C) Default
D) Compile-time error

Question 55:

What will be the output of the following code?

#include <stdio.h>
void main() {
    int i = 5;
    int *ptr = &i;
    printf("%d", ++*ptr);
}

A) 5
B) 6
C) 4
D) Undefined behavior




No comments:

Post a Comment